VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtVector2DD Class Reference

Detailed Description

This class provides functionality for working with 2D vectors including basic vector operations such as length calculation, normalization, and rotation.

#include <vector2DD.h>

Public Member Functions

 DtVector2DD ()
 
 DtVector2DD (double x, double y)
 
 DtVector2DD (const DtVector2DD &orig)
 
const DtVector2DDoperator= (const DtVector2DD &orig)
 
DtVector2DDoperator/= (double scalar)
 
void setX (double x)
 
double x () const
 
void setY (double y)
 
double y () const
 
void rotate (double rotationAngle)
 
double length () const
 
double lengthSquared () const
 
void normalize ()
 

Protected Attributes

double myX
 
double myY
 

Constructor & Destructor Documentation

◆ DtVector2DD() [1/3]

makVre::DtVector2DD::DtVector2DD ( )

Default constructor.

Creates a vector with coordinates (0,0)

Referenced by DtVector2DD(), operator/=(), and operator=().

◆ DtVector2DD() [2/3]

makVre::DtVector2DD::DtVector2DD ( double x,
double y )

Constructor with x and y coordinates.

Parameters
xThe x coordinate
yThe y coordinate

References x(), and y().

◆ DtVector2DD() [3/3]

makVre::DtVector2DD::DtVector2DD ( const DtVector2DD & orig)

Copy constructor.

Parameters
origThe vector to copy

References DtVector2DD().

Member Function Documentation

◆ operator=()

const DtVector2DD & makVre::DtVector2DD::operator= ( const DtVector2DD & orig)

Assignment operator.

Parameters
origThe vector to copy
Returns
Reference to this vector after assignment

References DtVector2DD().

◆ operator/=()

DtVector2DD & makVre::DtVector2DD::operator/= ( double scalar)
inline

Division assignment operator.

Divides both x and y components by a scalar value

Parameters
scalarThe scalar to divide by
Returns
Reference to this vector after division

References DtVector2DD().

◆ setX()

void makVre::DtVector2DD::setX ( double x)

Sets the x coordinate.

Parameters
xThe new x coordinate

References x().

◆ x()

double makVre::DtVector2DD::x ( ) const

Gets the x coordinate.

Returns
The x coordinate

Referenced by DtVector2DD(), makVre::operator<<(), and setX().

◆ setY()

void makVre::DtVector2DD::setY ( double y)

Sets the y coordinate.

Parameters
yThe new y coordinate

References y().

◆ y()

double makVre::DtVector2DD::y ( ) const

Gets the y coordinate.

Returns
The y coordinate

Referenced by DtVector2DD(), makVre::operator<<(), and setY().

◆ rotate()

void makVre::DtVector2DD::rotate ( double rotationAngle)
inline

Rotates the vector counter-clockwise.

Parameters
rotationAngleThe angle to rotate in radians

◆ length()

double makVre::DtVector2DD::length ( ) const
inline

Calculates the length/magnitude of the vector.

Returns
The length of the vector

◆ lengthSquared()

double makVre::DtVector2DD::lengthSquared ( ) const
inline

Calculates the squared length/magnitude of the vector.

This is more efficient than length() when comparing distances, as it avoids the square root calculation

Returns
The squared length of the vector

◆ normalize()

void makVre::DtVector2DD::normalize ( )

Normalizes the vector.

Adjusts the vector to have a length of 1 while preserving its direction

Member Data Documentation

◆ myX

double makVre::DtVector2DD::myX
protected

The x coordinate.

◆ myY

double makVre::DtVector2DD::myY
protected

The y coordinate.


The documentation for this class was generated from the following file: