Public Member Functions | Static Public Member Functions | Public Attributes | List of all members

3d point coordinates. More...

#include <dpoint3d.h>

Inheritance diagram for DPoint3d:
DVec3d

Public Member Functions

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 counter-clockwise 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 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...
 

Public Attributes

double x
 x coordinate More...
 
double y
 y coordinate More...
 
double z
 z coordinate More...
 

Detailed Description

3d point coordinates.

Member Function Documentation

void Add ( DVec3dCR  vector)

Adds a vector to a pointer or vector, returns the result in place.

Parameters
[in]vectorThe vector to add.
void Add ( DPoint3dCR  vector)

Adds a vector to a pointer or vector, returns the result in place.

Parameters
[in]vectorThe vector to add.
static void AddToArray ( DPoint3dP  points,
int  n,
DPoint3dCR  delta 
)
static

Add translation to all points.

bool AlmostEqual ( DPoint3d 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

Parameters
[in]dataBsecond DPoint3d
Returns
true if within tolerance.
bool AlmostEqual ( DPoint3d const &  dataB,
double  abstol 
) 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

Parameters
[in]dataBsecond DPoint3d
[in]abstolabsolute tolerance. If 0, use defaults.
Returns
true if within tolerance.
static bool AlmostEqual ( bvector< DPoint3d > const &  left,
bvector< DPoint3d > const &  right,
double  tolerance = 0.0 
)
static

apply AlmostEqual test to corresponding points

Parameters
[in]leftfirst array.
[in]rightfirst vector.
[in]toleranceoptional tolerance. If 0, use defaults from AlmostEqual
bool AlmostEqualXY ( DPoint3d 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

Parameters
[in]dataBsecond DPoint3d
Returns
true if within tolerance.
bool AlmostEqualXY ( DPoint3d const &  dataB,
double  abstol 
) 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

Parameters
[in]dataBsecond DPoint3d
[in]abstolabsolute tolerance. If 0, use defaults.
Returns
true if within tolerance.
static bool AlmostEqualXY ( bvector< DPoint3d > const &  left,
bvector< DPoint3d > const &  right,
double  tolerance = 0.0 
)
static

apply AlmostEqualXY test to corresponding points

Parameters
[in]leftfirst array.
[in]rightfirst vector.
[in]toleranceoptional tolerance. If 0, use defaults from AlmostEqualXY
double AngleTo ( DPoint3dCR  point2) 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.

Parameters
[in]point2The second vector
Returns
The angle between the vectors.
double AngleToXY ( DPoint3dCR  point2) const

Returns the angle from Vector1 to Vector2 using only xy parts.

This angle is between -pi and +pi.

Parameters
[in]point2The second vector
Returns
The angle between vectors.
double AngleXY ( ) const

Computes the (signed) angle from xy axis to the vector, using only xy parts.

DRange1d ComponentRange ( ) const
Returns
min and max of componetns.
void CrossProduct ( DPoint3dCR  point1,
DPoint3dCR  point2 
)

Returns the cross (vector) cross product of two vectors.

Parameters
[in]point1The first vector
[in]point2The second vector
void CrossProductToPoints ( DPoint3dCR  origin,
DPoint3dCR  target1,
DPoint3dCR  target2 
)

Returns the (vector) cross product of two vectors.

The vectors are computed from the Origin to target1 and target2.

Parameters
[in]originThe base point for computing vectors.
[in]target1The target point for the first vector.
[in]target2The target point for the second vector.
double CrossProductToPointsXY ( DPoint3dCR  target1,
DPoint3dCR  target2 
) const

Returns the (scalar) cross product of the xy parts of two vectors.

The vectors are computed from the Origin to target1 and target2.

Parameters
[in]target1The target point for the first vector.
[in]target2The target point for the second vector.
double CrossProductXY ( DPoint3dCR  point2) const

Return the (scalar) cross product of the xy parts of two vectors.

Parameters
[in]point2The second vector
Returns
The 2d cross product.
void DifferenceOf ( DPoint3dCR  point1,
DPoint3dCR  point2 
)

Subtract coordinates of two vectors or points.

(Compute Point1 - Point2)

Parameters
[in]point1The first point
[in]point2The second (subtracted) point.
double Distance ( DPoint3dCR  point2) const

Computes the (cartesian) distance between two points.

Parameters
[in]point2The second point
Returns
The distance between points.
double DistanceSquared ( DPoint3dCR  point2) const

Computes the squared distance between two points.

Parameters
[in]point2The second point.
Returns
The squared distance between the points.
double DistanceSquaredXY ( DPoint3dCR  point2) const

Computes the squared distance between two points, using only the xy parts.

Parameters
[in]point2The second point
Returns
The squared distance between the XY projections of the two points. (i.e. any z difference is ignored)
double DistanceXY ( DPoint3dCR  point2) const

Computes the distance between two points, using only x and y components.

Parameters
[in]point2The second point
Returns
The distance between the XY projections of the two points. (i.e. any z difference is ignored)
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.

Parameters
[in]otherPointThe second point
[in]matrixoptional transform
[out]distancecomputed distance.
Returns
true if both points normalized properly after the transform.
static void DivideArrayByScales ( DPoint3dP  pDest,
DPoint3dCP  pSource,
double *  pScales,
int  n 
)
static

Divide each point in an array by its corresponding scale factor.

Leave any point with near zero weight unchanged.

Parameters
[out]pDestdestination array.
[in]pSourcesource array.
[in]pScalesscale factors
[in]nnumber of points.
double DotDifference ( DPoint3dCR  origin,
DVec3dCR  vector 
) const

Returns the (scalar) dot product of a two vectors.

One vector is computed internally as the difference of the TargetPoint and Origin. (TargetPoint-Origin) The other is given directly as a single argument.

Parameters
[in]originThe start (orign) point of the first vector of the cross product.
[in]vectorThe second
double DotProduct ( DPoint3dCR  point2) const

Returns the (scalar) dot product of two vectors.

Parameters
[in]point2The second vector
Returns
The dot product of the two vectors
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.

Parameters
[in]axThe x component of second vector.
[in]ayThe y component of second vector.
[in]azThe z component of second vector.
Returns
The dot product of the vector with a vector with the given components
double DotProductToPoints ( DPoint3dCR  target1,
DPoint3dCR  target2 
) const

Returns the (scalar) dot product of two vectors.

The vectors are computed from the Origin to target1 and target2.

Parameters
[in]target1The target point for the first vector.
[in]target2The target point for the second vector.
double DotProductToPointsXY ( DPoint3dCR  target1,
DPoint3dCR  target2 
) const

Returns the (scalar) dot product of xy parts of two vectors.

The vectors are computed from the BasePoint to target1 and target2.

Parameters
[in]target1The target point for the first vector.
[in]target2The target point for the second vector.
double DotProductXY ( DPoint3dCR  point2) const

Returns the (scalar) dot product of xy parts of two vectors.

Parameters
[in]point2The second vector
Returns
The dot product of the xy parts of the two vectors
static DPoint3d From ( double  x,
double  y,
double  z = 0.0 
)
static

Return a DPoint3d with given xyz.

static DPoint3d From ( DPoint2dCR  xy)
static

Return a DPoint3d with given xy, z = 0;.

static DPoint3d FromArray ( const double *  pXyz)
static

Simple initialization from 3 coordinates in array.

Parameters
[in]pXyzx, y, z components
static DPoint3d FromInterpolate ( DPoint3dCR  pointA,
double  fraction,
DPoint3dCR  pointB 
)
static

interpolate between points.

Parameters
[in]pointAstart point
[in]fractionfractional parameter
[in]pointBend point
static DPoint3d FromInterpolateBilinear ( DPoint3dCR  point00,
DPoint3dCR  point10,
DPoint3dCR  point01,
DPoint3dCR  point11,
double  u,
double  v 
)
static

Returns a bilinear interpolation from corners (00)(10)(01)(11)

Parameters
[in]point00point at (0,0)
[in]point10point at (1,0)
[in]point01point at (0,1)
[in]point11point at (1,1)
[in]uinterpolation fraction for edges (point00,point10) and (point01,point11)
[in]vinterpolation fraction for edges (point00,point10) and (point10,point11)
static DPoint3d FromOne ( )
static

Return a DPoint3d with xyz = 1.

static DPoint3d FromProduct ( TransformCR  transform,
double  x,
double  y,
double  z 
)
static

return product of transform times point given as components.

Parameters
[in]transformaffine transform.
[in]xx component
[in]yy component
[in]zz component
static DPoint3d FromProduct ( TransformCR  transform,
DPoint3dCR  point 
)
static

return product of transform times point

Parameters
[in]transformaffine transform.
[in]pointpoint to transform.
static DPoint3d FromProduct ( DPoint3dCR  point,
RotMatrixCR  matrix,
double  x,
double  y,
double  z 
)
static

Return {point + matrix * (x,y,z)}.

Parameters
[in]pointbase point
[in]matrix
[in]xx component
[in]yy component
[in]zz component
static DPoint3d FromProduct ( DPoint3dCR  point,
RotMatrixCR  matrix,
DVec3dCR  vector 
)
static

Return {point + matrix * vector}.

Parameters
[in]pointbase point
[in]matrix
[in]vectorvector part
static DPoint3d FromScale ( DPoint3d  point,
double  scale 
)
static

Returns a scalar multiple of a DPoint3d.

Parameters
[in]pointinput point
[in]scalescale factor
static DPoint3d FromSumOf ( DPoint3dCR  origin,
DPoint3dCR  vector 
)
static

Add a point and a vector.

Parameters
[in]originstart point
[in]vectorvector add
static DPoint3d FromSumOf ( DPoint3dCR  origin,
DPoint3dCR  vector,
double  scaleFactor 
)
static

Add scaled vector from origin.

Parameters
[in]originstart point
[in]vectorvector to scale.
[in]scaleFactormultiplier.
static DPoint3d FromSumOf ( DPoint3dCR  origin,
DPoint3dCR  point0,
double  scaleFactor0,
DPoint3dCR  point1,
double  scaleFactor1 
)
static

Add scaled vectors from an origin.

Parameters
[in]originstart point
[in]point0vector to scale.
[in]scaleFactor0multiplier.
[in]point1vector to scale.
[in]scaleFactor1multiplier.
static DPoint3d FromSumOf ( DPoint3dCR  origin,
DPoint3dCR  point0,
double  scaleFactor0,
DPoint3dCR  point1,
double  scaleFactor1,
DPoint3dCR  point2,
double  scaleFactor2 
)
static

Add scaled vectors from origin.

Parameters
[in]originstart point
[in]point0vector to scale.
[in]scaleFactor0multiplier.
[in]point1vector to scale.
[in]scaleFactor1multiplier.
[in]point2vector to scale.
[in]scaleFactor2multiplier.
static DPoint3d FromSumOf ( DPoint3dCR  point0,
double  scale0,
DPoint3dCR  point1,
double  scale1 
)
static

Returns a linear combination of points.

Parameters
[in]point0first point
[in]scale0first scale
[in]point1second point
[in]scale1second scale
static DPoint3d FromSumOf ( DPoint3dCR  point0,
double  scale0,
DPoint3dCR  point1,
double  scale1,
DPoint3dCR  point2,
double  scale2 
)
static

Returns a linear combination of points.

Parameters
[in]point0first point
[in]scale0first scale
[in]point1second point
[in]scale1second scale
[in]point2third point
[in]scale2third scale
static DPoint3d FromZero ( )
static

Return a DPoint3d with xyz = 0.

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.

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.

Parameters
[in]point1The first vector
[in]point2The second vector
Returns
The length of original vector.
double GetComponent ( int  index) const

Gets a single component of a point.

If the index is out of range 0,1,2, it is interpreted cyclically.

Parameters
[in]indexIndicates which component is accessed. The values are 0=x, 1=y, 2=z. Other values are treated cyclically.
Returns
The specified component of the point or vector.
void GetComponents ( double &  xCoord,
double &  yCoord,
double &  zCoord 
) const

Copies x,y,z components from a point to individual variables.

Parameters
[out]xCoordx component
[out]yCoordy component
[out]zCoordz component
void Init ( DPoint2dCR  source)

Copy from a 2d point setting z to zero.

Parameters
[in]sourcesource point
void Init ( double  ax,
double  ay,
double  az 
)

Sets the x,y, and z components of a point.

Parameters
[in]axThe x component.
[in]ayThe y component.
[in]azThe z component.
void Init ( double  ax,
double  ay 
)

Sets the x, and y components of a point.

Sets z to zero.

Parameters
[in]axThe x component.
[in]axThe x component.
[in]ayThe y component
void Init ( DVec3dCR  vector)

Initialize a point by copying x,y,z from a vector.

Parameters
[in]vectorThe vecotr
void InitDisconnect ( )

Initialize a point with all coordinates as the disconnect value.

void InitFromArray ( const double *  pXyz)

Copies doubles from a 3 component array to the x,y, and z components of a DPoint3d.

Parameters
[in]pXyzx, y, z components
void Interpolate ( DPoint3dCR  point0,
double  fractionParameter,
DPoint3dCR  point1 
)

Computes a point whose position is given by a fractional argument and two endpoints.

Parameters
[in]point0The point corresponding to fractionParameter of 0.
[in]fractionParameterThe fractional parametric coordinate. 0.0 is the start of the segment, 1.0 is the end, 0.5 is midpoint.
[in]point1The point corresponding to fractionParameter of 1.
bool IsDisconnect ( ) const
Returns
true if the point has coordinates which indicate it is a disconnect (separator) ponit.
bool IsEqual ( DPoint3dCR  point2) const

Test for exact equality between all components of two points or vectors.

Parameters
[in]point2The second point or vector
Returns
true if the points are identical.
bool IsEqual ( DPoint3dCR  point2,
double  tolerance 
) const

Test if the x, y, and z components of two points or 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)

Parameters
[in]point2The second point or vector.
[in]toleranceThe tolerance.
Returns
true if all components are within given tolerance of each other.
bool IsParallelTo ( DPoint3dCR  point2) const

Tests if two vectors are parallel.

Parameters
[in]point2The second vector
Returns
true if the vectors are parallel within default tolerance
bool IsPerpendicularTo ( DPoint3dCR  point2) const

Tests if two vectors are perpendicular.

Parameters
[in]point2The second vector
Returns
true if vectors are perpendicular within default tolerance
bool IsPointInCCWector ( DPoint3dCR  origin,
DPoint3dCR  target0,
DPoint3dCR  target1,
DVec3dCR  upVector 
) const

Test if a point is within the counter-clockwise sector defined by an origin and two boundary points, with an up vector to determine which direction is counter clockwise.

Parameters
[in]originThe point to test.
[in]target0The first target point.
[in]target1The second target point.
[in]upVectorvector towards eye to resolve direction.
Returns
true if the test point is within the angle.
bool IsPointInSmallerSector ( DPoint3dCR  origin,
DPoint3dCR  target1,
DPoint3dCR  target2 
) const

Form vectors from the origin to the test point and the two boundary vectors.

Test if the test vector is within the smaller angle between the other two vectors.

Parameters
[in]originThe point to test.
[in]target1The first target point.
[in]target2The second target point.
Returns
true if the test point is within the angle.
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.

The cross product of point0 and point1 is considered the positive plane normal if its dot product with the up vector is positive.

Parameters
[in]point0The boundary vector.
[in]point1The boundary vector.
[in]upVectorThe out of plane vector.
Returns
true if test vector is within the angle.
bool IsVectorInSmallerSector ( DPoint3dCR  point0,
DPoint3dCR  point1 
) const

Test a vector is "between" point0 and point1.

If the vectors are coplanar and point0 is neither parallel nor antiparallel to point1, betweenness has the expected meaning: there are two angles between point0 and point1; 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.

Parameters
[in]point0The first boundary vector.
[in]point1The second boundary vector.
Returns
true if the test vector is within the angle.
double Magnitude ( ) const

Computes the magnitude of a vector.

Returns
The length of the vector
double MagnitudeSquared ( ) const

Computes the squared magnitude of a vector.

Returns
The squared magnitude of the vector.
double MagnitudeSquaredXY ( ) const

Computes the squared magnitude of the xy part of a vector.

Returns
The squared magnitude of the xy parts of the given vector.
double MagnitudeXY ( ) const

Computes the magnitude of the xy part of a vector.

Returns
The magnitude of the xy parts of the given vector.
double MaxAbs ( ) const

Finds the largest absolute value among the components of a point or vector.

Returns
The largest absolute value among point coordinates.
int MaxAbsIndex ( ) const

return in the index of the MaxAbs () value.

double MinAbs ( ) const

Finds the smallest absolute value among the components of a point or vector.

Returns
The smallest absolute value among point coordinates.
int MinAbsIndex ( ) const

return in the index of the MinAbs () value

static void MultiplyArrayByScales ( DPoint3dP  pDest,
DPoint3dCP  pSource,
double *  pScales,
int  n 
)
static

Multiply each point in an array by its corresponding scale factor.

Parameters
[out]pDestdestination array.
[in]pSourcesource array.
[in]pScalesscale factors
[in]nnumber of points.
void Negate ( DPoint3dCR  vector)

Computes a negated (opposite) vector.

Parameters
[in]vectorThe vector to be negated.
void Negate ( )

Negate a vector in place.

double Normalize ( DPoint3dCR  vector)

Normalizes (scales) a vector to length 1.

If the input vector length is 0, the output vector is a zero vector and the returned length is 0.

Parameters
[in]vectorThe vector to be normalized.
Returns
The length prior to normalization
double Normalize ( )

Replaces a vector by a unit vector in the same direction, and returns the original length.

If the input vector length is 0, the output vector is a zero vector and the returned length is 0.

Returns
The length prior to normalization
double NormalizedCrossProduct ( DPoint3dCR  point1,
DPoint3dCR  point2 
)

Compute the normalized cross product of two vectors and return the length of the unnormalized cross product.

Parameters
[in]point1The first vector
[in]point2The second vector
Returns
The length of the original (prenormalization) cross product vector
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.)

