CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
OdGeVector2d Class Reference

#include <GeVector2d.h>

Public Member Functions

 OdGeVector2d ()
 
 OdGeVector2d (double xx, double yy)
 
OdGeVector2dsetToProduct (const OdGeMatrix2d &matrix, const OdGeVector2d &vect)
 
OdGeVector2dsetToProduct (const OdGeVector2d &vect, double scale)
 
OdGeVector2dtransformBy (const OdGeMatrix2d &xfm)
 
OdGeVector2drotateBy (double angle)
 
OdGeVector2dmirror (const OdGeVector2d &line)
 
OdGeVector2d operator* (double scale) const
 
OdGeVector2doperator*= (double scale)
 
OdGeVector2d operator/ (double scale) const
 
OdGeVector2doperator/= (double scale)
 
OdGeVector2d operator+ (const OdGeVector2d &vect) const
 
OdGeVector2doperator+= (const OdGeVector2d &vect)
 
OdGeVector2d operator- (const OdGeVector2d &vect) const
 
OdGeVector2doperator-= (const OdGeVector2d &vect)
 
const OdGePoint2dasPoint () const
 
OdGePoint2dasPoint ()
 
OdGeVector2dsetToSum (const OdGeVector2d &vector1, const OdGeVector2d &vector2)
 
OdGeVector2d operator- () const
 
OdGeVector2dnegate ()
 
OdGeVector2d perpVector () const
 
double angle () const
 
double angleTo (const OdGeVector2d &vect) const
 
double angleToCCW (const OdGeVector2d &vect) const
 
OdGeVector2d normal (const OdGeTol &tol=OdGeContext::gTol) const
 
OdGeVector2dnormalize (const OdGeTol &tol=OdGeContext::gTol)
 
OdGeVector2dnormalize (const OdGeTol &tol, OdGeError &status)
 
double normalizeGetLength (double tol=1.e-300)
 
double length () const
 
double lengthSqrd () const
 
bool isUnitLength (const OdGeTol &tol=OdGeContext::gTol) const
 
bool isZeroLength (const OdGeTol &tol=OdGeContext::gTol) const
 
bool isParallelTo (const OdGeVector2d &vect, const OdGeTol &tol=OdGeContext::gTol) const
 
bool isParallelTo (const OdGeVector2d &vect, const OdGeTol &tol, OdGeError &status) const
 
bool isCodirectionalTo (const OdGeVector2d &vect, const OdGeTol &tol=OdGeContext::gTol) const
 
bool isCodirectionalTo (const OdGeVector2d &vect, const OdGeTol &tol, OdGeError &status) const
 
bool isPerpendicularTo (const OdGeVector2d &vect, const OdGeTol &tol=OdGeContext::gTol) const
 
bool isPerpendicularTo (const OdGeVector2d &vect, const OdGeTol &tol, OdGeError &status) const
 
double dotProduct (const OdGeVector2d &vect) const
 
double crossProduct (const OdGeVector2d &vect) const
 
bool operator== (const OdGeVector2d &vect) const
 
bool operator!= (const OdGeVector2d &vect) const
 
bool isEqualTo (const OdGeVector2d &vect, const OdGeTol &tol=OdGeContext::gTol) const
 
double operator[] (unsigned int i) const
 
double & operator[] (unsigned int i)
 
unsigned int largestElement () const
 
OdGeVector2dset (double xx, double yy)
 
 operator OdGeMatrix2d () const
 

Public Attributes

double x
 
double y
 

Static Public Attributes

static GE_STATIC_EXPORT const OdGeVector2d kIdentity
 
static GE_STATIC_EXPORT const OdGeVector2d kXAxis
 
static GE_STATIC_EXPORT const OdGeVector2d kYAxis
 

Friends

GE_TOOLKIT_EXPORT OdGeVector2d operator* (const OdGeMatrix2d &xfm, const OdGeVector2d &vect)
 
OdGeVector2d operator* (double scale, const OdGeVector2d &vector)
 

Detailed Description

This class represents vectors in 2D space.

Remarks
OdGeVector2d may be viewed as an array[2] of doubles.

Corresponding C++ library: TD_Ge

<group OdGe_Classes>

See also
<link ge_BasicTypes, Working with Basic Geometry Types>

Definition at line 50 of file GeVector2d.h.

Constructor & Destructor Documentation

◆ OdGeVector2d() [1/2]

OdGeVector2d::OdGeVector2d ( )
inline

Default constructor for the OdGeVector2d class.

Remarks
Constructs a zero-length 2D vector.

Definition at line 60 of file GeVector2d.h.

◆ OdGeVector2d() [2/2]

OdGeVector2d::OdGeVector2d ( double  xx,
double  yy 
)
inline

Constructor for the OdGeVector2d class.

Parameters
xx[in] X-coordinate.
yy[in] Y-coordinate.
Remarks
Constructs a 2D vector with specified X and Y coordinates.

Definition at line 71 of file GeVector2d.h.

Member Function Documentation

◆ angle()

double OdGeVector2d::angle ( ) const

Returns the angle between this vector and the X-axis

Remarks
Returns a value in the range [0.0 .. Oda2PI].

◆ angleTo()

double OdGeVector2d::angleTo ( const OdGeVector2d vect) const

Returns the angle between this vector and the specified vector.

Parameters
vect[in] A 2D vector, angle to which is measured.
Remarks
Returns a value in the range [0.0 .. OdaPI].

This function is commutative:

a.angleTo (b) == b.angleTo (a)

◆ angleToCCW()

double OdGeVector2d::angleToCCW ( const OdGeVector2d vect) const
inline

Returns the angle from this vector to the specified vector in the counterclockwise direction.

Parameters
vect[in] Any 2D vector.
Remarks
Returns a value in the range [-OdaPI .. OdaPI].

Definition at line 353 of file GeVector2d.h.

◆ asPoint() [1/2]

OdGePoint2d & OdGeVector2d::asPoint ( )
inline

Returns this vector as a point.

Definition at line 670 of file GeVector2d.h.

◆ asPoint() [2/2]

const OdGePoint2d & OdGeVector2d::asPoint ( ) const
inline

Returns this vector as a point.

Definition at line 663 of file GeVector2d.h.

◆ crossProduct()

double OdGeVector2d::crossProduct ( const OdGeVector2d vect) const
inline

Returns the z value of the cross product of this vector with the specified vector.

Parameters
vect[in] Any 2D vector.

Definition at line 555 of file GeVector2d.h.

◆ dotProduct()

double OdGeVector2d::dotProduct ( const OdGeVector2d vect) const
inline

Returns the dot product of this vector and the specified vector.

Parameters
vect[in] Any 2D vector.

Definition at line 543 of file GeVector2d.h.

◆ isCodirectionalTo() [1/2]

bool OdGeVector2d::isCodirectionalTo ( const OdGeVector2d vect,
const OdGeTol tol,
OdGeError status 
) const

Returns true if and only if the specified vector is codirectional to this vector within the specified tolerance.

Parameters
vect[in] Any 2D vector that is checked to be codirectional with this vector.
tol[in] Geometric tolerance.
status[out] Receives the status of test.
Remarks
If the length of either vector is < tol, kThis is returned in status.

Possible values for status are as follows:

@untitled table kOk
k0This
k0Arg1

◆ isCodirectionalTo() [2/2]

bool OdGeVector2d::isCodirectionalTo ( const OdGeVector2d vect,
const OdGeTol tol = OdGeContext::gTol 
) const

Returns true if and only if the specified vector is codirectional to this vector within the specified tolerance.

Parameters
vect[in] Any 2D vector that is checked to be codirectional with this vector.
tol[in] Geometric tolerance.

◆ isEqualTo()

bool OdGeVector2d::isEqualTo ( const OdGeVector2d vect,
const OdGeTol tol = OdGeContext::gTol 
) const

Returns true if and only if vector is identical to this vector, within the specified tolerance.

Parameters
vect[in] Any 2D vector.
tol[in] Geometric tolerance.

◆ isParallelTo() [1/2]

bool OdGeVector2d::isParallelTo ( const OdGeVector2d vect,
const OdGeTol tol,
OdGeError status 
) const

Returns true if and only if the specified vector is parallel to this vector within the specified tolerance.

Parameters
vect[in] Any 2D vector that is checked to be parallel to this vector.
tol[in] Geometric tolerance.
status[out] Receives the status of test.
Remarks
If the length of either vector is < tol, kThis is returned in status.

Possible values for status are as follows:

@untitled table kOk k0This k0Arg1

◆ isParallelTo() [2/2]

bool OdGeVector2d::isParallelTo ( const OdGeVector2d vect,
const OdGeTol tol = OdGeContext::gTol 
) const

Returns true if and only if the specified vector is parallel to this vector within the specified tolerance.

Parameters
vect[in] Any 2D vector that is checked to be parallel to this vector.
tol[in] Geometric tolerance.

◆ isPerpendicularTo() [1/2]

bool OdGeVector2d::isPerpendicularTo ( const OdGeVector2d vect,
const OdGeTol tol,
OdGeError status 
) const

Returns true if and only if the specified vector is perpendicular to this vector within the specified tolerance.

Parameters
vect[in] Any 2D vector that is checked to be perpendicular to this vector.
tol[in] Geometric tolerance.
status[out] Receives the status of test.
Remarks
If the length of either vector is > tol, kOk is returned in status.

Possible values for status are as follows:

@untitled table kOk
k0This
k0Arg1

◆ isPerpendicularTo() [2/2]

bool OdGeVector2d::isPerpendicularTo ( const OdGeVector2d vect,
const OdGeTol tol = OdGeContext::gTol 
) const

Returns true if and only if the specified vector is perpendicular to this vector within the specified tolerance.

Parameters
vect[in] Any 2D vector that is checked to be perpendicular to this vector.
tol[in] Geometric tolerance.

◆ isUnitLength()

bool OdGeVector2d::isUnitLength ( const OdGeTol tol = OdGeContext::gTol) const

Returns true if and only if the length of this vector is 1.0 within the specified tolerance.

Parameters
tol[in] Geometric tolerance.

◆ isZeroLength()

bool OdGeVector2d::isZeroLength ( const OdGeTol tol = OdGeContext::gTol) const

Returns true if and only if the length of this vector is 0.0 within the specified tolerance.

Parameters
tol[in] Geometric tolerance.

◆ largestElement()

unsigned int OdGeVector2d::largestElement ( ) const

Returns the index of the largest absolute coordinate of this vector.

Returns
Index of the largest element in the vector.

◆ length()

double OdGeVector2d::length ( ) const

Returns the length of this vector.

◆ lengthSqrd()

double OdGeVector2d::lengthSqrd ( ) const
inline

Returns the square of the length of this vector.

Definition at line 421 of file GeVector2d.h.

◆ mirror()

OdGeVector2d & OdGeVector2d::mirror ( const OdGeVector2d line)

Mirrors this vector about the specified 2D line and returns a reference to this vector.

Parameters
line[in] Mirror Line.

◆ negate()

OdGeVector2d & OdGeVector2d::negate ( )
inline

Negates this vector (-x, -y), and returns a reference to this vector.

Definition at line 307 of file GeVector2d.h.

◆ normal()

OdGeVector2d OdGeVector2d::normal ( const OdGeTol tol = OdGeContext::gTol) const

Returns the unit vector codirectional with this vector.

Parameters
tol[in] Geometric tolerance.
Remarks
If the length() <= tol, this vector is returned.

◆ normalize() [1/2]

OdGeVector2d & OdGeVector2d::normalize ( const OdGeTol tol,
OdGeError status 
)

Sets this vector to the unit vector codirectional with this vector, and returns a reference to this vector

Parameters
tol[in] Geometric tolerance.
status[out] Receives the status of normalization.
Remarks
If this.length() <= tol, this vector is unchanged, and kThis is returned in status.

Possible values for status are as follows:

@untitled table kOk k0This

◆ normalize() [2/2]

OdGeVector2d & OdGeVector2d::normalize ( const OdGeTol tol = OdGeContext::gTol)

Sets this vector to the unit vector codirectional with this vector, and returns a reference to this vector

Parameters
tol[in] Geometric tolerance.
Returns
Vector length prior to normalization. If this.length() <= tol, this vector is unchanged and 0.0 is returned.

◆ normalizeGetLength()

double OdGeVector2d::normalizeGetLength ( double  tol = 1.e-300)

Sets this vector to the unit vector codirectional with this vector, and returns the length prior to normalization.

Parameters
tol[in] Geometric tolerance.
Remarks
If this.length() <= tol, this vector is unchanged and zero length is returned.

◆ operator OdGeMatrix2d()

OdGeVector2d::operator OdGeMatrix2d ( ) const

Returns the equivalent 2D tranformation matrix.

◆ operator!=()

bool OdGeVector2d::operator!= ( const OdGeVector2d vect) const

Inequality operator for the OdGeVector2d class.

Parameters
vect[in] A 2D vector to be compared.
Remarks
Returns true if passed vector is not equal to this vector.

◆ operator*()

OdGeVector2d OdGeVector2d::operator* ( double  scale) const
inline

Multiplication operator for the OdGeVector2d class.

Parameters
scale[in] Scale factor.
Remarks
Returns a vector with multiplied coordinates of this vector by the scale factor.

Definition at line 153 of file GeVector2d.h.

◆ operator*=()

OdGeVector2d & OdGeVector2d::operator*= ( double  scale)
inline

Multiplication operator for the OdGeVector2d class.

Parameters
scale[in] Scale factor.
Remarks
Multiplies coordinates of this vector by the scale factor and returns reference to this vector.

Definition at line 172 of file GeVector2d.h.

◆ operator+()

OdGeVector2d OdGeVector2d::operator+ ( const OdGeVector2d vect) const
inline

Addition operator for the OdGeVector2d class.

Parameters
vect[in] A 2D vector to be added.
Remarks
Returns a vector that is created by adding coordinates of this vector to the coordinates of the specified vector.

Definition at line 217 of file GeVector2d.h.

◆ operator+=()

OdGeVector2d & OdGeVector2d::operator+= ( const OdGeVector2d vect)
inline

Addition operator for the OdGeVector2d class.

Parameters
vect[in] A 2D vector to be added.
Remarks
Adds coordinates of the specified vector to the coordinates of this vector and returns a reference to this vector.

Definition at line 231 of file GeVector2d.h.

◆ operator-() [1/2]

OdGeVector2d OdGeVector2d::operator- ( ) const
inline

Returns a vector with inverted X and Y coordinates.

Returns
Vector opposite to this vector.

Definition at line 300 of file GeVector2d.h.

◆ operator-() [2/2]

OdGeVector2d OdGeVector2d::operator- ( const OdGeVector2d vect) const
inline

Subtraction operator for the OdGeVector2d class.

Parameters
vect[in] A 2D vector to be subtracted.
Remarks
Returns a vector that is created by subtracting coordinates of the passed vector from the coordinates of this vector.

Definition at line 247 of file GeVector2d.h.

◆ operator-=()

OdGeVector2d & OdGeVector2d::operator-= ( const OdGeVector2d vect)
inline

Subtraction operator for the OdGeVector2d class.

Parameters
vect[in] A 2D vector to be subtracted.
Remarks
Subtracts coordinates of the passed vector from the coordinates of this vector and returns a reference to this vector.

Definition at line 261 of file GeVector2d.h.

◆ operator/()

OdGeVector2d OdGeVector2d::operator/ ( double  scale) const
inline

Division operator for the OdGeVector2d class.

Parameters
scale[in] Scale factor.
Remarks
Returns a vector with divided coordinates of this vector by the scale factor.

Definition at line 188 of file GeVector2d.h.

◆ operator/=()

OdGeVector2d & OdGeVector2d::operator/= ( double  scale)
inline

Division operator for the OdGeVector2d class.

Parameters
scale[in] Scale factor.
Remarks
Divides coordinates of this vector by the scale factor and returns reference to this vector.

Definition at line 202 of file GeVector2d.h.

◆ operator==()

bool OdGeVector2d::operator== ( const OdGeVector2d vect) const

Equality operator for the OdGeVector2d class.

