Vector with x,y,z components. More...
#include <dvec3d.h>
Public Member Functions  
void  InitFromArray (double const *pXyz) 
Copies doubles from a 3 component array to the x,y, and z components of a DVec3d. More...  
void  Init (double ax, double ay, double az) 
Sets the x,y, and z components of a vector. More...  
void  Init (double ax, double ay) 
Sets the x, and y components of a vector. More...  
void  Init (DPoint3dCR point) 
Initialize a vector from a point (treating the point as a vector from its origin). More...  
double  Normalize (DVec3dCR vector) 
Normalizes (scales) a vector to length 1. More...  
bool  TryNormalize (DVec3dCR source, double &magnitude) 
initialize this vector to unit vector in the direction of source. More...  
ValidatedDVec3d  ValidatedNormalize () const 
return a (possibly invalid) unit vector in the direction of the calling instance. More...  
double  Normalize () 
Replaces a vector by a unit vector in the same direction, and returns the original length. More...  
double  ScaleToLength (DVec3dCR vector, double length) 
Scales a vector to specified length. More...  
double  ScaleToLength (double length) 
Scales a vector to a specified length, and returns the prior length. More...  
double  NormalizedDifference (DPoint3dCR target, DPoint3dCR origin) 
Computes a unit vector in the direction of the difference of the vectors or vectors (Second parameter vector is subtracted from the first parameter vector, exactly as in the subtract function.) More...  
void  DifferenceOf (DVec3dCR vector1, DVec3dCR vector2) 
Subtract coordinates of two vectors. More...  
void  DifferenceOf (DPoint3dCR target, DPoint3dCR base) 
Subtract coordinates of two points. More...  
void  Subtract (DVec3dCR vector2) 
Subtract two vectors, and return the result in place of the first. More...  
void  InitFromXYAngleAndMagnitude (double theta, double magnitude) 
Sets a vector from given angle and distance in xy plane. More...  
void  InitFromColumn (RotMatrixCR matrix, int col) 
Extracts a column of a matrix. More...  
void  InitFromRow (RotMatrixCR matrix, int row) 
Extracts a row of a matrix. More...  
void  Multiply (RotMatrixCR matrix, DVec3dCR vector) 
Returns the product of a matrix times a vector. More...  
void  MultiplyTranspose (RotMatrixCR matrix, DVec3dCR vector) 
Returns the product of a matrix transpose times a vector. More...  
void  Multiply (RotMatrixCR matrix, double x, double y, double z) 
Returns the product of a matrix times a vector, with the vector given as separate components. More...  
void  MultiplyTranspose (RotMatrixCR matrix, double x, double y, double z) 
Returns the product P = [x,y,z]*M where M is the input matrix and P is the product vector. More...  
void  XyzOf (DPoint4dCR hPoint) 
Sets the x,y, and z components of a DVec3d structure from the corresponding parts of a DPoint4d. More...  
void  CrossProduct (DVec3dCR vector1, DVec3dCR vector2) 
Returns the (vector) cross product of two vectors. More...  
void  CrossProduct (DVec3dCR vector1, DPoint3dCR point2) 
Returns the (vector) cross product of two vectors. More...  
void  CrossProduct (DPoint3dCR point1, DVec3dCR vector2) 
Returns the (vector) cross product of two vectors. More...  
void  CrossProductToPoints (DPoint3dCR origin, DPoint3dCR target1, DPoint3dCR target2) 
Sets the instance to the (vector) cross product of two vectors. More...  
double  NormalizedCrossProduct (DVec3dCR vector1, DVec3dCR vector2) 
Compute the normalized cross product of two vectors and return the length of the unnormalized cross product. More...  
double  SizedCrossProduct (DVec3dCR vector1, DVec3dCR vector2, double productLength) 
Computes the cross product of the two parameter vectors and scales it to a given length. More...  
double  GeometricMeanCrossProduct (DVec3dCR vector1, DVec3dCR vector2) 
Computes the cross product of two vectors and scales it to the geometric mean of the lengths of the two vectors. More...  
void  RotateXY (DVec3dCR vector, double theta) 
Rotate a vector around the z axis. More...  
void  RotateXY (double theta) 
Rotate a vector around the z axis. More...  
bool  UnitPerpendicularXY (DVec3dCR vector) 
Compute a unit vector perpendicular to the xy parts of given vector. More...  
void  Interpolate (DVec3dCR vector0, double fractionParameter, DVec3dCR vector1) 
Computes a vector whose position is given by a fractional argument and two vectors. More...  
void  SumOf (DVec3dCR vector1, DVec3dCR vector2) 
Compute the sum of two vectors. More...  
void  Add (DVec3dCR vector) 
Adds a vector to a pointer or vector, returns the result in place. More...  
void  SumOf (DVec3dCR vector1, double scale1, DVec3dCR vector2, double scale2) 
Compute the sum of two vectors with scale factors. More...  
void  SumOf (DVec3dCR vector1, double scale1, DVec3dCR vector2, double scale2, DVec3dCR vector3, double scale3) 
Compute the sum of three vectors with scale factors. More...  
void  SumOf (DVec3dCR origin, DVec3dCR vector, double scale) 
Adds an origin and a scaled vector. More...  
void  SumOf (DVec3dCR origin, DVec3dCR vector1, double scale1, DVec3dCR vector2, double scale2) 
Adds an origin and two scaled vectors. More...  
void  SumOf (DVec3dCR origin, DVec3dCR vector1, double scale1, DVec3dCR vector2, double scale2, DVec3dCR vector3, double scale3) 
Adds an origin and three scaled vectors. More...  
void  Scale (DVec3dCR vector, double scale) 
Multiplies a vector by a scale factor. More...  
void  Scale (double scale) 
Multiplies a vector (in place) by a scale factor. More...  
bool  SafeDivide (DVec3dCR vector, double denominator) 
Try to divide each component of a vector by a scalar. More...  
void  Negate (DVec3dCR vector) 
Computes a negated (opposite) vector. More...  
void  Negate () 
Negate a vector in place. More...  
void  WeightedDifferenceOf (DPoint4dCR hPoint1, DPoint4dCR hPoint2) 
Scale each (homogeneous) point by the other's weight and subtract, i.e. More...  
void  WeightedDifferenceCrossProduct (DPoint4dCR basePoint, DPoint4dCR target1, DPoint4dCR target2) 
Form the cross product of the weighted differences from base poitn to two targets. More...  
double  DotProduct (DVec3dCR vector2) const 
Returns the (scalar) dot product of two vectors. More...  
double  DotProductXY (DVec3dCR vector2) const 
Returns the (scalar) dot product of xy parts of two vectors. More...  
double  DotProduct (double ax, double ay, double az) const 
Computes the dot product of one vector given as a vector structure and another given as xyz components. More...  
double  DotProduct (DPoint3dCR point2) const 
Returns the (scalar) dot product of two vectors. More...  
double  DotProductRow (RotMatrixCR matrix, int index) const 
Returns the (scalar) dot product of this vector and a row of a matrix. More...  
double  DotProductColumn (RotMatrixCR matrix, int index) const 
Returns the (scalar) dot product of this vector and a column of a matrix. More...  
double  DotProductMatrixRow (TransformCR matrix, int index) const 
Returns the (scalar) dot product of this vector and a row of the matrix part of the transform. More...  
double  DotProductMatrixColumn (TransformCR matrix, int index) const 
Returns the (scalar) dot product of this vector and a column of the matrix part of the transform. More...  
double  TripleProduct (DVec3dCR vector2, DVec3dCR vector3) const 
Computes the triple product of three vectors. More...  
double  Magnitude () const 
Computes the magnitude of a vector. More...  
double  MagnitudeSquared () const 
Computes the squared magnitude of a vector. More...  
double  SafeOneOverMagnitudeSquared (double defaultValue) const 
Returns 1 over the squared magnitude, or caller supplied default if squared magnitude is too small. More...  
ValidatedDouble  ValidatedFractionOfProjection (DVec3dCR vectorToProject, double defaultValue=0.0) const 
Returns fraction at which other projects onto this, in ValidatedDouble which records if the division was safe. More...  
double  MagnitudeXY () const 
Computes the magnitude of the xy part of a vector. More...  
double  MagnitudeSquaredXY () const 
Computes the squared magnitude of the xy part of a vector. More...  
double  MaxAbs () const 
Finds the largest absolute value among the components of a vector. More...  
double  Distance (DVec3dCR vector2) const 
Computes the (cartesian) distance between two vectors. More...  
double  DistanceSquared (DVec3dCR vector2) const 
Computes the squared distance between two vectors. More...  
double  DistanceSquaredXY (DVec3dCR vector2) const 
Computes the squared distance between two vectors, using only the xy parts. More...  
double  DistanceXY (DVec3dCR vector2) const 
Computes the distance between two vectors, using only x and y components. More...  
double  CrossProductMagnitude (DVec3dCR other) const 
Compute the cross product with other and return is magnitude (but the cross product is not returned) More...  
double  CrossProductXY (DVec3dCR vector2) const 
Return the (scalar) cross product of the xy parts of two vectors. More...  
void  SetComponent (double a, int index) 
Set one of three components (x,y,z) of the vector. More...  
double  GetComponent (int index) const 
Gets a single component of a vector. More...  
void  GetComponents (double &xCoord, double &yCoord, double &zCoord) const 
Copies x,y,z components from a vector to individual variables. More...  
bool  GetTriad (DVec3dR xAxis, DVec3dR yAxis, DVec3dR zAxis) const 
Sets three vectors so that they are mutually perpendicular, the third (Z) vector is identical to the given axis vector, and all have the same length. More...  
bool  GetNormalizedTriad (DVec3dR xAxis, DVec3dR yAxis, DVec3dR zAxis) const 
Sets three vectors so that they are mutually perpendicular unit vectors with the third (Z) vector in the direction of the given axis vector. More...  
bool  ProjectToVector (DVec3dCR targetVector, double &fraction) const 
Find the fraction at which the instance projects to a vector. More...  
bool  ProjectToPlane (DVec3dCR vectorU, DVec3dCR vectorV, DPoint2dR uv) const 
Find the projection of the instance vector to a plane defined by two vectors. More...  
bool  GetPerpendicularParts (DVec3dCR hypotenuse, double &fraction, DVec3dR parallelPart, DVec3dR perpendicularPart) const 
Decompose hypotenuse into a vector parallel to the instance and a vector perpendicular to the instance. More...  
double  AngleTo (DVec3dCR vector2) const 
Returns the angle between two vectors. More...  
double  AngleToXY (DVec3dCR vector2) const 
Returns the angle from Vector1 to Vector2 using only xy parts. More...  
double  SmallerUnorientedAngleTo (DVec3dCR vector2) const 
Returns the angle between two vectors, choosing the smaller of the two possible angles when both the vectors and their negations are considered. More...  
double  SmallerUnorientedAngleToXY (DVec3dCR vector2) const 
Returns the angle between two vectors, considering both the vectors and their negations and choosing the smaller. More...  
double  AngleFromPerpendicular (DVec3dCR vector2) const 
Returns the angle that two vectors deviate from being perpendicular. More...  
double  SignedAngleTo (DVec3dCR vector2, DVec3dCR orientationVector) const 
Computes the signed angle from one vector to another, in the plane of the two vectors. More...  
double  PlanarAngleTo (DVec3dCR vector2, DVec3dCR planeNormal) const 
Computes the signed angle between the projection of two vectors onto a plane with given normal. More...  
bool  AngleAndAxisOfRotationFromVectorToVector (DVec3dCR target, DVec3dR axis, double &radians) const 
Compute an axis and angle to rotate from the instance vector to a target. More...  
bool  IsVectorInSmallerSector (DVec3dCR vector0, DVec3dCR vector1) const 
Test a vector is "between" vector0 and vector1. More...  
bool  IsVectorInCCWSector (DVec3dCR vector0, DVec3dCR vector1, DVec3dCR upVector) const 
Test if the test vector vector is "between" vector0 and vector1, with CCW direction resolved by an up vector. More...  
bool  IsVectorInCCWXYSector (DVec3dCR vector0, DVec3dCR vector1) const 
Test if the instance vector vector is "between" vector0 and vector1, with CCW direction using only xy parts. More...  
bool  IsParallelTo (DVec3dCR vector2) const 
Tests if two vectors are parallel (opposites are considered parallel!) More...  
bool  IsPositiveParallelTo (DVec3dCR vector2) const 
Tests if two vectors are parallel and have positive dot product (opposites are NOT considered parallel) More...  
bool  IsPerpendicularTo (DVec3dCR vector2) const 
Tests if two vectors are perpendicular. More...  
bool  IsEqual (DVec3dCR vector2) const 
Test for exact equality between all components of two vectors. More...  
bool  IsEqual (DVec3dCR vector2, double tolerance) const 
Test if the x, y, and z components of two vectors are equal within tolerance. More...  
bool  AlmostEqual (DVec3d const &dataB) const 
test if two points are equal. More...  
bool  IsZero () 
checks if the vector has all zeros More...  
Public Member Functions inherited from DPoint3d  
void  Swap (DPoint3dR other) 
Swap contents of instance, other. More...  
double  CrossProductToPointsXY (DPoint3dCR target1, DPoint3dCR target2) const 
Returns the (scalar) cross product of the xy parts of two vectors. More...  
double  DotProductToPoints (DPoint3dCR target1, DPoint3dCR target2) const 
Returns the (scalar) dot product of two vectors. More...  
double  DotProductToPointsXY (DPoint3dCR target1, DPoint3dCR target2) const 
Returns the (scalar) dot product of xy parts of two vectors. More...  
double  DotDifference (DPoint3dCR origin, DVec3dCR vector) const 
Returns the (scalar) dot product of a two vectors. More...  
double  TripleProductToPoints (DPoint3dCR target1, DPoint3dCR target2, DPoint3dCR target3) const 
Computes the triple product of vectors from a base point three target points. More...  
void  Zero () 
Sets all components of a point or vector to zero. More...  
void  One () 
Returns a point or vector with all components 1.0. More...  
void  InitFromArray (const double *pXyz) 
Copies doubles from a 3 component array to the x,y, and z components of a DPoint3d. More...  
void  Init (DPoint2dCR source) 
Copy from a 2d point setting z to zero. More...  
void  Init (double ax, double ay, double az) 
Sets the x,y, and z components of a point. More...  
void  Init (double ax, double ay) 
Sets the x, and y components of a point. More...  
void  XyzOf (DPoint4dCR hPoint) 
Sets the x,y, and z components of a DPoint3d structure from the corresponding parts of a DPoint4d. More...  
void  SetComponent (double a, int index) 
Set one of three components (x,y,z) of the point. More...  
double  GetComponent (int index) const 
Gets a single component of a point. More...  
void  GetComponents (double &xCoord, double &yCoord, double &zCoord) const 
Copies x,y,z components from a point to individual variables. More...  
void  Interpolate (DPoint3dCR point0, double fractionParameter, DPoint3dCR point1) 
Computes a point whose position is given by a fractional argument and two endpoints. More...  
bool  IsPointInSmallerSector (DPoint3dCR origin, DPoint3dCR target1, DPoint3dCR target2) const 
Form vectors from the origin to the test point and the two boundary vectors. More...  
bool  IsPointInCCWector (DPoint3dCR origin, DPoint3dCR target0, DPoint3dCR target1, DVec3dCR upVector) const 
Test if a point is within the counterclockwise sector defined by an origin and two boundary points, with an up vector to determine which direction is counter clockwise. More...  
double  Distance (DPoint3dCR point2) const 
Computes the (cartesian) distance between two points. More...  
double  DistanceSquared (DPoint3dCR point2) const 
Computes the squared distance between two points. More...  
double  DistanceSquaredXY (DPoint3dCR point2) const 
Computes the squared distance between two points, using only the xy parts. More...  
double  DistanceXY (DPoint3dCR point2) const 
Computes the distance between two points, using only x and y components. More...  
bool  DistanceXY (DPoint3dCR otherPoint, DMatrix4dCP matrix, double &distance) const 
Computes the distance between two points, using only x and y components, optionally applying a transform into view space. More...  
double  MaxAbs () const 
Finds the largest absolute value among the components of a point or vector. More...  
double  MinAbs () const 
Finds the smallest absolute value among the components of a point or vector. More...  
int  MaxAbsIndex () const 
return in the index of the MaxAbs () value. More...  
int  MinAbsIndex () const 
return in the index of the MinAbs () value More...  
DRange1d  ComponentRange () const 
bool  IsEqual (DPoint3dCR point2) const 
Test for exact equality between all components of two points or vectors. More...  
bool  IsEqual (DPoint3dCR point2, double tolerance) const 
Test if the x, y, and z components of two points or vectors are equal within tolerance. More...  
void  NpcCoordinatesOf (DPoint3dCR point, DRange3dCR cube) 
Computes the coordinates of point under the translation and scaling that puts 000 at cube>low and 111 at cube>high. More...  
bool  IsDisconnect () const 
void  InitDisconnect () 
Initialize a point with all coordinates as the disconnect value. More...  
void  Init (DVec3dCR vector) 
Initialize a point by copying x,y,z from a vector. More...  
void  Subtract (DPoint3dCR base, DVec3dCR vector) 
Subtract a vector from a point. More...  
void  Add (DVec3dCR vector) 
Adds a vector to a pointer or vector, returns the result in place. More...  
void  SumOf (DPoint3dCR origin, DVec3dCR vector, double scale) 
Adds an origin and a scaled vector. More...  
void  SumOf (DPoint3dCR origin, DVec3dCR point1, double scale1, DVec3dCR point2, double scale2) 
Adds an origin and two scaled vectors. More...  
void  SumOf (DPoint3dCR origin, DVec3dCR point1, double scale1, DVec3dCR point2, double scale2, DVec3dCR point3, double scale3) 
Adds an origin and three scaled vectors. More...  
void  CrossProduct (DPoint3dCR point1, DPoint3dCR point2) 
Returns the cross (vector) cross product of two vectors. More...  
void  CrossProductToPoints (DPoint3dCR origin, DPoint3dCR target1, DPoint3dCR target2) 
Returns the (vector) cross product of two vectors. More...  
double  CrossProductXY (DPoint3dCR point2) const 
Return the (scalar) cross product of the xy parts of two vectors. More...  
double  NormalizedCrossProduct (DPoint3dCR point1, DPoint3dCR point2) 
Compute the normalized cross product of two vectors and return the length of the unnormalized cross product. More...  
double  SizedCrossProduct (DPoint3dCR point1, DPoint3dCR point2, double productLength) 
Computes the cross product of the two parameter vectors and scales it to a given length. More...  
double  GeometricMeanCrossProduct (DPoint3dCR point1, DPoint3dCR point2) 
Computes the cross product of two vectors and scales it to the geometric mean of the lengths of the two vectors. More...  
double  DotProduct (DPoint3dCR point2) const 
Returns the (scalar) dot product of two vectors. More...  
double  DotProductXY (DPoint3dCR point2) const 
Returns the (scalar) dot product of xy parts of two vectors. More...  
double  DotProduct (double ax, double ay, double az) const 
Computes the dot product of one vector given as a point structure and another given as xyz components. More...  
double  NormalizedDifference (DPoint3dCR target, DPoint3dCR origin) 
Computes a unit vector in the direction of the difference of the points or vectors (Second parameter vector is subtracted from the first parameter vector, exactly as in the subtract function.) More...  
double  AngleTo (DPoint3dCR point2) const 
Returns the angle between two vectors. More...  
double  AngleXY () const 
Computes the (signed) angle from xy axis to the vector, using only xy parts. More...  
double  SmallerUnorientedAngleTo (DPoint3dCR point2) const 
Returns the angle between two vectors, choosing the smaller of the two possible angles when both the vectors and their negations are considered. More...  
bool  IsVectorInSmallerSector (DPoint3dCR point0, DPoint3dCR point1) const 
Test a vector is "between" point0 and point1. More...  
bool  IsVectorInCCWSector (DPoint3dCR point0, DPoint3dCR point1, DPoint3dCR upVector) const 
Test if the test vector vector is "between" point0 and point1, with CCW direction resolved by an up vector. More...  
double  AngleToXY (DPoint3dCR point2) const 
Returns the angle from Vector1 to Vector2 using only xy parts. More...  
double  SmallerUnorientedAngleToXY (DPoint3dCR point2) const 
Returns the angle between two vectors, considering both the vectors and their negations and choosing the smaller. More...  
void  RotateXY (DPoint3dCR vector, double theta) 
Rotate vector around the z axis, return as calling instance. More...  
void  RotateXY (double theta) 
Rotate the calling instance around the z axis. More...  
double  SignedAngleTo (DPoint3dCR point2, DPoint3dCR orientationVector) const 
Computes the signed from one vector to another, in the plane of the two vectors. More...  
double  PlanarAngleTo (DPoint3dCR point2, DPoint3dCR planeNormal) const 
Computes the signed angle between the projection of two vectors onto a plane with given normal. More...  
void  WeightedDifferenceOf (DPoint4dCR point1, DPoint4dCR point2) 
Scale each point by the other's weight and subtract, i.e. More...  
void  WeightedDifferenceCrossProduct (DPoint4dCR basePoint, DPoint4dCR target1, DPoint4dCR target2) 
Form the cross product of the weighted differences from point0 to point1 and point2. More...  
double  MagnitudeSquared () const 
Computes the squared magnitude of a vector. More...  
double  MagnitudeXY () const 
Computes the magnitude of the xy part of a vector. More...  
double  MagnitudeSquaredXY () const 
Computes the squared magnitude of the xy part of a vector. More...  
bool  UnitPerpendicularXY (DPoint3dCR vector) 
Compute a unit vector perpendicular to the xy parts of given vector. More...  
double  Magnitude () const 
Computes the magnitude of a vector. More...  
void  Scale (DPoint3dCR vector, double scale) 
Multiplies a vector by a scale factor. More...  
void  Scale (double scale) 
Multiplies a vector (in place) by a scale factor. More...  
void  Negate (DPoint3dCR vector) 
Computes a negated (opposite) vector. More...  
void  Negate () 
Negate a vector in place. More...  
double  Normalize (DPoint3dCR vector) 
Normalizes (scales) a vector to length 1. More...  
double  ScaleToLength (DPoint3dCR vector, double length) 
Scales a vector to specified length. More...  
double  ScaleToLength (double length) 
Scales a vector to a specified length, and returns the prior length. More...  
double  Normalize () 
Replaces a vector by a unit vector in the same direction, and returns the original length. More...  
bool  IsParallelTo (DPoint3dCR point2) const 
Tests if two vectors are parallel. More...  
bool  IsPerpendicularTo (DPoint3dCR point2) const 
Tests if two vectors are perpendicular. More...  
bool  SafeDivide (DPoint3dCR vector, double denominator) 
Try to divide each component of a vector by a scalar. More...  
double  TripleProduct (DPoint3dCR point2, DPoint3dCR point3) const 
Computes the triple product of three vectors. More...  
void  Subtract (DPoint3dCR point2) 
Subtract two points or vectors, and return the result in place of the first. More...  
void  DifferenceOf (DPoint3dCR point1, DPoint3dCR point2) 
Subtract coordinates of two vectors or points. More...  
void  SumOf (DPoint3dCR origin, DPoint3dCR vector, double scale) 
Adds an origin and a scaled vector. More...  
void  SumOf (DPoint3dCR origin, DPoint3dCR point1, double scale1, DPoint3dCR point2, double scale2) 
Adds an origin and two scaled vectors. More...  
void  SumOf (DPoint3dCR origin, DPoint3dCR point1, double scale1, DPoint3dCR point2, double scale2, DPoint3dCR point3, double scale3) 
Adds an origin and three scaled vectors. More...  
void  SumOf (DPoint3dCR point1, double a1, DPoint3dCR point2, double a2) 
Componentwise linear combination. More...  
void  SumOf (DPoint3dCR point1, double a1, DPoint3dCR point2, double a2, DPoint3dCR point3, double a3) 
Componentwise linear combination. More...  
void  Add (DPoint3dCR vector) 
Adds a vector to a pointer or vector, returns the result in place. More...  
void  SumOf (DPoint3dCR point1, DPoint3dCR point2) 
Compute the sum of two points or vectors. More...  
bool  AlmostEqual (DPoint3d const &dataB) const 
test if two points are equal. More...  
bool  AlmostEqualXY (DPoint3d const &dataB) const 
test if two points are equal. More...  
bool  AlmostEqual (DPoint3d const &dataB, double abstol) const 
test if two points are equal. More...  
bool  AlmostEqualXY (DPoint3d const &dataB, double abstol) const 
test if two points are equal. More...  
Static Public Member Functions  
static DVec3d  FromArray (const double *pXyz) 
Returns a DVec3d with 3 component array of double. More...  
static DVec3d  UnitX () 
unit X vector More...  
static DVec3d  UnitY () 
unit Y vector More...  
static DVec3d  UnitZ () 
unit Z vector More...  
static DVec3d  From (double ax, double ay, double az=0.0) 
Returns a DVec3d with given x,y, and z components of a vector. More...  
static DVec3d  From (DPoint3dCR point) 
Returns a DVec3d from a point (treating the point as a vector from its origin). More...  
static DVec3d  From (DVec2dCR vector) 
Returns a DVec3d from a 2d vector (with 0 z) More...  
static DVec3d  FromStartEnd (DPoint3dCR start, DPoint3dCR end) 
Returns the unnormalized (full length) DVec3d between start and end. More...  
static DVec3d  FromStartEnd (TransformCR start, DPoint3dCR target) 
Returns the unnormalized (full length) DVec3d from the frame origin to the target point. More...  
static DVec3d  FromStartEndNormalize (DPoint3dCR start, DPoint3dCR end) 
Returns a vector from start towards end, normalized if nonzero. More...  
static DVec3d  FromCCWPerpendicularXY (DVec3d source) 
return a vector same length as source but rotate 90 degrees CCW More...  
static DVec3d  FromRotate90Towards (DVec3dCR source, DVec3dCR target) 
return a vector same length as source but rotate 90 degrees towards target More...  
static DVec3d  FromRotate90Around (DVec3dCR source, DVec3dCR axis) 
return a vector same length as source but rotate 90 degrees around axis More...  
static DVec3d  FromXYAngleAndMagnitude (double theta, double magnitude) 
Returns a DVec3d from given angle and distance in xy plane. More...  
static DVec3d  FromTranslation (TransformCR source) 
return the translation xyz as a DVec3d (which you can pass as a DPoint3d where needed.) More...  
static DVec3d  FromMatrixColumn (TransformCR transform, int i) 
return a (cyclically indexed) column of the matrix part of a transform. More...  
static DVec3d  FromMatrixRow (TransformCR transform, int i) 
return a (cyclically indexed) row of the matrix part of a transform. More...  
static DVec3d  FromColumn (RotMatrixCR matrix, int i) 
return a (cyclically indexed) column of the matrix. More...  
static DVec3d  FromRow (RotMatrixCR matrix, int i) 
return a (cyclically indexed) row of the matrix. More...  
static DVec3d  FromStartEnd (DPoint4dCR start, DPoint4dCR end) 
Returns DVec3d pseudo difference start.w*end  end.w*start. More...  
static DVec3d  FromCrossProduct (DVec3dCR vector0, DVec3dCR vector1) 
return the cross product of vectors More...  
static DVec3d  FromCrossProductToPoints (DPoint3dCR origin, DPoint3dCR target1, DPoint3dCR target2) 
Returns the (vector) cross product of two vectors. More...  
static DVec3d  FromNormalizedCrossProductToPoints (DPoint3dCR origin, DPoint3dCR target1, DPoint3dCR target2) 
Returns the (normalized vector) cross product of two vectors. More...  
static DVec3d  FromNormalizedCrossProduct (DVec3dCR vector0, DVec3dCR vector1) 
return the normalized cross product of vectors More...  
static DVec3d  FromCrossProduct (double x0, double y0, double z0, double x1, double y1, double z1) 
return the cross product of vectors presented as explicit components More...  
static DVec3d  FromMatrixColumnCrossProduct (TransformCR transform, int i, int j) 
return the cross product of vectors found in columns of (the matrix part of) a transform. More...  
static DVec3d  FromColumnCrossProduct (RotMatrixCR matrix, int i, int j) 
return the cross product of vectors found in columns a matrix More...  
static ValidatedDVec3d  FromUnitPerpendicularXY (DVec3dCR vector) 
Compute a unit vector perpendicular to the xy parts of given vector. More...  
static DVec3d  FromInterpolate (DVec3dCR vector0, double fraction, DVec3dCR vector1) 
Returns an interpolated vector. More...  
static DVec3d  FromInterpolateBilinear (DVec3dCR vector00, DVec3dCR vector10, DVec3dCR vector01, DVec3dCR vector11, double u, double v) 
Returns a bilinear interpolation from corners (00)(10)(01)(11) More...  
static DVec3d  FromSumOf (DVec3dCR vector0, DVec3dCR vector1) 
Returns a sum of vectors. More...  
static DVec3d  FromSumOf (DVec3dCR vector0, double scale0, DVec3dCR vector1, double scale1) 
Returns a linear combination of vectors. More...  
static DVec3d  FromSumOf (DVec3dCR vector0, double scale0, DVec3dCR vector1, double scale1, DVec3dCR vector2, double scale2) 
Returns a linear combination of vectors. More...  
static DVec3d  FromSumOf (DVec3dCR vector0, DVec3dCR vector1, double scale1) 
Returns a linear combination of vectors. More...  
static DVec3d  FromSumOf (DVec3dCR vector0, DVec3dCR vector1, double scale1, DVec3dCR vector2, double scale2) 
Returns a linear combination of vectors. More...  
static DVec3d  FromSumOf (DVec3dCR vector0, DVec3dCR vector1, double scale1, DVec3dCR vector2, double scale2, DVec3dCR vector3, double scale3) 
Returns a linear combination of vectors. More...  
static DVec3d  FromScale (DVec3dCR vector, double scale) 
Returns a scalar multiple of a DVec3d. More...  
static DVec3d  FromWeightedDifferenceOf (DPoint4dCR hPoint1, DPoint3dCR point2) 
Promote point2 to homogeneous and form (point1 *point2.w  point2 * point1.w). More...  
Static Public Member Functions inherited from DPoint3d  
static DPoint3d  From (double x, double y, double z=0.0) 
Return a DPoint3d with given xyz. More...  
static DPoint3d  From (DPoint2dCR xy) 
Return a DPoint3d with given xy, z = 0;. More...  
static DPoint3d  FromZero () 
Return a DPoint3d with xyz = 0. More...  
static DPoint3d  FromOne () 
Return a DPoint3d with xyz = 1. More...  
static DPoint3d  FromArray (const double *pXyz) 
Simple initialization from 3 coordinates in array. More...  
static void  AddToArray (DPoint3dP points, int n, DPoint3dCR delta) 
Add translation to all points. More...  
static void  MultiplyArrayByScales (DPoint3dP pDest, DPoint3dCP pSource, double *pScales, int n) 
Multiply each point in an array by its corresponding scale factor. More...  
static void  DivideArrayByScales (DPoint3dP pDest, DPoint3dCP pSource, double *pScales, int n) 
Divide each point in an array by its corresponding scale factor. More...  
static DPoint3d  FromProduct (TransformCR transform, double x, double y, double z) 
return product of transform times point given as components. More...  
static DPoint3d  FromProduct (TransformCR transform, DPoint3dCR point) 
return product of transform times point More...  
static DPoint3d  FromInterpolate (DPoint3dCR pointA, double fraction, DPoint3dCR pointB) 
interpolate between points. More...  
static DPoint3d  FromInterpolateBilinear (DPoint3dCR point00, DPoint3dCR point10, DPoint3dCR point01, DPoint3dCR point11, double u, double v) 
Returns a bilinear interpolation from corners (00)(10)(01)(11) More...  
static DPoint3d  FromSumOf (DPoint3dCR origin, DPoint3dCR vector) 
Add a point and a vector. More...  
static DPoint3d  FromSumOf (DPoint3dCR origin, DPoint3dCR vector, double scaleFactor) 
Add scaled vector from origin. More...  
static DPoint3d  FromSumOf (DPoint3dCR origin, DPoint3dCR point0, double scaleFactor0, DPoint3dCR point1, double scaleFactor1) 
Add scaled vectors from an origin. More...  
static DPoint3d  FromSumOf (DPoint3dCR origin, DPoint3dCR point0, double scaleFactor0, DPoint3dCR point1, double scaleFactor1, DPoint3dCR point2, double scaleFactor2) 
Add scaled vectors from origin. More...  
static DPoint3d  FromScale (DPoint3d point, double scale) 
Returns a scalar multiple of a DPoint3d. More...  
static DPoint3d  FromSumOf (DPoint3dCR point0, double scale0, DPoint3dCR point1, double scale1) 
Returns a linear combination of points. More...  
static DPoint3d  FromSumOf (DPoint3dCR point0, double scale0, DPoint3dCR point1, double scale1, DPoint3dCR point2, double scale2) 
Returns a linear combination of points. More...  
static DPoint3d  FromProduct (DPoint3dCR point, RotMatrixCR matrix, double x, double y, double z) 
Return {point + matrix * (x,y,z)}. More...  
static DPoint3d  FromProduct (DPoint3dCR point, RotMatrixCR matrix, DVec3dCR vector) 
Return {point + matrix * vector}. More...  
static bool  AlmostEqual (bvector< DPoint3d > const &left, bvector< DPoint3d > const &right, double tolerance=0.0) 
apply AlmostEqual test to corresponding points More...  
static bool  AlmostEqualXY (bvector< DPoint3d > const &left, bvector< DPoint3d > const &right, double tolerance=0.0) 
apply AlmostEqualXY test to corresponding points More...  
Additional Inherited Members  
Public Attributes inherited from DPoint3d  
double  x 
x coordinate More...  
double  y 
y coordinate More...  
double  z 
z coordinate More...  
Vector with x,y,z components.
Method Invocation  Remarks  

W.crossProduct(U,V)  W = U cross V  
W.crossProductToPoints (A,B,C)  W = (BA) cross (CA)  
W.normalizedCrossProduct (U,V)  W = normalize (U cross V)  
W.sizedCrossProduct (U,V, a)  W = a * normalize (U cross V)  
W.geometricMeanCrossProduct (U,V)  W = sqrt (mag(U) * mag(V)) * normalize(U cross V)  
a = crossProductXY (U,V)  a = U cross V (xy only, scalar result)  
a = tripleProduct (U,V,W)va = U cross V dot W  
a = tripleProductToPoints (A,B,C,D)  a = (BA) cross (CA) dot (DA)  
a = dotProduct (U,V)  a = U dot V  
a = dotProductXY (U,V)  a = U dot V, using only x and y parts  
U.getTriad (&Vx ,&Vy, &Vz)  return Vz=U, Vx,Vy perpenidcular, same length  
U.getNormalizedTriad (&Vx, &Vy, &Vz)  return Vz=normalize(U), Vx,Vy perpenidcular, all unit  
U.normalizedDifference (A,B)  U = normalize (AB)  
a = U.angleTo (V)  Spatial angle from U to V. Range 0 to PI.  
a = U.angleToXY (V)  
a = U.smallerUnorientedAngleTo (V)  
a = U.smallerUnorientedAngleToXY (V)  
a = U.signedAngleTo (V, upVector)  
U.isVectorInSmallerSector(V,W)  Test if U appears in the smaller sector between V and W, when viewed with V cross W as up vector.  
U.isVectorInCCWSector (V,W, upVector))  Test if U appears in the sector from V counterclockwise towards W when viewed with upVector  
U.planarAngleTo (V,W)  Anlge after projection to plane with nomral W.  
U.rotateXY (V, theta)  rotate around z axis  
U.rotateXY (theta)  Inplace rotation around z  
U.unitPerpendicularXY (V)  
U.scale (V,a)  U = V * a  
U.scale (a)  U *= a  
U.negate ()  U *= 1  
U.negate(V)  U =  V  
U.normalize (V)  U = V / V.magnitude ()  
U.normalize ()  U /= U.magnitude ()  
U.scaleToLength (V,a)  U = V * a / V.magnitude ()  
U.isParallelTo(V)  
U.isPerpendicularTo(V)  
if (U.safeDivide) ... (V,a)  Divde by a, but return false if a is too close to zero  
U.zero()  Sets all components to 0  
U.one()  Sets all components to 1  
U.init (x,y,z)  
U.init (A)  copy from point  
U.setComponent (a, i)  Set individual components  
a = U.getComponent (i)  Get individual component  
U.getComponents (U, &a, &b, &c)  Get all components as separate doubles  
U.sumOf (V,W)  U = V + W  
U.add (V)  U += V  
U.subtract (V)  U = V  
U.sumOf (V, W, a)  U = V + a W  
U.interpolate (V, a, W)  U = (1a)V * a W  
W.sumOf (U, V1, a1, V2, a2)  W = U + a1 * V1 + a2 * V2 + a3 * V3  
W.sumOf (U, V1, a1, V2, a2, V2, a3)  W = U + a1 * V1 + a2 * V2 + a3 * V3  
W.differenceOf (U,V)  W = U  V  
W.differenceOf (A,B)  W = A  B  
a = U.distance (V)  W = (VU).magnitude ()  
a = U.distanceSquared(V)  
a = U.distanceXY (V)  
a = U.distanceSquaredXY (V)  
a = U.magnitudeSquared ()  
a = U.magnitudeSquaredXY ()  
a = U.magnitude ()  
a = U.magnitudeXY ()  
a = U.maxAbs()  
U.isEqual(V)  Bitwise equality  
U.isEqual (V, tol)  componentwise absolute difference  
U.multiply (M,V)  U = M * V<  
mutliplyArray (U[], M, V[], count)  
U.multiply (M, x, y, z)  U = M * <x,y,z>  
U.multiplyTranspose (M, V)  U = M^ * V  
U.multiplyTranspose (M, x, y, z)  U = M' * <x,y,z>  
Dvec3d::multiplyTransposeArray (U[], M, V[], count) 
void Add  (  DVec3dCR  vector  ) 
Adds a vector to a pointer or vector, returns the result in place.
[in]  vector  The vector to add. 
bool AlmostEqual  (  DVec3d const &  dataB  )  const 
test if two points are equal.
Uses library "small angle" as both absolute and relative tolerance. points are equal if squared distance between is less than (squared abstol) plus (squared relTol) * sum of cmponent squares
[in]  dataB  second DVec3d 
bool AngleAndAxisOfRotationFromVectorToVector  (  DVec3dCR  target, 
DVec3dR  axis,  
double &  radians  
)  const 
Compute an axis and angle to rotate from the instance vector to a target.
[out]  target  direction that the instance is to rotate towards. 
[out]  axis  returned axis of rotation 
[out]  radians  returned rotation angle 
double AngleFromPerpendicular  (  DVec3dCR  vector2  )  const 
Returns the angle that two vectors deviate from being perpendicular.
double AngleTo  (  DVec3dCR  vector2  )  const 
Returns the angle between two vectors.
This angle is between 0 and pi. Rotating the first vector by this angle around the cross product between the vectors aligns it with the second vector.
[in]  vector2  The second vector 
double AngleToXY  (  DVec3dCR  vector2  )  const 
Returns the angle from Vector1 to Vector2 using only xy parts.
This angle is between pi and +pi.
[in]  vector2  The second vector 
Returns the (vector) cross product of two vectors.
[in]  vector1  The first vector 
[in]  vector2  The second vector 
void CrossProduct  (  DVec3dCR  vector1, 
DPoint3dCR  point2  
) 
Returns the (vector) cross product of two vectors.
[in]  vector1  The first vector 
[in]  point2  The second vector, given as a point. The point's xyz are understood to be a vector from the origin. 
void CrossProduct  (  DPoint3dCR  point1, 
DVec3dCR  vector2  
) 
Returns the (vector) cross product of two vectors.
[in]  point1  The first vector, givenn as a point. The point's xyz are understood to be a vector from the origin. 
[in]  vector2  The second vector. 
double CrossProductMagnitude  (  DVec3dCR  other  )  const 
Compute the cross product with other and return is magnitude (but the cross product is not returned)
[in]  other  second vector of cross product 
void CrossProductToPoints  (  DPoint3dCR  origin, 
DPoint3dCR  target1,  
DPoint3dCR  target2  
) 
Sets the instance to the (vector) cross product of two vectors.
The vectors are computed from the Origin to Target1 and Target2.
[in]  origin  The base point for computing vectors. 
[in]  target1  The target point for the first vector. 
[in]  target2  The target point for the second vector. 
double CrossProductXY  (  DVec3dCR  vector2  )  const 
Return the (scalar) cross product of the xy parts of two vectors.
[in]  vector2  The second vector 
Subtract coordinates of two vectors.
(Compute Vector1  Vector2)
[in]  vector1  The first vector 
[in]  vector2  The second (subtracted) vector 
void DifferenceOf  (  DPoint3dCR  target, 
DPoint3dCR  base  
) 
Subtract coordinates of two points.
(Compute Point1  Point2)
[in]  target  The target point 
[in]  base  The base point 
double Distance  (  DVec3dCR  vector2  )  const 
Computes the (cartesian) distance between two vectors.
[in]  vector2  The second vector 
double DistanceSquared  (  DVec3dCR  vector2  )  const 
Computes the squared distance between two vectors.
[in]  vector2  The second vector. 
double DistanceSquaredXY  (  DVec3dCR  vector2  )  const 
Computes the squared distance between two vectors, using only the xy parts.
[in]  vector2  The second vector 
double DistanceXY  (  DVec3dCR  vector2  )  const 
Computes the distance between two vectors, using only x and y components.
[in]  vector2  The second vector 
double DotProduct  (  DVec3dCR  vector2  )  const 
Returns the (scalar) dot product of two vectors.
[in]  vector2  The second vector 
double DotProduct  (  double  ax, 
double  ay,  
double  az  
)  const 
Computes the dot product of one vector given as a vector structure and another given as xyz components.
[in]  ax  The x component of second vector. 
[in]  ay  The y component of second vector. 
[in]  az  The z component of second vector. 
double DotProduct  (  DPoint3dCR  point2  )  const 
Returns the (scalar) dot product of two vectors.
[in]  point2  The second vector, given as point. The point's xyz are understood to be a vector from the origin. 
double DotProductColumn  (  RotMatrixCR  matrix, 
int  index  
)  const 
Returns the (scalar) dot product of this vector and a column of a matrix.
[in]  matrix  
[in]  index  column index. 
double DotProductMatrixColumn  (  TransformCR  matrix, 
int  index  
)  const 
Returns the (scalar) dot product of this vector and a column of the matrix part of the transform.
[in]  matrix  
[in]  index  column index. 
double DotProductMatrixRow  (  TransformCR  matrix, 
int  index  
)  const 
Returns the (scalar) dot product of this vector and a row of the matrix part of the transform.
[in]  matrix  
[in]  index  row index. 
double DotProductRow  (  RotMatrixCR  matrix, 
int  index  
)  const 
Returns the (scalar) dot product of this vector and a row of a matrix.
[in]  matrix  
[in]  index  row index. 
double DotProductXY  (  DVec3dCR  vector2  )  const 
Returns the (scalar) dot product of xy parts of two vectors.
[in]  vector2  The second vector 

static 
Returns a DVec3d with given x,y, and z components of a vector.
[in]  ax  The x component. 
[in]  ay  The y component. 
[in]  az  The z component. 
Referenced by DVec3d::UnitX(), DVec3d::UnitY(), and DVec3d::UnitZ().

static 
Returns a DVec3d from a point (treating the point as a vector from its origin).
[in]  point  the point. 
Returns a DVec3d from a 2d vector (with 0 z)
[in]  vector  the 2d vector 

static 
Returns a DVec3d with 3 component array of double.
[in]  pXyz  x, y, z components 
return a vector same length as source but rotate 90 degrees CCW

static 
return a (cyclically indexed) column of the matrix.
[in]  matrix  source 
[in]  i  column index 

static 
return the cross product of vectors found in columns a matrix
[in]  matrix  source transform 
[in]  i  first column index 
[in]  j  second column index 
return the cross product of vectors
[in]  vector0  first vector 
[in]  vector1  second vector 

static 
return the cross product of vectors presented as explicit components
[in]  x0  vector0 x component 
[in]  y0  vector0 y component 
[in]  z0  vector0 z component 
[in]  x1  vector1 x component 
[in]  y1  vector1 y component 
[in]  z1  vector1 z component 

static 
Returns the (vector) cross product of two vectors.
The vectors are computed from the Origin to Target1 and Target2.
[in]  origin  The base point for computing vectors. 
[in]  target1  The target point for the first vector. 
[in]  target2  The target point for the second vector. 
Returns an interpolated vector.
[in]  vector0  vector at fraction 0 
[in]  fraction  fraction from interpolation. 
[in]  vector1  vector at fraction 1 