Parameters
[in]targetThe target point.
[in]originThe origin point.
Returns
The length of original difference vector.
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.

Parameters
[in]pointPoint whose NPC coordinates are to be computed
[in]cubeCube whose corners map to 000 and 111
void One ( )

Returns a point or vector with all components 1.0.

double PlanarAngleTo ( DPoint3dCR  point2,
DPoint3dCR  planeNormal 
) const

Computes the signed angle between the projection of two vectors onto a plane with given normal.

Parameters
[in]point2The second vector
[in]planeNormalThe plane normal vector
Returns
The angle in plane
void RotateXY ( DPoint3dCR  vector,
double  theta 
)

Rotate vector around the z axis, return as calling instance.

Parameters
[in]vectorvector to rotate.
[in]thetaThe rotation angle.
void RotateXY ( double  theta)

Rotate the calling instance around the z axis.

Parameters
[in]thetaThe rotation angle.
bool SafeDivide ( DPoint3dCR  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.

Parameters
[in]vectorThe initial vector.
[in]denominatorThe divisor.
Returns
true if division is numerically safe.
void Scale ( DPoint3dCR  vector,
double  scale 
)

Multiplies a vector by a scale factor.

Parameters
[in]vectorThe vector to be scaled.
[in]scaleThe scale factor.
void Scale ( double  scale)

Multiplies a vector (in place) by a scale factor.

Parameters
[in]scaleThe scale
double ScaleToLength ( DPoint3dCR  vector,
double  length 
)

Scales a vector to specified length.

If the input vector length is 0, the output vector is a zero vector and the returned length is 0.

Parameters
[in]vectorThe original vector.
[in]lengthThe requested length.
Returns
The length prior to scaling.
double ScaleToLength ( double  length)

Scales a vector to a specified length, and returns the prior length.

If the input vector length is 0, the output vector is a zero vector and the returned length is 0.

Parameters
[in]lengthThe requested length
Returns
The length prior to scaling.
void SetComponent ( double  a,
int  index 
)

Set one of three components (x,y,z) of the point.

Parameters
[in]aThe component value.
[in]indexSelects the the axis: 0=x, 1=y, 2=z, others cyclic.
double SignedAngleTo ( DPoint3dCR  point2,
DPoint3dCR  orientationVector 
) const

Computes the signed 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.

Parameters
[in]point2The second vector
[in]orientationVectorThe vector used to determine orientation.
Returns
The signed angle
double SizedCrossProduct ( DPoint3dCR  point1,
DPoint3dCR  point2,
double  productLength 
)

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.

Parameters
[in]point1The first vector
[in]point2The second vector
[in]productLengthThe Desired length
Returns
The length of original vector.
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.

This angle is between 0 and pi/2.

Parameters
[in]point2The second vector
Returns
The angle between the vectors.
double SmallerUnorientedAngleToXY ( DPoint3dCR  point2) 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.

Parameters
[in]point2The second vector
Returns
The angle between vectors.
void Subtract ( DPoint3dCR  base,
DVec3dCR  vector 
)

Subtract a vector from a point.

Parameters
[in]baseThe the first point or vector
[in]vectorThe second point or vector
void Subtract ( DPoint3dCR  point2)

Subtract two points or vectors, and return the result in place of the first.

Parameters
[in]point2The vector to subtract.
void SumOf ( DPoint3dCR  origin,
DVec3dCR  vector,
double  scale 
)

Adds an origin and a scaled vector.

Parameters
[in]originOrigin for the sum.
[in]vectorThe vector to be added.
[in]scaleThe scale factor.
void SumOf ( DPoint3dCR  origin,
DVec3dCR  point1,
double  scale1,
DVec3dCR  point2,
double  scale2 
)

Adds an origin and two scaled vectors.

Parameters
[in]originThe origin.
[in]point1The first direction vector
[in]scale1The first scale factor
[in]point2The second direction vector
[in]scale2The second scale factor
void SumOf ( DPoint3dCR  origin,
DVec3dCR  point1,
double  scale1,
DVec3dCR  point2,
double  scale2,
DVec3dCR  point3,
double  scale3 
)

Adds an origin and three scaled vectors.

Parameters
[in]originThe origin.
[in]point1The first direction vector
[in]scale1The first scale factor
[in]point2The second direction vector
[in]scale2The second scale factor
[in]point3The third direction vector
[in]scale3The third scale factor
void SumOf ( DPoint3dCR  origin,
DPoint3dCR  vector,
double  scale 
)

Adds an origin and a scaled vector.

Parameters
[in]originOrigin for the sum.
[in]vectorThe vector to be added.
[in]scaleThe scale factor.
void SumOf ( DPoint3dCR  origin,
DPoint3dCR  point1,
double  scale1,
DPoint3dCR  point2,
double  scale2 
)

Adds an origin and two scaled vectors.

Parameters
[in]originThe origin.
[in]point1The first direction vector
[in]scale1The first scale factor
[in]point2The second direction vector
[in]scale2The second scale factor
void SumOf ( DPoint3dCR  origin,
DPoint3dCR  point1,
double  scale1,
DPoint3dCR  point2,
double  scale2,
DPoint3dCR  point3,
double  scale3 
)

Adds an origin and three scaled vectors.

Parameters
[in]originThe origin.
[in]point1The first direction vector
[in]scale1The first scale factor
[in]point2The second direction vector
[in]scale2The second scale factor
[in]point3The third direction vector
[in]scale3The third scale factor
void SumOf ( DPoint3dCR  point1,
double  a1,
DPoint3dCR  point2,
double  a2 
)

Componentwise linear combination.

Remarks
Becasue point is base class for vector, this may be used for linear combinations of vectors.
Parameters
[in]point1first point
[in]a1scale for first point.
[in]point2second point
[in]a2scale for second point.
void SumOf ( DPoint3dCR  point1,
double  a1,
DPoint3dCR  point2,
double  a2,
DPoint3dCR  point3,
double  a3 
)

Componentwise linear combination.

Remarks
Becasue point is base class for vector, this may be used for linear combinations of vectors.
Parameters
[in]point1first point
[in]a1scale for first point.
[in]point2second point
[in]a2scale for second point.
[in]point3third point
[in]a3scale for third point.
void SumOf ( DPoint3dCR  point1,
DPoint3dCR  point2 
)

Compute the sum of two points or vectors.

Parameters
[in]point1The the first point or vector
[in]point2The second point or vector
void Swap ( DPoint3dR  other)

Swap contents of instance, other.

Parameters
[in,out]othersecond point.
double TripleProduct ( DPoint3dCR  point2,
DPoint3dCR  point3 
) const

Computes the triple product of three vectors.

The following are equivalent definitions of the triple product of three vectors V1, V2, and V3:

  • (V1 cross V2) dot V3
  • V1 dot (V2 cross V3)
  • The determinant of the 3x3 matrix with the three vectors as its columns.
  • The determinant of the 3x3 matrix with the three vectors as its rows.
  • The (signed)volume of the parallelepiped whose 4 vertices are at the origin and at the ends of the 3 vectors placed at the origin.
Parameters
[in]point2The second vector.
[in]point3The third vector.
Returns
The triple product
double TripleProductToPoints ( DPoint3dCR  target1,
DPoint3dCR  target2,
DPoint3dCR  target3 
) const

Computes the triple product of vectors from a base point three target points.

Parameters
[in]target1The target point for the first vector.
[in]target2The target point for the second vector.
[in]target3The target point for the third vector.
Returns
The triple product
bool UnitPerpendicularXY ( DPoint3dCR  vector)

Compute a unit vector perpendicular to the xy parts of given vector.

Parameters
[in]vectorThe source vector
Returns
true if the input vector has nonzero length
void WeightedDifferenceCrossProduct ( DPoint4dCR  basePoint,
DPoint4dCR  target1,
DPoint4dCR  target2 
)

Form the cross product of the weighted differences from point0 to point1 and point2.

Parameters
[in]basePointThe common base point (second point for differences)
[in]target1The first target point.
[in]target2The second target point.
void WeightedDifferenceOf ( DPoint4dCR  point1,
DPoint4dCR  point2 
)

Scale each 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.

Parameters
[in]point1The first point
[in]point2The second pont.
void XyzOf ( DPoint4dCR  hPoint)

Sets the x,y, and z components of a DPoint3d structure from the corresponding parts of a DPoint4d.

Weight part of DPoint4d is not used.

Parameters
[in]hPointThe homogeneous point
void Zero ( )

Sets all components of a point or vector to zero.

Member Data Documentation

double x

x coordinate

double y

y coordinate

double z

z coordinate


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

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.