Parameters
vect[in] A 2D vector to be compared.
Remarks
Returns true if passed vector is equal to this vector.

◆ operator[]() [1/2]

double & OdGeVector2d::operator[] ( unsigned int  i)
inline

References the ith coordinate of this vector.

Parameters
i[in] Index of coordinate.
Remarks
0 references the X-coordinate. 1 references the Y-coordinate.

Definition at line 618 of file GeVector2d.h.

◆ operator[]() [2/2]

double OdGeVector2d::operator[] ( unsigned int  i) const
inline

Returns the ith coordinate of this vector.

Parameters
i[in] Index of coordinate.
Remarks
0 returns the X-coordinate. 1 returns the Y-coordinate.

Definition at line 603 of file GeVector2d.h.

◆ perpVector()

OdGeVector2d OdGeVector2d::perpVector ( ) const
inline

Returns the vector perpendicular to this one (-y, x).

Definition at line 317 of file GeVector2d.h.

◆ rotateBy()

OdGeVector2d & OdGeVector2d::rotateBy ( double  angle)

Rotates this vector the specified angle, and returns a reference to this vector.

Parameters
angle[in] Rotation angle.
Remarks
Rotation angle is specified in radians. Rotation is performed counterclockwise if specified value is positive.

◆ set()

OdGeVector2d & OdGeVector2d::set ( double  xx,
double  yy 
)
inline

Sets this vector to the specified X and Y coordinates, and returns a reference to this vector.

Parameters
xx[in] X-coordinate.
yy[in] Y-coordinate.

Definition at line 639 of file GeVector2d.h.

◆ setToProduct() [1/2]

OdGeVector2d & OdGeVector2d::setToProduct ( const OdGeMatrix2d matrix,
const OdGeVector2d vect 
)
inline

Sets this vector to the product matrix * vect and returns a reference to this vector.

Parameters
matrix[in] Any 2D matrix.
vect[in] Any 2D vector

Definition at line 90 of file GeVector2d.h.

◆ setToProduct() [2/2]

OdGeVector2d & OdGeVector2d::setToProduct ( const OdGeVector2d vect,
double  scale 
)
inline

Sets this vector to the product scale * vect, and returns a reference to this vector.

Parameters
vect[in] Any 2D vector.
scale[in] Scale factor.

Definition at line 105 of file GeVector2d.h.

◆ setToSum()

OdGeVector2d & OdGeVector2d::setToSum ( const OdGeVector2d vector1,
const OdGeVector2d vector2 
)
inline

Sets this vector to vector1 + vector1, and returns a reference to this vector.

Parameters
vector1[in] Any 2D vector.
vector2[in] Any 2D vector.

Definition at line 285 of file GeVector2d.h.

◆ transformBy()

OdGeVector2d & OdGeVector2d::transformBy ( const OdGeMatrix2d xfm)
inline

Applies the 2D transformation matrix to this vector, and returns a reference to this vector.

Parameters
xfm[in] 2D transformation matrix.

Definition at line 120 of file GeVector2d.h.

Friends And Related Function Documentation

◆ operator* [1/2]

GE_TOOLKIT_EXPORT OdGeVector2d operator* ( const OdGeMatrix2d xfm,
const OdGeVector2d vect 
)
friend

◆ operator* [2/2]

OdGeVector2d operator* ( double  scale,
const OdGeVector2d vector 
)
friend

Definition at line 158 of file GeVector2d.h.

Member Data Documentation

◆ kIdentity

GE_STATIC_EXPORT const OdGeVector2d OdGeVector2d::kIdentity
static

Definition at line 75 of file GeVector2d.h.

◆ kXAxis

GE_STATIC_EXPORT const OdGeVector2d OdGeVector2d::kXAxis
static

Definition at line 76 of file GeVector2d.h.

◆ kYAxis

GE_STATIC_EXPORT const OdGeVector2d OdGeVector2d::kYAxis
static

Definition at line 77 of file GeVector2d.h.

◆ x

double OdGeVector2d::x

Definition at line 653 of file GeVector2d.h.

◆ y

double OdGeVector2d::y

Definition at line 654 of file GeVector2d.h.


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