static 
Returns a bilinear interpolation from corners (00)(10)(01)(11)
[in]  vector00  vector at (0,0) 
[in]  vector10  vector at (1,0) 
[in]  vector01  vector at (0,1) 
[in]  vector11  vector at (1,1) 
[in]  u  interpolation fraction for edges (vector00,vector10) and (vector01,vector11) 
[in]  v  interpolation fraction for edges (vector00,vector10) and (vector10,vector11) 

static 
return a (cyclically indexed) column of the matrix part of a transform.
[in]  transform  source transform 
[in]  i  column index 

static 
return the cross product of vectors found in columns of (the matrix part of) a transform.
[in]  transform  source transform 
[in]  i  first column index 
[in]  j  second column index 

static 
return a (cyclically indexed) row of the matrix part of a transform.
[in]  transform  source transform 
[in]  i  row index 
return the normalized cross product of vectors
[in]  vector0  first vector 
[in]  vector1  second vector 

static 
Returns the (normalized vector) cross product of two vectors.
The vectors are computed from the Origin to Target1 and Target2. If the cross product is zero, a zero vector is returned.
[in]  origin  The base point for computing vectors. 
[in]  target1  The target point for the first vector. 
[in]  target2  The target point for the second vector. 
return a vector same length as source but rotate 90 degrees around axis
return a vector same length as source but rotate 90 degrees towards target

