|
ACF $AcfVersion:0$
|
Represents a position or mathematical vector in 3D space with double precision. More...
#include <CVector3d.h>
Public Types | |
| typedef imath::TVector< 3 > | BaseClass |
Public Types inherited from imath::TVector< 3 > | |
| typedef double | ElementType |
| typedef double | Elements[Size] |
Public Member Functions | |
| CVector3d () | |
| Default constructor creating an uninitialized vector. | |
| CVector3d (double x, double y, double z) | |
| Constructs a vector with specified X, Y, and Z coordinates. | |
| CVector3d (const imath::TVector< 3 > &vector) | |
| Copy constructor from a 3D TVector. | |
| CVector3d (const i2d::CVector2d &vector, double z=0) | |
| Constructs a 3D vector from a 2D vector, with optional Z coordinate. | |
| double | GetX () const |
| Gets the X coordinate of the vector. | |
| void | SetX (double value) |
| Sets the X coordinate of the vector. | |
| double | GetY () const |
| Gets the Y coordinate of the vector. | |
| void | SetY (double value) |
| Sets the Y coordinate of the vector. | |
| double | GetZ () const |
| Gets the Z coordinate of the vector. | |
| void | SetZ (double value) |
| Sets the Z coordinate of the vector. | |
| CVector3d | GetTranslated (const imath::TVector< 3 > &vector) |
| Returns a new vector translated by the given offset. | |
| CVector3d | GetCrossProduct (const imath::TVector< 3 > &vector) const |
| Calculates the cross product of this vector with another vector. | |
| CVector3d | GetNormalized (double length=1.0) const |
| Return normalized vector with the same direction and specified length. | |
| i2d::CVector2d | GetPlaneCasted () const |
| Get XY part of this 3D vector. | |
| bool | Serialize (iser::IArchive &archive) |
| Serialize this vector to specified archive. | |
| CVector3d | operator- () const |
| CVector3d | operator+ (const imath::TVector< 3 > &vector) const |
| CVector3d | operator- (const imath::TVector< 3 > &vector) const |
| CVector3d | operator* (double scalar) const |
| CVector3d | operator/ (double scalar) const |
| CVector3d & | operator+= (const imath::TVector< 3 > &vector) |
| CVector3d & | operator-= (const imath::TVector< 3 > &vector) |
| CVector3d & | operator*= (double scalar) |
| CVector3d & | operator/= (double scalar) |
Public Member Functions inherited from imath::TVector< 3 > | |
| TVector () | |
| Creates an uninitialized vector. | |
| TVector (const TVector< Size, double > &vector) | |
| Creates a copy of another vector. | |
| TVector (std::initializer_list< double > values) | |
| Creates a vector from an initializer list. | |
| const double & | GetElement (int i) const |
| Gets the element at the specified index (read-only). | |
| double & | GetElementRef (int i) |
| Gets a reference to the element at the specified index (read-write). | |
| void | SetElement (int i, const double &value) |
| Sets the element at the specified index. | |
| void | SetAllElements (const double &value) |
| Sets all elements to the same value. | |
| void | Reset () |
| Sets all coordinates to zero. | |
| void | Clear () |
| Sets all coordinates to zero. | |
| const TVector< Size, double >::Elements & | GetElements () const |
| Get read-only access to internal element container. | |
| TVector< Size, double >::Elements & | GetElementsRef () |
| Get access to internal element container. | |
| void | Translate (const TVector< Size, double > &vector) |
| Translates (adds) another vector to this vector. | |
| TVector< Size, double > | GetTranslated (const TVector< Size, double > &vector) |
| Returns a new vector that is the translation of this vector. | |
| void | GetTranslated (const TVector< Size, double > &vector, TVector< Size, double > &result) |
| Computes the translated vector and stores it in the result parameter. | |
| void | ScaledCumulate (const TVector< Size, double > &vector, double scale) |
| Adds a scaled vector to this vector. | |
| bool | IsNull (double tolerance=I_BIG_EPSILON) const |
| Checks if this vector is null (all elements approximately zero). | |
| double | GetDotProduct (const TVector< Size, double > &vector) const |
| Calculates the dot product with another vector. | |
| double | GetLength2 () const |
| Calculates the squared Euclidean length of the vector. | |
| double | GetLength () const |
| Calculates the Euclidean length (magnitude) of the vector. | |
| double | GetDistance2 (const TVector< Size, double > &vector) const |
| Calculates the squared distance to another vector. | |
| double | GetDistance (const TVector< Size, double > &vector) const |
| Calculates the Euclidean distance to another vector. | |
| double | GetElementsSum () const |
| Calculates the sum of all vector elements. | |
| bool | Normalize (double length=1.0) |
| Normalizes the vector to a specified length. | |
| bool | GetNormalized (TVector< Size, double > &result, double length=1.0) const |
| Returns a normalized copy of this vector with specified length. | |
| void | GetMinimal (const TVector< Size, double > &vector, TVector< Size, double > &result) const |
| Get vector with minimal elements values. | |
| void | GetMaximal (const TVector< Size, double > &vector, TVector< Size, double > &result) const |
| Get vector with maximal elements values. | |
| bool | Serialize (iser::IArchive &archive) |
| Serialize this vector to specified archive. | |
| bool | operator== (const TVector< Size, double > &vector) const |
| bool | operator!= (const TVector< Size, double > &vector) const |
| bool | operator< (const TVector< Size, double > &vector) const |
| bool | operator> (const TVector< Size, double > &vector) const |
| bool | operator<= (const TVector< Size, double > &vector) const |
| bool | operator>= (const TVector< Size, double > &vector) const |
| TVector< Size, double > & | operator= (const TVector< Size, double > &vector)=default |
| TVector< Size, double > | operator- () const |
| TVector< Size, double > | operator- (const TVector< Size, double > &vector) const |
| TVector< Size, double > | operator+ (const TVector< Size, double > &vector) const |
| TVector< Size, double > | operator* (double scalar) const |
| TVector< Size, double > | operator/ (double scalar) const |
| TVector< Size, double > & | operator+= (const TVector< Size, double > &vector) |
| TVector< Size, double > & | operator-= (const TVector< Size, double > &vector) |
| TVector< Size, double > & | operator*= (double scalar) |
| TVector< Size, double > & | operator/= (double scalar) |
| const double & | operator[] (int i) const |
| double & | operator[] (int i) |
Additional Inherited Members | |
Static Public Member Functions inherited from imath::TVector< 3 > | |
| static int | GetElementsCount () |
| Get number of elements. | |
| static bool | SetElementsCount (int count) |
| Set number of elements. | |
| static const TVector< Size, double > & | GetZero () |
| Get vector with all coordinates set to 0. | |
Protected Attributes inherited from imath::TVector< 3 > | |
| Elements | m_elements |
Represents a position or mathematical vector in 3D space with double precision.
CVector3d is a specialized 3-dimensional vector class built on top of TVector<3>. It provides convenient accessors for X, Y, and Z coordinates and implements 3D-specific operations like cross product. This class is commonly used for representing points, directions, velocities, and normals in 3D space.
Definition at line 73 of file CVector3d.h.
| typedef imath::TVector<3> i3d::CVector3d::BaseClass |
Definition at line 76 of file CVector3d.h.
|
inline |
Default constructor creating an uninitialized vector.
For performance reasons, the X, Y, and Z coordinates are not initialized and contain undefined values. Initialize them explicitly before use.
Definition at line 263 of file CVector3d.h.
Referenced by operator*(), operator+(), operator-(), operator-(), and operator/().
|
inline |
Constructs a vector with specified X, Y, and Z coordinates.
| x | The X coordinate |
| y | The Y coordinate |
| z | The Z coordinate |
Definition at line 268 of file CVector3d.h.
References imath::TVector< 3 >::operator[]().
|
inline |
Copy constructor from a 3D TVector.
| vector | The source 3D vector to copy from |
Definition at line 276 of file CVector3d.h.
|
inline |
Constructs a 3D vector from a 2D vector, with optional Z coordinate.
This is useful for converting 2D coordinates to 3D space, such as when projecting a 2D screen position into 3D world space.
| vector | The 2D vector providing X and Y coordinates |
| z | The Z coordinate (default: 0.0) |
Definition at line 282 of file CVector3d.h.
References i2d::CVector2d::GetX(), i2d::CVector2d::GetY(), and imath::TVector< 3 >::operator[]().
| CVector3d i3d::CVector3d::GetCrossProduct | ( | const imath::TVector< 3 > & | vector | ) | const |
Calculates the cross product of this vector with another vector.
The cross product of two vectors produces a third vector that is perpendicular to both input vectors. The magnitude of the result is equal to the area of the parallelogram formed by the two vectors.
| vector | The other vector for the cross product calculation |
Referenced by i3d::Geometry::GetSignedAngleBetweenVectors(), i3d::Geometry::GetTriangleArea(), and i3d::Geometry::GetTriangleNormal().
| CVector3d i3d::CVector3d::GetNormalized | ( | double | length = 1.0 | ) | const |
Return normalized vector with the same direction and specified length.
Referenced by i3d::Geometry::GetAngleBetweenVectors(), i3d::CLine3d::GetDirection(), i3d::Geometry::GetSignedAngleBetweenVectors(), i3d::Geometry::GetTriangleNormal(), and i3d::CPlane3d::SetNormal().
|
inline |
Get XY part of this 3D vector.
Definition at line 332 of file CVector3d.h.
|
inline |
Returns a new vector translated by the given offset.
| vector | The translation offset vector |
Definition at line 326 of file CVector3d.h.
|
inline |
Gets the X coordinate of the vector.
Definition at line 290 of file CVector3d.h.
References imath::TVector< 3 >::operator[]().
Referenced by i3d::CBox3d::Contains(), i3d::CAffine3d::CreateScale(), GetPlaneCasted(), i3d::CBox3d::GetSurfaceArea(), i3d::CBox3d::GetVolume(), i3d::CBox3d::Include(), i3d::CBox3d::Intersects(), i3d::CBox3d::IsEmpty(), operator*(), operator+(), operator-(), operator-(), and operator/().
|
inline |
Gets the Y coordinate of the vector.
Definition at line 302 of file CVector3d.h.
References imath::TVector< 3 >::operator[]().
Referenced by i3d::CBox3d::Contains(), i3d::CAffine3d::CreateScale(), GetPlaneCasted(), i3d::CBox3d::GetSurfaceArea(), i3d::CBox3d::GetVolume(), i3d::CBox3d::Include(), i3d::CBox3d::Intersects(), i3d::CBox3d::IsEmpty(), operator*(), operator+(), operator-(), operator-(), and operator/().
|
inline |
Gets the Z coordinate of the vector.
Definition at line 314 of file CVector3d.h.
References imath::TVector< 3 >::operator[]().
Referenced by i3d::CBox3d::Contains(), i3d::CAffine3d::CreateScale(), i3d::CBox3d::GetSurfaceArea(), i3d::CBox3d::GetVolume(), i3d::CBox3d::Include(), i3d::CBox3d::Intersects(), i3d::CBox3d::IsEmpty(), operator*(), operator+(), operator-(), operator-(), and operator/().
|
inline |
Definition at line 359 of file CVector3d.h.
References CVector3d(), GetX(), GetY(), and GetZ().
|
inline |
Definition at line 394 of file CVector3d.h.
References imath::TVector< 3 >::operator*=().
|
inline |
Definition at line 345 of file CVector3d.h.
References CVector3d(), GetX(), GetY(), and GetZ().
|
inline |
Definition at line 377 of file CVector3d.h.
References imath::TVector< 3 >::operator+=().
|
inline |
Definition at line 338 of file CVector3d.h.
References CVector3d(), GetX(), GetY(), and GetZ().
|
inline |
Definition at line 352 of file CVector3d.h.
References CVector3d(), GetX(), GetY(), and GetZ().
|
inline |
Definition at line 386 of file CVector3d.h.
References imath::TVector< 3 >::operator-=().
|
inline |
Definition at line 366 of file CVector3d.h.
References CVector3d(), GetX(), GetY(), GetZ(), and I_BIG_EPSILON.
|
inline |
Definition at line 402 of file CVector3d.h.
References imath::TVector< 3 >::operator/=().
| bool i3d::CVector3d::Serialize | ( | iser::IArchive & | archive | ) |
Serialize this vector to specified archive.
|
inline |
Sets the X coordinate of the vector.
| value | The new X coordinate value |
Definition at line 296 of file CVector3d.h.
References imath::TVector< 3 >::operator[]().
Referenced by i3d::CMatrix3d::GetAxesLengths(), and i3d::CBox3d::Include().
|
inline |
Sets the Y coordinate of the vector.
| value | The new Y coordinate value |
Definition at line 308 of file CVector3d.h.
References imath::TVector< 3 >::operator[]().
Referenced by i3d::CMatrix3d::GetAxesLengths(), and i3d::CBox3d::Include().
|
inline |
Sets the Z coordinate of the vector.
| value | The new Z coordinate value |
Definition at line 320 of file CVector3d.h.
References imath::TVector< 3 >::operator[]().
Referenced by i3d::CMatrix3d::GetAxesLengths(), and i3d::CBox3d::Include().