Go to the documentation of this file.
30 # define F_PI 3.1415926f
34 # define D_PI 3.141592653589793
38 # define FLOAT_MAX 3.402823466E+38F
42 # define FLOAT_MIN 1.175494351E-38F
46 # define DOUBLE_MAX 1.7976931348623157E+308
50 # define DOUBLE_MIN 2.2250738585072014E-308
75 template <
class _Precision>
91 explicit Vector3 (_Precision fx = 0.0, _Precision fy = 0.0, _Precision fz = 0.0);
142 void Scale (_Precision fX, _Precision fY, _Precision fZ);
146 void Move (_Precision fX, _Precision fY, _Precision fZ);
152 void Set (_Precision fX, _Precision fY, _Precision fZ);
156 _Precision
Length (
void)
const;
159 _Precision
Sqr (
void)
const;
217 template <
class _Precision>
220 _Precision x=v1.
x-v2.
x, y=v1.
y-v2.
y, z=v1.
z-v2.
z;
221 return static_cast<_Precision
>(sqrt((x * x) + (y * y) + (z * z)));
225 template <
class _Precision>
228 _Precision x=v1.
x-v2.
x, y=v1.
y-v2.
y, z=v1.
z-v2.
z;
229 return x * x + y * y + z * z;
233 template <
class _Precision>
239 template <
class _Pr1,
class _Pr2>
242 return Vector3<_Pr1>(
static_cast<_Pr1
>(v.
x),
static_cast<_Pr1
>(v.
y),
static_cast<_Pr1
>(v.
z));
void ProjectToPlane(const Vector3 &rclBase, const Vector3 &rclNorm, Vector3 &rclProj) const
static float_type pi()
Definition: Vector3D.h:61
_Precision DistanceToPlane(const Vector3 &rclBase, const Vector3 &rclNorm) const
_Precision Dot(const Vector3< _Precision > &rcVct) const
Scalar product.
#define F_PI
Definition: Vector3D.h:30
_Precision y
Definition: Vector3D.h:86
static float_type maximum()
Definition: Vector3D.h:71
Vector3 operator-(void) const
Negative vector.
_Precision z
Definition: Vector3D.h:87
Vector3(const Vector3< _Precision > &rcVct)
Construction.
Vector3 & operator+=(const Vector3< _Precision > &rcVct)
Vector summation.
_Precision DistanceP2(const Vector3< _Precision > &v1, const Vector3< _Precision > &v2)
Returns the squared distance between two points.
Definition: Vector3D.h:226
float_traits< num_type > traits_type
Definition: Vector3D.h:80
static num_type epsilon()
Definition: Vector3D.h:81
Vector3 operator&(const Vector3< _Precision > &rcVct) const
void Scale(_Precision fX, _Precision fY, _Precision fZ)
Vector3 & operator/=(_Precision fDiv)
void RotateX(_Precision f)
Vector3 & ProjectToPlane(const Vector3 &rclBase, const Vector3 &rclNorm)
Projects this point onto the plane given by the base rclBase and the normal rclNorm.
static float_type epsilon()
Definition: Vector3D.h:70
void TransformToCoordinateSystem(const Vector3 &rclBase, const Vector3 &rclDirX, const Vector3 &rclDirY)
_Precision num_type
Definition: Vector3D.h:79
_Precision x
Definition: Vector3D.h:85
Vector3< _Pr1 > toVector(const Vector3< _Pr2 > &v)
Definition: Vector3D.h:240
Vector3 & operator*=(_Precision fScale)
static float_type pi()
Definition: Vector3D.h:69
bool IsEqual(const Vector3 &rclPnt, _Precision tol) const
IsEqual.
_Precision GetAngle(const Vector3 &rcVect) const
Get angle between both vectors. The returned value lies in the interval [0,pi].
_Precision DistanceToLine(const Vector3 &rclBase, const Vector3 &rclDirect) const
Computes the distance from this point to the line given by rclBase and rclDirect.
static float_type epsilon()
Definition: Vector3D.h:62
void ScaleZ(_Precision f)
Definition: Vector3D.h:56
Definition: Vector3D.h:77
bool IsOnLineSegment(const Vector3< _Precision > &startVct, const Vector3< _Precision > &endVct) const
Check if Vector is on a line segment.
_Precision Sqr(void) const
Squared length of the vector.
Vector3< double > Vector3d
Definition: Vector3D.h:246
Vector3 Cross(const Vector3< _Precision > &rcVct) const
Cross product.
Vector3(_Precision fx=0.0, _Precision fy=0.0, _Precision fz=0.0)
Construction.
Vector3 Perpendicular(const Vector3 &rclBase, const Vector3 &rclDir) const
Vector3 operator/(_Precision fDiv) const
Vector3 & Normalize(void)
Set length to 1.
Vector3 & operator=(const Vector3< _Precision > &rcVct)
Assignment.
DualNumber operator*(DualNumber a, DualNumber b)
Definition: DualNumber.h:91
Vector3 operator*(_Precision fScale) const
Vector scaling.
Vector3 operator%(const Vector3< _Precision > &rcVct) const
Cross product.
_Precision & operator[](unsigned short usIndex)
Returns a reference to a coordinate. usIndex must be in the range [0,2].
bool operator==(const Vector3< _Precision > &rcVct) const
Comparing for equality.
Vector3 DistanceToLineSegment(const Vector3 &rclP1, const Vector3 &rclP2) const
void RotateZ(_Precision f)
Vector3 operator+(const Vector3< _Precision > &rcVct) const
Vector addition.
void Set(_Precision fX, _Precision fY, _Precision fZ)
Vector3 & ProjectToLine(const Vector3 &rclPoint, const Vector3 &rclLine)
Projects this point onto the line given by the base rclPoint and the direction rclLine.
Vector3 & operator-=(const Vector3< _Precision > &rcVct)
Vector subtraction.
void Move(_Precision fX, _Precision fY, _Precision fZ)
void ScaleX(_Precision f)
bool operator!=(const Vector3< _Precision > &rcVct) const
Comparing for inequality.
static float_type maximum()
Definition: Vector3D.h:63
_Precision Distance(const Vector3< _Precision > &v1, const Vector3< _Precision > &v2)
Returns the distance between two points.
Definition: Vector3D.h:218
_Precision Length(void) const
Length of the vector.
void ScaleY(_Precision f)
Vector3< float > Vector3f
Definition: Vector3D.h:245
float float_type
Definition: Vector3D.h:60
double float_type
Definition: Vector3D.h:68
Definition: AbstractXMLReader.h:5
void RotateY(_Precision f)
#define D_PI
Definition: Vector3D.h:34