static 
return a (cyclically indexed) row of the matrix.
[in]  matrix  source 
[in]  i  row index 
Returns a scalar multiple of a DVec3d.
[in]  vector  input vector 
[in]  scale  scale factor 

static 
Returns the unnormalized (full length) DVec3d between start and end.
[in]  start  start point 
[in]  end  end point 

static 
Returns the unnormalized (full length) DVec3d from the frame origin to the target point.
[in]  start  start point 
[in]  target  end point 

static 
Returns DVec3d pseudo difference start.w*end  end.w*start.
[in]  start  start point 
[in]  end  end point 

static 
Returns a vector from start towards end, normalized if nonzero.
[in]  start  start point 
[in]  end  end point 
Returns a sum of vectors.
[in]  vector0  first vector 
[in]  vector1  second vector 
Returns a linear combination of vectors.
[in]  vector0  first vector 
[in]  scale0  first scale 
[in]  vector1  second vector 
[in]  scale1  second scale 

static 
Returns a linear combination of vectors.
[in]  vector0  first vector 
[in]  scale0  first scale 
[in]  vector1  second vector 
[in]  scale1  second scale 
[in]  vector2  third vector 
[in]  scale2  third scale 
Returns a linear combination of vectors.
[in]  vector0  first vector 
[in]  vector1  second vector 
[in]  scale1  second scale 

static 
Returns a linear combination of vectors.
[in]  vector0  first vector 
[in]  vector1  second vector 
[in]  scale1  second scale 
[in]  vector2  third vector 
[in]  scale2  third scale 

static 
Returns a linear combination of vectors.
[in]  vector0  first vector 
[in]  vector1  second vector 
[in]  scale1  scale for vector1 
[in]  vector2  third vector 
[in]  scale2  scale fro vector2 
[in]  vector3  fourth vector 
[in]  scale3  scale for vector3 

static 

static 
Compute a unit vector perpendicular to the xy parts of given vector.
[in]  vector  The source vector 

static 
Promote point2 to homogeneous and form (point1 *point2.w  point2 * point1.w).
The weight term vanishes. Copy the xyz parts back as a vector.
[in]  hPoint1  The first homogeneous point 
[in]  point2  The second point. 

static 
Computes the cross product of two vectors and scales it to the geometric mean of the lengths of the two vectors.
This is useful because it has the direction of the cross product (i.e. normal to the plane of the two vectors) and a size in between the two vectors.
[in]  vector1  The first vector 
[in]  vector2  The second vector 
double GetComponent  (  int  index  )  const 
Gets a single component of a vector.
If the index is out of range 0,1,2, it is interpreted cyclically.
[in]  index  Indicates which component is accessed. The values are 0=x, 1=y, 2=z. Other values are treated cyclically. 
void GetComponents  (  double &  xCoord, 
double &  yCoord,  
double &  zCoord  
)  const 
Copies x,y,z components from a vector to individual variables.
[out]  xCoord  x component 
[out]  yCoord  y component 
[out]  zCoord  z component 
Sets three vectors so that they are mutually perpendicular unit vectors with the third (Z) vector in the direction of the given axis vector.
If the given axis vector contains only zeros, a (0,0,1) vector is used instead.
[out]  xAxis  unit x direction vector 
[out]  yAxis  unit y direction vector 
[out]  zAxis  unit z direction vector 
bool GetPerpendicularParts  (  DVec3dCR  hypotenuse, 
double &  fraction,  
DVec3dR  parallelPart,  
DVec3dR  perpendicularPart  
)  const 
Decompose hypotenuse into a vector parallel to the instance and a vector perpendicular to the instance.
[in]  hypotenuse  vector to decompose 
[out]  fraction  position where hypotenuse projects onto the instance. 
[out]  parallelPart  vector parallel to the instance 
[out]  perpendicularPart  vector perpendicular to the instance 
Sets three vectors so that they are mutually perpendicular, the third (Z) vector is identical to the given axis vector, and all have the same length.
If the given axis vector contains only zeros, a (0,0,1) vector is used instead.
[out]  xAxis  x direction of the coordinate system 
[out]  yAxis  y direction of the coordinate system 
[out]  zAxis  z direction of the coordinate system 
void Init  (  double  ax, 
double  ay,  
double  az  
) 
Sets the x,y, and z components of a vector.
[in]  ax  The x component. 
[in]  ay  The y component. 
[in]  az  The z component. 
void Init  (  double  ax, 
double  ay  
) 
Sets the x, and y components of a vector.
Sets z to zero.
[in]  ax  The x component. 
[in]  ax  The x component. 
[in]  ay  The y component 
void Init  (  DPoint3dCR  point  ) 
Initialize a vector from a point (treating the point as a vector from its origin).
[in]  point  the point. 
void InitFromArray  (  double const *  pXyz  ) 
Copies doubles from a 3 component array to the x,y, and z components of a DVec3d.
[in]  pXyz  x, y, z components 
void InitFromColumn  (  RotMatrixCR  matrix, 
int  col  
) 
Extracts a column of a matrix.
[in]  matrix  The matrix. 
[in]  col  column index. Columns are numbered 0,1,2. Others indices are reduced cyclically. 
void InitFromRow  (  RotMatrixCR  matrix, 
int  row  
) 
Extracts a row of a matrix.
[in]  matrix  The matrix. 
[in]  row  row index. Rows are numbered 0,1,2. Others indices are reduced cyclically. 
void InitFromXYAngleAndMagnitude  (  double  theta, 
double  magnitude  
) 
Sets a vector from given angle and distance in xy plane.
Z part is set to zero.
[in]  theta  Angle from X axis to the vector, in the xy plane. 
[in]  magnitude  Vector magnitude 
Computes a vector whose position is given by a fractional argument and two vectors.
[in]  vector0  The vector corresponding to fractionParameter of 0. 
[in]  fractionParameter  The fractional parametric coordinate. 0.0 is the start of the segment, 1.0 is the end, 0.5 is middle 
[in]  vector1  The vector corresponding to fractionParameter of 1. 
bool IsEqual  (  DVec3dCR  vector2  )  const 
Test for exact equality between all components of two vectors.
[in]  vector2  The second vector 
bool IsEqual  (  DVec3dCR  vector2, 
double  tolerance  
)  const 
Test if the x, y, and z components of two vectors are equal within tolerance.
Tests are done independently using the absolute value of each component differences (i.e. not the magnitude or sum of squared differences)
[in]  vector2  The second vector. 
[in]  tolerance  The tolerance. 
bool IsParallelTo  (  DVec3dCR  vector2  )  const 
Tests if two vectors are parallel (opposites are considered parallel!)
[in]  vector2  The second vector 
bool IsPerpendicularTo  (  DVec3dCR  vector2  )  const 
Tests if two vectors are perpendicular.
[in]  vector2  The second vector 
bool IsPositiveParallelTo  (  DVec3dCR  vector2  )  const 
Tests if two vectors are parallel and have positive dot product (opposites are NOT considered parallel)
[in]  vector2  The second vector 
Test if the test vector vector is "between" vector0 and vector1, with CCW direction resolved by an up vector.
The cross product of vector0 and vector1 is considered the positive plane normal if its dot product with the up vector is positive.
[in]  vector0  The boundary vector. 
[in]  vector1  The boundary vector. 
[in]  upVector  The out of plane vector. 
Test if the instance vector vector is "between" vector0 and vector1, with CCW direction using only xy parts.
[in]  vector0  The boundary vector. 
[in]  vector1  The boundary vector. 
Test a vector is "between" vector0 and vector1.
If the vectors are coplanar and vector0 is neither parallel nor antiparallel to vector1, betweenness has the expected meaning: there are two angles between vector0 and vector1; one is less than 180; the test vector is tested to see if it is in the smaller angle. If the vectors are not coplanar, the test is based on the projection of the test vector into the plane of the other two vectors.
Zero testing is untoleranced, and is biased to all parallel conditions "false". That is, if any pair of the input vectors is parallel or antiparallel, the mathematical answer is false. Floating point tolerances will cause "nearby" cases to be unpredictable. It is assumed that if the caller considers the "parallel" cases important they will be checked explicitly.
[in]  vector0  The first boundary vector. 
[in]  vector1  The second boundary vector. 
bool IsZero  (  ) 
checks if the vector has all zeros
double Magnitude  (  )  const 
Computes the magnitude of a vector.
double MagnitudeSquared  (  )  const 
Computes the squared magnitude of a vector.
double MagnitudeSquaredXY  (  )  const 
Computes the squared magnitude of the xy part of a vector.
double MagnitudeXY  (  )  const 
Computes the magnitude of the xy part of a vector.
double MaxAbs  (  )  const 
Finds the largest absolute value among the components of a vector.
void Multiply  (  RotMatrixCR  matrix, 
DVec3dCR  vector  
) 
Returns the product of a matrix times a vector.
[in]  matrix  The matrix. 
[in]  vector  The known vector. 
void Multiply  (  RotMatrixCR  matrix, 
double  x,  
double  y,  
double  z  
) 
Returns the product of a matrix times a vector, with the vector given as separate components.
[in]  matrix  The matrix to apply 
[in]  x  The x component of input vector 
[in]  y  The y component of input vector 
[in]  z  The z component of input vector 
void MultiplyTranspose  (  RotMatrixCR  matrix, 
DVec3dCR  vector  
) 
Returns the product of a matrix transpose times a vector.
[in]  matrix  The the matrix. 
[in]  vector  The known vector. 
void MultiplyTranspose  (  RotMatrixCR  matrix, 
double  x,  
double  y,  
double  z  
) 
Returns the product P = [x,y,z]*M where M is the input matrix and P is the product vector.
[in]  matrix  The matrix to apply 
[in]  x  The x component 
[in]  y  The y component 
[in]  z  The z component 
void Negate  (  DVec3dCR  vector  ) 
Computes a negated (opposite) vector.
[in]  vector  The vector to be negated. 
void Negate  (  ) 
Negate a vector in place.
double Normalize  (  DVec3dCR  vector  ) 
Normalizes (scales) a vector to length 1.
[in]  vector  The vector to be normalized. 
double Normalize  (  ) 
Replaces a vector by a unit vector in the same direction, and returns the original length.
Compute the normalized cross product of two vectors and return the length of the unnormalized cross product.
[in]  vector1  The first vector 
[in]  vector2  The second vector 
double NormalizedDifference  (  DPoint3dCR  target, 
DPoint3dCR  origin  
) 
Computes a unit vector in the direction of the difference of the vectors or vectors (Second parameter vector is subtracted from the first parameter vector, exactly as in the subtract function.)
[in]  target  The target point. 
[in]  origin  The origin point. 
Computes the signed angle between the projection of two vectors onto a plane with given normal.
[in]  vector2  The second vector 
[in]  planeNormal  The plane normal vector 
Find the projection of the instance vector to a plane defined by two vectors.
[in]  vectorU  udirection vector of the plane. 
[in]  vectorV  vdirection vector of the plane. 
[out]  uv  fractional coordinates on vectors. 
bool ProjectToVector  (  DVec3dCR  targetVector, 
double &  fraction  
)  const 
Find the fraction at which the instance projects to a vector.
[in]  targetVector  target vector. 
[out]  fraction  projection fraction 
void RotateXY  (  DVec3dCR  vector, 
double  theta  
) 
Rotate a vector around the z axis.
[in]  vector  vector to rotate. 
[in]  theta  The rotation angle. 
void RotateXY  (  double  theta  ) 
Rotate a vector around the z axis.
[in]  theta  The rotation angle. 
bool SafeDivide  (  DVec3dCR  vector, 
double  denominator  
) 
Try to divide each component of a vector by a scalar.
If the denominator near zero compared to any numerator component, return the original vector.
[in]  vector  The initial vector. 
[in]  denominator  The divisor. 
double SafeOneOverMagnitudeSquared  (  double  defaultValue  )  const 
Returns 1 over the squared magnitude, or caller supplied default if squared magnitude is too small.
void Scale  (  DVec3dCR  vector, 
double  scale  
) 
Multiplies a vector by a scale factor.
[in]  vector  The vector to be scaled. 
[in]  scale  The scale factor. 
void Scale  (  double  scale  ) 
Multiplies a vector (in place) by a scale factor.
[in]  scale  The scale 
double ScaleToLength  (  DVec3dCR  vector, 
double  length  
) 
Scales a vector to specified length.
[in]  vector  The original vector. 
[in]  length  The requested length. 
double ScaleToLength  (  double  length  ) 
Scales a vector to a specified length, and returns the prior length.
[in]  length  The requested length 
void SetComponent  (  double  a, 
int  index  
) 
Set one of three components (x,y,z) of the vector.
[in]  a  The component value. 
[in]  index  Selects the the axis: 0=x, 1=y, 2=z, others cyclic. 
Computes the signed angle from one vector to another, in the plane of the two vectors.
Initial computation using only the two vectors yields two possible angles depending on which side of the plane of the vectors is viewed. To choose which side to view, go on the side whose normal has a positive dot product with the orientation vector. This angle can be between pi and +pi.
[in]  vector2  The second vector 
[in]  orientationVector  The vector used to determine orientation. 
Computes the cross product of the two parameter vectors and scales it to a given length.
The scaled vector is stored as the product vector, and the length of the original cross product vector is returned.
[in]  vector1  The first vector 
[in]  vector2  The second vector 
[in]  productLength  The Desired length 
double SmallerUnorientedAngleTo  (  DVec3dCR  vector2  )  const 
Returns the angle between two vectors, choosing the smaller of the two possible angles when both the vectors and their negations are considered.
This angle is between 0 and pi/2.
[in]  vector2  The second vector 
double SmallerUnorientedAngleToXY  (  DVec3dCR  vector2  )  const 
Returns the angle between two vectors, considering both the vectors and their negations and choosing the smaller.
This angle is between 0 and pi/2.
[in]  vector2  The second vector 
void Subtract  (  DVec3dCR  vector2  ) 
Subtract two vectors, and return the result in place of the first.
[in]  vector2  The vector to subtract. 
Compute the sum of two vectors.
[in]  vector1  The the first vector 
[in]  vector2  The second vector 
Compute the sum of two vectors with scale factors.
[in]  vector1  The the first vector 
[in]  scale1  first scale 
[in]  vector2  The second vector 
[in]  scale2  second scale 
void SumOf  (  DVec3dCR  vector1, 
double  scale1,  
DVec3dCR  vector2,  
double  scale2,  
DVec3dCR  vector3,  
double  scale3  
) 
Compute the sum of three vectors with scale factors.
[in]  vector1  The the first vector 
[in]  scale1  first scale 
[in]  vector2  The second vector 
[in]  scale2  second scale 
[in]  vector3  The third vector 
[in]  scale3  third scale 
Adds an origin and a scaled vector.
[in]  origin  Origin for the sum. 
[in]  vector  The vector to be added. 
[in]  scale  The scale factor. 
Adds an origin and two scaled vectors.
[in]  origin  The origin. 
[in]  vector1  The first direction vector 
[in]  scale1  The first scale factor 
[in]  vector2  The second direction vector 
[in]  scale2  The second scale factor 
void SumOf  (  DVec3dCR  origin, 
DVec3dCR  vector1,  
double  scale1,  
DVec3dCR  vector2,  
double  scale2,  
DVec3dCR  vector3,  
double  scale3  
) 
Adds an origin and three scaled vectors.
[in]  origin  The origin. 
[in]  vector1  The first direction vector 
[in]  scale1  The first scale factor 
[in]  vector2  The second direction vector 
[in]  scale2  The second scale factor 
[in]  vector3  The third direction vector 
[in]  scale3  The third scale factor 
Computes the triple product of three vectors.
The following are equivalent definitions of the triple product of three vectors V1, V2, and V3:
[in]  vector2  The second vector. 
[in]  vector3  The third vector. 
bool TryNormalize  (  DVec3dCR  source, 
double &  magnitude  
) 
initialize this vector to unit vector in the direction of source.
[in]  source  The vector to be normalized. 
[out]  magnitude  The orignal magnitude of the source vector; 
bool UnitPerpendicularXY  (  DVec3dCR  vector  ) 
Compute a unit vector perpendicular to the xy parts of given vector.
[in]  vector  The source vector 

static 
unit X vector
References DVec3d::From().

static 
unit Y vector
References DVec3d::From().

static 
unit Z vector
References DVec3d::From().
ValidatedDouble ValidatedFractionOfProjection  (  DVec3dCR  vectorToProject, 
double  defaultValue = 0.0 

)  const 
Returns fraction at which other projects onto this, in ValidatedDouble which records if the division was safe.
ValidatedDVec3d ValidatedNormalize  (  )  const 
return a (possibly invalid) unit vector in the direction of the calling instance.
void WeightedDifferenceCrossProduct  (  DPoint4dCR  basePoint, 
DPoint4dCR  target1,  
DPoint4dCR  target2  
) 
Form the cross product of the weighted differences from base poitn to two targets.
[in]  basePoint  The common base point (second point for differences) 
[in]  target1  The first target point. 
[in]  target2  The second target point. 
void WeightedDifferenceOf  (  DPoint4dCR  hPoint1, 
DPoint4dCR  hPoint2  
) 
Scale each (homogeneous) point by the other's weight and subtract, i.e.
form (point1 * point2.w  point2 * point1.w). The weight term vanishes. Copy the xyz parts back as a vector.
[in]  hPoint1  The first homogeneous point 
[in]  hPoint2  The second homogeneous point. 
void XyzOf  (  DPoint4dCR  hPoint  ) 