3x4 matrix for defining coordinate frames and affine transformations. More...
#include <transform.h>
Public Member Functions | |
void | InitIdentity () |
returns an identity transformation, i.e. More... | |
void | InitFrom (RotMatrixCR matrix) |
Returns a transformation with the given matrix part and a zero translation part. More... | |
void | InitFrom (RotMatrixCR matrix, DPoint3dCR translation) |
Returns a transformation with the given matrix and translation parts. More... | |
void | InitFrom (DPoint3dCR translation) |
Returns a transformation with identity matrix part and given translation part. More... | |
void | InitFromMatrixAndFixedPoint (RotMatrixCR matrix, DPoint3dCR origin) |
Returns a transformation with given matrix part, and translation part computed from the matrix and a given fixed point. More... | |
void | InitFrom (double x, double y, double z) |
Returns a transformation with identity matrix part and translation part given as x, y, and z components. More... | |
void | InitFromRowValues (double x00, double x01, double x02, double tx, double x10, double x11, double x12, double ty, double x20, double x21, double x22, double tz) |
Copies the double values directly into the rows of this instance. More... | |
void | InitFromOriginAndVectors (DPoint3dCR origin, DVec3dCR xVector, DVec3dCR yVector, DVec3dCR zVector) |
Returns a transformation with origin at origin, x-axis xVector, y-axis yVector, and z-axis zVector. More... | |
bool | InitFromOriginXVectorYVectorSquareAndNormalize (DPoint3dCR origin, DVec3dCR xVector, DVec3dCR yVector) |
Returns a transformation with origin, x axis direction, and xy plane All axes are normalized and perpendicular. More... | |
void | InitFrom4Points (DPoint3dCR origin, DPoint3dCR xPoint, DPoint3dCR yPoint, DPoint3dCR zPoint) |
Returns a transformation with origin at origin, x-axis from origin to xPoint, y-axis from origin to yPoint, and z-axis from origin to zPoint. More... | |
void | InitFromPlaneOf3Points (DPoint3dCR origin, DPoint3dCR xPoint, DPoint3dCR yPoint) |
Returns a transformation with origin at origin, x-axis from origin to xPoint, y-axis from origin to yPoint, and z-axis equal to the cross product of x and y axes. More... | |
void | InitFromPlaneNormalToLine (DPoint3dCR origin, DPoint3dCR xPoint, int axisId, bool normalize) |
Returns a (possibly skewed) transformation with origin origin, the axis axisId towards xPoint, and other axes perpendicular. More... | |
bool | InitFrom (DMap4dCR hMap, int inverse) |
Initializes a Transform from the affine part of one of the matrices in an DMap4d. More... | |
void | Copy (TransformCR source) |
Returns a copy of a transformation. More... | |
void | InitFromOriginAndLengths (DPoint2dCR origin, double xAxisLength, double yAxisLength) |
Returns a transformation in the xy-plane with origin origin and x,y-axes of given lengths. More... | |
void | InitFromOriginAngleAndLengths (DPoint2dCR origin, double xAxisAngleRadians, double xAxisLength, double yAxisLength) |
Returns a transformation in the xy-plane with origin origin and x,y-axes of the given lengths rotated counter-clockwise from standard position by the given angle. More... | |
void | InitFromOriginAndVectors (DPoint2dCR origin, DVec2dR xVector, DVec2dR yVector) |
Sets this instance to a transformation in the xy-plane with origin at origin, x-axis xVector and y-axis yVector. More... | |
void | InitFrom3Points (DPoint2dCR origin, DPoint2dCR xPoint, DPoint2dCR yPoint) |
Sets this instance to a transformation in the xy-plane with origin at origin, x-axis from origin to xPoint and y-axis from origin to yPoint. More... | |
bool | InitNormalizedFrameFromOriginXPointYPoint (DPoint3dCR origin, DPoint3dCR xPoint, DPoint3dCR yPoint) |
Attempt to set up a coordinate frame origin at origin, x-axis from origin to xPoint, y-axis in plane with yPoint, All axes are normalized. More... | |
bool | InitFrom (DMatrix4dCR matrix) |
Initialize from first three rows of DMatrix4d, divided by weight entry. More... | |
void | InitFrom2Points (DPoint2dCR origin, DPoint2dCR xPoint, int axisId, bool normalize) |
Returns a transformation in the xy-plane with origin origin, axis axisId towards xPoint, and the other axis perpendicular. More... | |
bool | InitUniformScaleApproximation (TransformCR transform, int primaryAxis, int secondaryAxis) |
Construct a transform which preserves both a primary column directon and a secondary column plane. More... | |
bool | InverseOf (TransformCR in) |
Sets this instance to the inverse transform of in. More... | |
ValidatedTransform | ValidatedInverse () const |
Return the inverse of the instance transform. More... | |
void | InvertRigidBodyTransformation (TransformCR in) |
Sets this instance to a matrix which is the inverse of in IN THE SPECIAL CASE WHERE in HAS ONLY PURE ROTATION OR MIRRORING IN ITS ROTATIONAL PART. More... | |
void | InitFromLineAndRotationAngle (DPoint3dCR point0, DPoint3dCR point1, double radians) |
Returns a transformation of rotation about a specified line. More... | |
bool | InitFromMirrorPlane (DPoint3dCR origin, DVec3dCR normal) |
Initialize a transform that mirrors about a plane. More... | |
bool | InitFromScalePerpendicularToPlane (DPoint3dCR origin, DVec3dCR normal, double scale) |
Initialize a transform that scales around a plane. More... | |
bool | InitFromProjectionToPlane (DPoint3dCR origin, DVec3dCR normal) |
Initialize a transform that projects to a plane. More... | |
void | InitProduct (TransformCR transform1, TransformCR transform2) |
Returns the product of two transformations. More... | |
void | InitProduct (RotMatrixCR matrix, TransformCR transform) |
Returns the product of a matrix and a transformation. More... | |
void | InitProduct (TransformCR transform, RotMatrixCR matrix) |
returns the product of a transformation times a matrix, treating the matrix as a transformation with zero as its translation components. More... | |
double | GetFromMatrixByRowAndColumn (int row, int col) const |
Returns a value from a specified row and column of the matrix part of the transformation. More... | |
double | GetPointComponent (int row) const |
Returns a value from a specified component of the point (translation) part of the transformation. More... | |
void | GetOriginAndVectors (DPoint3dR origin, DVec3dR vector0, DVec3dR vector1, DVec3dR vector2) const |
Sets origin to the translation part, and sets vector0, vector1 vector2 to the columns of this instance. More... | |
void | GetOriginAndVectors (DPoint2dR origin, DVec2dR vector0, DVec2dR vector1) const |
Sets origin to the translation part, and sets vector0 and vector1 to the columns of this 2D instance. More... | |
void | Get4Points (DPoint3dR point0, DPoint3dR point1, DPoint3dR point2, DPoint3dR point3) const |
Sets point0 to the origin (translation part), and sets point1, point2 point3 to the x, y and z points (translations of columns of matrix part by origin) from this instance. More... | |
void | Get4Points (DPoint3dP array) const |
Sets the four points in array to the origin (translation part), x, y and z points (translations of columns of matrix part by origin) from this instance. More... | |
void | GetMatrix (RotMatrixR matrix) const |
Returns the matrix part of a transformation. More... | |
void | SetMatrix (RotMatrixCR matrix) |
Overwrites the matrix part of a preexisting transformation. More... | |
void | GetTranslation (DPoint3dR point) const |
Returns the translation (point) part of a transformation. More... | |
void | SetTranslation (DPoint3dCR point) |
Sets the translation part of this instance to point. More... | |
void | ZeroTranslation () |
Sets the translation part of this instance to zero. More... | |
void | GetTranslation (DPoint2dR point) const |
Sets the given point to the x- and y-coordinates of the translation part of this instance. More... | |
void | SetTranslation (DPoint2dCR point) |
Sets the translation part of this instance to the given point. More... | |
void | SetFixedPoint (DPoint3dCR point) |
Sets the translation part of this instance so that it leaves point point unchanged, i.e. More... | |
void | SetFixedPoint (DPoint2dCR point) |
Sets the translation part of this instance so that it leaves the given point unchanged, i.e. More... | |
void | GetMatrixColumn (DVec3dR column, int index) const |
Returns a column from the matrix part of the transformation. More... | |
void | GetMatrixRow (DVec3dR row, int index) const |
Returns a row from the matrix part of the transformation. More... | |
double | MatrixColumnMagnitude (int i) const |
return the magnitude of a column of the matrix. More... | |
bool | IsEqual (TransformCR transform2) const |
Returns true if two transforms have exact (bitwise) equality. More... | |
bool | IsEqual (TransformCR transform2, double matrixTolerance, double pointTolerance) const |
Returns true if two transformations are equal within tolerance, using separate tolerances for the matrix and point parts. More... | |
double | MaxDiff (TransformCR otherTransform) const |
Returns the largest absolute value difference between corresponding coefficients. More... | |
double | Determinant () const |
Return the determinant of the matrix part. More... | |
double | ColumnXMagnitude () const |
Return magnitude of X column. This is commonly considered as the scale factor of the transform. More... | |
void | Multiply (DPoint3dR point) const |
Multiplies a point by a transform, returning the result in place of the input point. More... | |
void | Multiply (DPoint3dR result, DPoint3dCR point) const |
Returns the product of a transform times a point. More... | |
void | Multiply (DPoint3dR point, double x, double y, double z) const |
Returns the product of a matrix times a point, with the point specified as explict x, y, and z values. More... | |
void | Multiply (DPoint3dP pointArray, int numPoint) const |
Multiplies this instance times each column vector in pointArray and replaces pointArray with the resulting points. More... | |
void | Multiply (DPoint3dP outPoint, DPoint3dCP inPoint, int numPoint) const |
Multiplies this instance times each column vector in inPoint and places the resulting points in outPoint. More... | |
void | MultiplyTranspose (DPoint3dP outPoint, DPoint3dCP inPoint, int numPoint) const |
Multiplies this instance times each column vector in inPoint, using the transpose of the matrix part of this instance in the multiplications, and places the resulting points in outPoint. More... | |
void | MultiplyTranspose (DPoint3dP pointArray, int numPoint) const |
Multiplies this instance times each column vector in pointArray, using the transpose of the matrix part of this instance in the multiplications, and replaces pointArray with the resulting points. More... | |
void | MultiplyMatrixOnly (DPoint3dR point, double x, double y, double z) const |
Multiplies the matrix part of this instance times the column vector constructed from components x,y,z. More... | |
void | MultiplyMatrixOnly (DPoint3dR outPoint, DPoint3dCR inPoint) const |
Multiplies the matrix part of this instance times column vector inPoint. More... | |
void | MultiplyMatrixOnly (DPoint3dR point) const |
Multiplies the matrix part of this instance times column vector point and replaces point with the result. More... | |
void | MultiplyTransposeMatrixOnly (DPoint3dR point, double x, double y, double z) const |
Multiplies the row vector constructed from components x,y,z times the matrix part of this instance. More... | |
void | MultiplyTransposeMatrixOnly (DPoint3dR point) const |
Multiplies the row vector point times the matrix part of this instance, and replaces point with the result. More... | |
void | MultiplyTransposeMatrixOnly (DPoint3dR outPoint, DPoint3dCR inPoint) const |
Multiplies the row vector inPoint times the matrix part of this instance. More... | |
void | Multiply (DPoint2dR result, DPoint2dCR point) const |
Returns the product of a transform times a point, using only the leading 2x2 part of the matrix part. More... | |
void | Multiply (DPoint2dP outPoint, DPoint2dCP inPoint, int numPoint) const |
Multiplies this instance times each column vector in inPoint and places the resulting points in outPoint. More... | |
void | Multiply (DPoint3dR result, DPoint2dCR point) const |
Returns the product of a transform times a point, using only the leading 2x3 part of the matrix part. More... | |
void | Multiply (DPoint3dP outPoint, DPoint2dCP inPoint, int numPoint) const |
Multiplies this instance times each column vector in inPoint and places the resulting points in outPoint. More... | |
void | Multiply (DPoint2dR result, DPoint3dCR point) const |
Returns the product of a transform times a point, using only the leading xy rows (but xyz columns) of the transform. More... | |
void | Multiply (DPoint2dP outPoint, DPoint3dCP inPoint, int numPoint) const |
Multiplies this instance times each column vector in inPoint and places the x and y components of the resulting points in outPoint. More... | |
void | Multiply (DPoint4dR result, DPoint4dCR point) const |
Returns the product of a transform times a homogeneous point. More... | |
void | Multiply (DPoint4dP outPoint, DPoint4dCP inPoint, int numPoint) const |
Multiplies this instance times each column vector in inPoint and places the resulting points in outPoint. More... | |
void | MultiplyWeighted (DPoint3dR point, double weight) const |
Multiplies a "weighted point" in place. More... | |
void | MultiplyWeighted (DPoint3dP outPoint, DPoint3dCP inPoint, const double *pWeight, int numPoint) const |
Multiplies an array of "weighted points" in place. More... | |
bool | Solve (DPoint3dR outPoint, DPoint3dCR inPoint) const |
Solves the linear system Tx=b, where T is this instance, b is the input point and x is the output point. More... | |
bool | SolveArray (DPoint3dP outPoint, DPoint3dCP inPoint, int numPoints) const |
Solves the linear systems TX=B, where T is this instance, B is the matrix of numPoints input points and X is the matrix of numPoints output points. More... | |
void | Multiply (DRange3dR outRange, DRange3dCR inRange) const |
Computes the 8 corner points of the range cube defined by the two points of pRange, multiplies pTransform times each point, and computes the twopoint range limits (min max) of the resulting rotated box. More... | |
void | Multiply (DEllipse3dR inoutEllipse) const |
Trasnform an ellipse. More... | |
void | Multiply (DEllipse3dR outEllipse, DEllipse3dCR inEllipse) const |
Trasnform an ellipse. More... | |
bool | Multiply (DPlane3dR inoutPlane) const |
Trasnform a plane. More... | |
bool | Multiply (DPlane3dR outPlane, DPlane3dCR inPlane) const |
Trasnform an plane. More... | |
void | Multiply (DSegment3dR inoutSegment) const |
Trasnform a segment. More... | |
void | Multiply (DSegment3dR outSegment, DSegment3dCR inSegment) const |
Trasnform an segment. More... | |
void | Multiply (DRay3dR inoutRay) const |
Trasnform a ray. More... | |
void | Multiply (DRay3dR outRay, DRay3dCR inRay) const |
Trasnform an ray. More... | |
bool | TransformImplicitPlane (double &aOut, double &bOut, double &cOut, double &dOut, double a, double b, double c, double d) const |
Transform the a,b,c,d components for an implicit plane. More... | |
void | MultiplyWeighted (bvector< DPoint3d > &weightedXYZOut, bvector< DPoint3d >const &weightedXYZIn, bvector< double > const *weights) const |
Multiply weighted points. More... | |
void | Multiply (bvector< DPoint4d > &xyzwOut, bvector< DPoint4d > const &xyzwIn) const |
Multiply weighted points.,wy,wz> parts but does not affect the weights. More... | |
void | Multiply (bvector< DPoint3d > &xyzOut, bvector< DPoint3d > const &xyzIn) const |
Mutliply 3D points. More... | |
void | Multiply (bvector< DPoint2d > &xyOut, bvector< DPoint2d > const &xyIn) const |
Mutliply 2D points. More... | |
void | Multiply (bvector< DPoint3d > &xyzOut, bvector< DPoint2d > const &xyIn) const |
Mutliply 3D points. More... | |
void | Multiply (bvector< DPoint2d > &xyOut, bvector< DPoint3d > const &xyzIn) const |
Mutliply 3D points. More... | |
bool | SolveArray (bvector< DPoint3d > &xyzOut, bvector< DPoint3d >const &xyzIn) const |
Solve {transform * xyzOut[i] = xyzIn[i]} for each point in the arrays. More... | |
bool | IsIdentity () const |
Returns true if the transform is the identity transform. More... | |
bool | IsRigid () const |
Returns true if the matrix part of a transform is a rigid body rotation, i.e. More... | |
bool | IsRigidScale (double &scale) const |
Returns true if the matrix part of a transform is a rigid body rotation, i.e. More... | |
bool | IsNearRigidScale (TransformR dest, int primaryAxis=0, double tolerance=1.0e-6) const |
Clean up a transform that is close to a pure rotate and scale. More... | |
bool | IsPlanar (DVec3dCR normal) const |
Returns true if transformation effects are entirely within the plane with given normal. More... | |
bool | IsTranslate (DPoint3dR translation) const |
Returns true if the transform is a simple translation. More... | |
bool | IsUniformScale (DPoint3dR fixedPoint, double &scale) const |
Returns true if the transform is a uniform scale with scale factor other than 1.0. More... | |
bool | IsRotateAroundLine (DPoint3dR fixedPoint, DVec3dR directionVector, double &radians) const |
Returns true if the transform is a non-zero rotation around a line. More... | |
bool | IsMirrorAboutPlane (DPoint3dR planePoint, DVec3dR unitNormal) const |
Returns true if the transform is a mirror with respect to a plane. More... | |
bool | IsUniformScaleAndRotateAroundLine (DPoint3dR fixedPoint, DVec3dR directionVector, double &radians, double &scale) const |
Returns true if the transform is a uniform scale combined with a rotation. More... | |
bool | GetAnyFixedPoint (DPoint3dR fixedPoint) const |
Compute any single point that remains unchanged by action of a transform. More... | |
bool | GetFixedLine (DPoint3dR fixedPoint, DVec3dR directionVector) const |
Compute the line (if any) of points that are not affected by this transformation. More... | |
bool | GetFixedPlane (DPoint3dR fixedPoint, DVec3dR planeVectorX, DVec3dR planeVectorY) const |
Compute the plane (if any) of points that are not affected by this transformation. More... | |
bool | GetFixedPlane (TransformR residualTransform, TransformR mirrorTransform, DPoint3dR planePoint, DVec3dR planeNormal) const |
Factor a combination of a mirror part and a non-mirror part, attempting to use a common fixed point for the two parts. More... | |
void | TranslateInLocalCoordinates (TransformCR in, double x, double y, double z) |
Sets this instance to a transformation that has the same matrix part as transform in and a translation part that is the SUM of the translation part of in plus the product of the matrix part of in times the given point. More... | |
void | InitFromPrincipleAxisRotations (TransformCR inTransform, double xrot, double yrot, double zrot) |
Sets this instance to the transformation obtained by premultiplying inTransform by 3 matrix rotations about principle axes, given by the angles xrot, yrot and zrot. More... | |
void | ScaleMatrixColumns (TransformCR transform, double xscale, double yscale, double zscale) |
Scale the columns of the matrix part by respective factors. More... | |
void | ScaleMatrixColumns (double xscale, double yscale, double zscale) |
Scale the columns (in place) of the matrix part by respective factors. More... | |
void | ScaleMatrixRows (TransformCR transform, double xscale, double yscale, double zscale) |
Scale the rows of the matrix part by respective factors. More... | |
void | ScaleCompleteRows (TransformCR transform, double xscale, double yscale, double zscale) |
Scale the complete rows by respective factors. More... | |
void | MultiplyTranslationTransform (DVec3dCR translationIn, double scaleFactor, TransformCR transformIn) |
Multiply by a translation "from the left": result = (Identity , scaled translationIn) * transformIn. More... | |
void | MultiplyTransformTranslation (TransformCR transformIn, DVec3dCR translationIn, double scaleFactor) |
Multiply by a translation "from the left": result = transformIn * (Identity , scaled translationIn) More... | |
void | ScaleDoubleArrayByXColumnMagnitude (double *data, int n) const |
scale all values in an array of doubles by the magnitude of a specified column of the matrix. More... | |
void | OffsetPointByColumn (DPoint3dR out, DPoint3dCR in, int i) const |
Adds column i of the matrix part of this instance to point in and places the result in out. More... | |
Static Public Member Functions | |
static Transform | FromIdentity () |
returns an identity transformation, i.e. More... | |
static Transform | From (RotMatrixCR matrix) |
Returns a transformation with the given matrix part and a zero translation part. More... | |
static Transform | From (RotMatrixCR matrix, DPoint3dCR translation) |
Returns a transformation with the given matrix and translation parts. More... | |
static Transform | From (DPoint3dCR translation) |
Returns a transformation with identity matrix part and given translation part. More... | |
static Transform | FromMatrixAndFixedPoint (RotMatrixCR matrix, DPoint3dCR origin) |
Returns a transformation with given matrix part, and translation part computed from the matrix and a given fixed point. More... | |
static Transform | From (double x, double y, double z) |
Returns a transformation with identity matrix part and translation part given as x, y, and z components. More... | |
static Transform | FromRowValues (double x00, double x01, double x02, double tx, double x10, double x11, double x12, double ty, double x20, double x21, double x22, double tz) |
Returns a transformation copying the double values directly into the rows of this instance. More... | |
static Transform | FromOriginAndBearingXY (DPoint3dCR origin, double bearingRadians) |
Returns a transformation with ul> li>translation xyz are the origin li>xAxis in direction of bearing radians (parallel to xy plane) li>yAxis perpenedicular to xAxis and also parallel to the xy plane. More... | |
static Transform | FromOriginAndXVector (DPoint2dCR origin, DVec2dCR xVector) |
Returns a transform with given origin and xVector. More... | |
static bool | TryRangeMapping (DRange2dCR sourceRange, DRange2dCR destRange, TransformR transform) |
Returns a transformation that maps corners of the source range to corners of the destination range. More... | |
static Transform | FromLineAndRotationAngle (DPoint3dCR point0, DPoint3dCR point1, double radians) |
Returns a transformation of rotation about a specified line. More... | |
static Transform | FromAxisAndRotationAngle (DRay3dCR axis, double radians, TransformR derivativeTransform) |
Returns a transformation of rotation about a specified ray, and also its derivative with respect to the angle. More... | |
static Transform | FromAxisAndRotationAngle (DRay3dCR axis, double radians) |
Returns a transformation of rotation about a specified ray. More... | |
static Transform | FromPrincipleAxisRotations (TransformCR inTransform, double xrot, double yrot, double zrot) |
Sets this instance to the transformation obtained by premultiplying inTransform by 3 matrix rotations about principle axes, given by the angles xrot, yrot and zrot. More... | |
static Transform | FromOriginAndVectors (DPoint3dCR origin, DVec3dCR xVector, DVec3dCR yVector, DVec3dCR zVector) |
Returns a transformation with origin at origin, x-axis xVector, y-axis yVector, and z-axis zVector. More... | |
static Transform | From4Points (DPoint3dCR origin, DPoint3dCR xPoint, DPoint3dCR yPoint, DPoint3dCR zPoint) |
Returns a transformation with origin at origin, x-axis from origin to xPoint, y-axis from origin to yPoint, and z-axis from origin to zPoint. More... | |
static Transform | FromPlaneOf3Points (DPoint3dCR origin, DPoint3dCR xPoint, DPoint3dCR yPoint) |
Returns a transformation with origin at origin, x-axis from origin to xPoint, y-axis from origin to yPoint, and z-axis equal to the cross product of x and y axes. More... | |
static Transform | FromPlaneOf3PointsZeroZ (DPoint3dCR origin, DPoint3dCR xPoint, DPoint3dCR yPoint) |
Returns a transformation with origin at origin, x-axis from origin to xPoint, y-axis from origin to yPoint, and z-axis all zeros. More... | |
static Transform | FromFixedPointAndScaleFactors (DPoint3dCR origin, double xScale, double yScale, double zScale) |
Returns a transformation with x,y,z scales around a fixed point. More... | |
static Transform | FromPlaneNormalToLine (DPoint3dCR origin, DPoint3dCR xPoint, int axisId, bool normalize) |
Returns a (possibly skewed) transformation with origin origin, the axis axisId towards xPoint, and other axes perpendicular. More... | |
static Transform | From2Points (DPoint2dCR origin, DPoint2dCR xPoint, int axisId, bool normalize) |
Returns a transformation in the xy-plane with origin origin, axis axisId towards xPoint, and the other axis perpendicular. More... | |
static Transform | FromProduct (TransformCR transformA, TransformCR transformB) |
Returns the product of two transforms. More... | |
static Transform | FromProduct (TransformCR transformA, TransformCR transformB, TransformCR transformC) |
Returns the product of thre transforms. More... | |
static Transform | FromProduct (RotMatrixCR matrixA, TransformCR transformB) |
Returns the product of a rotmatrix and a transform. (The rotmatrix is treated as a transform with zero translation) More... | |
static Transform | FromProduct (TransformCR transformA, RotMatrixCR matrixB) |
Returns the product of a transform and rotmatrix. (The rotmatrix is treated as a transform with zero translation) More... | |
static bool | InitForwardAndInverseFromAxesAndOrigin (TransformR localToWorld, TransformR worldToLocal, RotMatrixCR axes, DPoint3dCR origin) |
Construct transforms between local and world for given origin and axis directions. More... | |
static void | CorrectCoordinateFrameXYRange (TransformR localToWorld, TransformR worldToLocal, DRange3dR localRange, LocalCoordinateSelect frameType, TransformP appliedTransformOldLocalToNewLocal=NULL) |
Input transforms placed "within" caller's geoemtry so that the geometry range satisfies origin and scaling requirements indicatd by frame type. More... | |
Public Attributes | |
double | form3d [3][4] |
3x4 matrix. Leading 3x3 part is 3x3 matrix commonly called "rotation part"; final column is commonly called "translation part". More... | |
3x4 matrix for defining coordinate frames and affine transformations.
double ColumnXMagnitude | ( | ) | const |
Return magnitude of X column. This is commonly considered as the scale factor of the transform.
void Copy | ( | TransformCR | source | ) |
Returns a copy of a transformation.
[in] | source | The source transform |
|
static |
Input transforms placed "within" caller's geoemtry so that the geometry range satisfies origin and scaling requirements indicatd by frame type.
Expected usage is that a local coordinate frame is placed on some geometry and the range of the geometry is them computed within that local system. The coordinate frame then needs some combination of (a) move origin to lower left of the range, (b) rescale axes so that one or both of x,y directions scale to 01.
[in,out] | localToWorld | local to world transformation to modify. |
[in,out] | worldToLocal | world to lcoal transformation to modify. |
[in,out] | localRange | range of subject data. |
[in] | frameType | identifies target scaling and origin. |
[out] | appliedTransformOldLocalToNewLocal | (optional) the transfrom applied to modify initial local geometry to final local geometry |
double Determinant | ( | ) | const |
Return the determinant of the matrix part.
|
static |
Returns a transformation with the given matrix part and a zero translation part.
[in] | matrix | The matrix part |
|
static |
Returns a transformation with the given matrix and translation parts.
[in] | matrix | The matrix part |
[in] | translation | The translation part |
|
static |
Returns a transformation with identity matrix part and given translation part.
[in] | translation | The translation part |
|
static |
Returns a transformation with identity matrix part and translation part given as x, y, and z components.
[in] | x | The x-coordinate of translation part |
[in] | y | The y-coordinate of translation part |
[in] | z | The z-coordinate of translation part |
|
static |
Returns a transformation in the xy-plane with origin origin, axis axisId towards xPoint, and the other axis perpendicular.
If normalize is false, both axes have length equal to the distance between origin and xPoint.
[in] | origin | |
[in] | xPoint | The target point of axis axisId of coordinate system |
[in] | axisId | The axis (x=0, y=1) that points from origin to xPoint |
[in] | normalize | true to have coordinate system normalized |
|
static |
Returns a transformation with origin at origin, x-axis from origin to xPoint, y-axis from origin to yPoint, and z-axis from origin to zPoint.
All axes are unnormalized. There is no effort to detect zero length axes or degenerate points that define only a line or plane but not a full coordinate system. The axes may be skewed.
[in] | origin | The origin of transformed coordinates |
[in] | xPoint | The 100 point of transformed coordinates |
[in] | yPoint | The 010 point of transformed coordinates |
[in] | zPoint | The 001 point of transformed coordinates |
|
static |
Returns a transformation of rotation about a specified ray, and also its derivative with respect to the angle.
[in] | axis | axis of rotation |
[in] | radians | The rotation angle |
derivativeTransform | transform mapping rotated point (anywhere) to direction vector at its destination. |
Returns a transformation of rotation about a specified ray.
[in] | axis | axis of rotation |
[in] | radians | The rotation angle |
[in] | radians | The rotation angle |
|
static |
Returns a transformation with x,y,z scales around a fixed point.
[in] | origin | The fixed point. |
[in] | xScale | x direction scale factor. |
[in] | yScale | y direction scale factor. |
[in] | zScale | z direction scale factor. |
|
static |
returns an identity transformation, i.e.
zero translation part and identity matrix part.
|
static |
Returns a transformation of rotation about a specified line.
[in] | point0 | The start point of the line |
[in] | point1 | The end point of the line |
[in] | radians | The rotation angle |
|
static |
Returns a transformation with given matrix part, and translation part computed from the matrix and a given fixed point.
This translation part is generally different from the fixed point itself. The resulting transformation will leave the fixed point unchanged and apply whatever effects are contained in the matrix as if the fixed point is the origin.
[in] | matrix | The matrix part |
[in] | origin | The point that is to remain fixed when multiplied by the transformation. |
|
static |
Returns a transformation with ul> li>translation xyz are the origin li>xAxis in direction of bearing radians (parallel to xy plane) li>yAxis perpenedicular to xAxis and also parallel to the xy plane.
li>zAxis is global (0,0,1) ul>
|
static |
Returns a transformation with origin at origin, x-axis xVector, y-axis yVector, and z-axis zVector.
All axes are unnormalized. There is no effort to detect zero length axes or degenerate points that define only a line or plane but not a full coordinate system. The axes may be skewed.
[in] | origin | The origin of transformed coordinates |
[in] | xVector | The 100 point of transformed coordinates |
[in] | yVector | The 010 point of transformed coordinates |
[in] | zVector | The 001 point of transformed coordinates |
|
static |
Returns a transform with given origin and xVector.
The yVector is a CCW perpendicular to the xVector (with the same length) The zVecotor is a unitZ.
|
static |
Returns a (possibly skewed) transformation with origin origin, the axis axisId towards xPoint, and other axes perpendicular.
If normalize is false, all axes have length equal to the distance between the two origin and xPoint. The axes may be skewed.
[in] | origin | The origin of coordinate system |
[in] | xPoint | The target point of axis axisId of coordinate system |
[in] | axisId | The axis that points from origin to xPoint |
[in] | normalize | true to have coordinate system normalized |
|
static |
Returns a transformation with origin at origin, x-axis from origin to xPoint, y-axis from origin to yPoint, and z-axis equal to the cross product of x and y axes.
All axes are unnormalized. There is no effort to detect zero length axes or degenerate points that define only a line or plane but not a full coordinate system.
[in] | origin | The origin of coordinate system |
[in] | xPoint | The 100 point of coordinate system |
[in] | yPoint | The 010 point of coordinate system |
|
static |
Returns a transformation with origin at origin, x-axis from origin to xPoint, y-axis from origin to yPoint, and z-axis all zeros.
All axes are unnormalized. There is no effort to detect zero length axes or degenerate points that define only a line or plane but not a full plane.
[in] | origin | The origin of coordinate system |
[in] | xPoint | The 100 point of coordinate system |
[in] | yPoint | The 010 point of coordinate system |
|
static |
Sets this instance to the transformation obtained by premultiplying inTransform by 3 matrix rotations about principle axes, given by the angles xrot, yrot and zrot.
inTransform may be the same as this instance. Symbolically, given transform M and rotation matrices X,Y,Z, the resulting transform is X*Y*Z*M
[in] | inTransform | The base transformation |
[in] | xrot | The x axis rotation, in radians |
[in] | yrot | The y axis rotation, in radians |
[in] | zrot | The z axis rotation, in radians |
|
static |
Returns the product of two transforms.
|
static |
Returns the product of thre transforms.
|
static |
Returns the product of a rotmatrix and a transform. (The rotmatrix is treated as a transform with zero translation)
|
static |
Returns the product of a transform and rotmatrix. (The rotmatrix is treated as a transform with zero translation)
|
static |
Returns a transformation copying the double values directly into the rows of this instance.
[in] | x00 | The (0,0) entry of the matrix (row, column) |
[in] | x01 | The (0,1) entry |
[in] | x02 | The (0,2) entry |
[in] | tx | The x-coordinate of the translation part |
[in] | x10 | The (1,0) entry |
[in] | x11 | The (1,1) entry |
[in] | x12 | The (1,2) entry |
[in] | ty | The y-coordinate of the translation part |
[in] | x20 | The (2,0) entry |
[in] | x21 | The (2,1) entry |
[in] | x22 | The (2,2) entry |
[in] | tz | The z-coordinate of the translation part |
Sets point0 to the origin (translation part), and sets point1, point2 point3 to the x, y and z points (translations of columns of matrix part by origin) from this instance.
[out] | point0 | origin of transform coordinates |
[out] | point1 | 100 point of transform coordinates |
[out] | point2 | 010 point of transform coordinates |
[out] | point3 | 001 point of transform coordinates |
void Get4Points | ( | DPoint3dP | array | ) | const |
Sets the four points in array to the origin (translation part), x, y and z points (translations of columns of matrix part by origin) from this instance.
[out] | array | origin, 100, 010, 001 points as an array |
bool GetAnyFixedPoint | ( | DPoint3dR | fixedPoint | ) | const |
Compute any single point that remains unchanged by action of a transform.
Note that a pure translation has no fixed points, while any other transformation does.
[out] | fixedPoint | Point that is not changed by the transformation. |
Compute the line (if any) of points that are not affected by this transformation.
Returns false if the fixed point set for the transform is empty, a single point, a plane, or all points.
[out] | fixedPoint | A point on the line. |
[out] | directionVector | vector along the line. |
Compute the plane (if any) of points that are not affected by this transformation.
Returns false if the fixed point set for the transform is empty, a single point, a line, or all points.
[out] | fixedPoint | A point on the line. |
[out] | planeVectorX | a unit vector in the plane. |
[out] | planeVectorY | another unit vector in the plane, perpendicular to pDirectionVectorX. |
bool GetFixedPlane | ( | TransformR | residualTransform, |
TransformR | mirrorTransform, | ||
DPoint3dR | planePoint, | ||
DVec3dR | planeNormal | ||
) | const |
Factor a combination of a mirror part and a non-mirror part, attempting to use a common fixed point for the two parts.
Equationally, the old transform T0 becomes
T0 = T1 * M
where M is the mirror, and T1 is a mirror-free transform. The mirror transform is returned in both matrix form and as plane point with normal. In an order of operations view, a point X is transformed as
T0 * X = T1 * M * X
That is, X mirrored first, followed by rotation and scaling in the residual transform.
[out] | residualTransform | the residual transform. |
[out] | mirrorTransform | the mirror transform. |
[out] | planePoint | A fixed point of the mirror transform. |
[out] | planeNormal | Unit normal for the mirror plane. |
double GetFromMatrixByRowAndColumn | ( | int | row, |
int | col | ||
) | const |
Returns a value from a specified row and column of the matrix part of the transformation.
[in] | row | The index of row to read. Row indices are 0, 1, 2. |
[in] | col | The index of column to read. Column indices are 0, 1, 2. |
void GetMatrix | ( | RotMatrixR | matrix | ) | const |
Returns the matrix part of a transformation.
[out] | matrix | matrix part of transformation |
void GetMatrixColumn | ( | DVec3dR | column, |
int | index | ||
) | const |
Returns a column from the matrix part of the transformation.
[out] | column | column of matrix part. |
[in] | index | column index |
void GetMatrixRow | ( | DVec3dR | row, |
int | index | ||
) | const |
Returns a row from the matrix part of the transformation.
[out] | row | row of matrix part. |
[in] | index | column index |
void GetOriginAndVectors | ( | DPoint3dR | origin, |
DVec3dR | vector0, | ||
DVec3dR | vector1, | ||
DVec3dR | vector2 | ||
) | const |
Sets origin to the translation part, and sets vector0, vector1 vector2 to the columns of this instance.
[out] | origin | origin of transform coordinates |
[out] | vector0 | 100 vector of transform coordinates |
[out] | vector1 | 010 vector of transform coordinates |
[out] | vector2 | 001 vector of transform coordinates |
Sets origin to the translation part, and sets vector0 and vector1 to the columns of this 2D instance.
[out] | origin | origin of transform coordinates |
[out] | vector0 | 10 vector of transform coordinates |
[out] | vector1 | 01 vector of transform coordinates |
double GetPointComponent | ( | int | row | ) | const |
Returns a value from a specified component of the point (translation) part of the transformation.
[in] | row | The index of point component to read. Indices are 0, 1, 2 for x, y, z |
void GetTranslation | ( | DPoint3dR | point | ) | const |
Returns the translation (point) part of a transformation.
[out] | point | vector part of transformation |
void GetTranslation | ( | DPoint2dR | point | ) | const |
Sets the given point to the x- and y-coordinates of the translation part of this instance.
[out] | point | translation part of transformation |
|
static |
Construct transforms between local and world for given origin and axis directions.
[out] | localToWorld | transform from local system to world. |
[out] | worldToLocal | transform from world to local system. |
[in] | axes | coordinate directions of local system (relative to world) |
[in] | origin | origin of local system (in world) |
void InitFrom | ( | RotMatrixCR | matrix | ) |
Returns a transformation with the given matrix part and a zero translation part.
[in] | matrix | The matrix part |
void InitFrom | ( | RotMatrixCR | matrix, |
DPoint3dCR | translation | ||
) |
Returns a transformation with the given matrix and translation parts.
[in] | matrix | The matrix part |
[in] | translation | The translation part |
void InitFrom | ( | DPoint3dCR | translation | ) |
Returns a transformation with identity matrix part and given translation part.
[in] | translation | The translation part |
void InitFrom | ( | double | x, |
double | y, | ||
double | z | ||
) |
Returns a transformation with identity matrix part and translation part given as x, y, and z components.
[in] | x | The x-coordinate of translation part |
[in] | y | The y-coordinate of translation part |
[in] | z | The z-coordinate of translation part |
bool InitFrom | ( | DMap4dCR | hMap, |
int | inverse | ||
) |
Initializes a Transform from the affine part of one of the matrices in an DMap4d.
If the scale factor is 0, the transform is returned as an identity. If the scale factor is other than 1, the all coefficients are divided by the scale factor. Return code is false if the 4'th row is significantly different from (0,0,0,A).
[in] | hMap | The source mapping |
[in] | inverse | true to extract the inverse, false to extract the forward |
bool InitFrom | ( | DMatrix4dCR | matrix | ) |
Initialize from first three rows of DMatrix4d, divided by weight entry.
ALWAYS copy the data, even if final row has invalid data.
void InitFrom2Points | ( | DPoint2dCR | origin, |
DPoint2dCR | xPoint, | ||
int | axisId, | ||
bool | normalize | ||
) |
Returns a transformation in the xy-plane with origin origin, axis axisId towards xPoint, and the other axis perpendicular.
If normalize is false, both axes have length equal to the distance between origin and xPoint. //! //!
[in] | origin | The origin of coordinate system |
[in] | xPoint | The target point of axis axisId of coordinate system |
[in] | axisId | The axis (x=0, y=1) that points from origin to xPoint |
[in] | normalize | true to have coordinate system normalized |
void InitFrom3Points | ( | DPoint2dCR | origin, |
DPoint2dCR | xPoint, | ||
DPoint2dCR | yPoint | ||
) |
Sets this instance to a transformation in the xy-plane with origin at origin, x-axis from origin to xPoint and y-axis from origin to yPoint.
All axes are unnormalized. There is no effort to detect zero length axes or degenerate points that define a line but not a full coordinate system. The axes may be skewed.
[in] | origin | The origin of transformed coordinates |
[in] | xPoint | The 10 point of transformed coordinates |
[in] | yPoint | The 01 point of transformed coordinates |
void InitFrom4Points | ( | DPoint3dCR | origin, |
DPoint3dCR | xPoint, | ||
DPoint3dCR | yPoint, | ||
DPoint3dCR | zPoint | ||
) |
Returns a transformation with origin at origin, x-axis from origin to xPoint, y-axis from origin to yPoint, and z-axis from origin to zPoint.
All axes are unnormalized. There is no effort to detect zero length axes or degenerate points that define only a line or plane but not a full coordinate system. The axes may be skewed.
[in] | origin | The origin of transformed coordinates |
[in] | xPoint | The 100 point of transformed coordinates |
[in] | yPoint | The 010 point of transformed coordinates |
[in] | zPoint | The 001 point of transformed coordinates |
void InitFromLineAndRotationAngle | ( | DPoint3dCR | point0, |
DPoint3dCR | point1, | ||
double | radians | ||
) |
Returns a transformation of rotation about a specified line.
[in] | point0 | The start point of the line |
[in] | point1 | The end point of the line |
[in] | radians | The rotation angle |
void InitFromMatrixAndFixedPoint | ( | RotMatrixCR | matrix, |
DPoint3dCR | origin | ||
) |
Returns a transformation with given matrix part, and translation part computed from the matrix and a given fixed point.
This translation part is generally different from the fixed point itself. The resulting transformation will leave the fixed point unchanged and apply whatever effects are contained in the matrix as if the fixed point is the origin.
[in] | matrix | The matrix part |
[in] | origin | The point that is to remain fixed when multiplied by the transformation. |
bool InitFromMirrorPlane | ( | DPoint3dCR | origin, |
DVec3dCR | normal | ||
) |
Initialize a transform that mirrors about a plane.
[in] | origin | any point on the mirror plane. |
[in] | normal | vector perpendicular to mirror plane |
void InitFromOriginAndLengths | ( | DPoint2dCR | origin, |
double | xAxisLength, | ||
double | yAxisLength | ||
) |
Returns a transformation in the xy-plane with origin origin and x,y-axes of given lengths.
The z-coordinate of the origin is zero and the z-axis is unscaled.
[in] | origin | origin of coordinate system |
[in] | xAxisLength | The length of x-axis |
[in] | yAxisLength | The length of y-axis |
void InitFromOriginAndVectors | ( | DPoint3dCR | origin, |
DVec3dCR | xVector, | ||
DVec3dCR | yVector, | ||
DVec3dCR | zVector | ||
) |
Returns a transformation with origin at origin, x-axis xVector, y-axis yVector, and z-axis zVector.
All axes are unnormalized. There is no effort to detect zero length axes or degenerate points that define only a line or plane but not a full coordinate system. The axes may be skewed.
[in] | origin | The origin of transformed coordinates |
[in] | xVector | The 100 vector of transformed coordinates |
[in] | yVector | The 010 vector of transformed coordinates |
[in] | zVector | The 001 vector of transformed coordinates |
void InitFromOriginAndVectors | ( | DPoint2dCR | origin, |
DVec2dR | xVector, | ||
DVec2dR | yVector | ||
) |
Sets this instance to a transformation in the xy-plane with origin at origin, x-axis xVector and y-axis yVector.
All axes are unnormalized. There is no effort to detect zero length axes or degenerate points that define a line but not a full coordinate system. The axes may be skewed.
[in] | origin | The origin of transformed coordinates |
[in] | xVector | The 10 point of transformed coordinates |
[in] | yVector | 01 point of transformed coordinates |
void InitFromOriginAngleAndLengths | ( | DPoint2dCR | origin, |
double | xAxisAngleRadians, | ||
double | xAxisLength, | ||
double | yAxisLength | ||
) |
Returns a transformation in the xy-plane with origin origin and x,y-axes of the given lengths rotated counter-clockwise from standard position by the given angle.
The z-coordinate of the origin is zero and the z-axis is unscaled.
[in] | origin | origin of coordinate system |
[in] | xAxisAngleRadians | The ccw angle separating x-axis from its standard position |
[in] | xAxisLength | The length of x-axis |
[in] | yAxisLength | The length of y-axis |
bool InitFromOriginXVectorYVectorSquareAndNormalize | ( | DPoint3dCR | origin, |
DVec3dCR | xVector, | ||
DVec3dCR | yVector | ||
) |
Returns a transformation with origin, x axis direction, and xy plane All axes are normalized and perpendicular.
[in] | origin | The origin of transformed coordinates |
[in] | xVector | direction for x axis |
[in] | yVector | "In plane" direction for y axis.
|
void InitFromPlaneNormalToLine | ( | DPoint3dCR | origin, |
DPoint3dCR | xPoint, | ||
int | axisId, | ||
bool | normalize | ||
) |
Returns a (possibly skewed) transformation with origin origin, the axis axisId towards xPoint, and other axes perpendicular.
If normalize is false, all axes have length equal to the distance between the two origin and xPoint. The axes may be skewed.
[in] | origin | The origin of coordinate system |
[in] | xPoint | The target point of axis axisId of coordinate system |
[in] | axisId | The axis that points from origin to xPoint |
[in] | normalize | true to have coordinate system normalized |
void InitFromPlaneOf3Points | ( | DPoint3dCR | origin, |
DPoint3dCR | xPoint, | ||
DPoint3dCR | yPoint | ||
) |
Returns a transformation with origin at origin, x-axis from origin to xPoint, y-axis from origin to yPoint, and z-axis equal to the cross product of x and y axes.
All axes are unnormalized. There is no effort to detect zero length axes or degenerate points that define only a line or plane but not a full coordinate system.
[in] | origin | The origin of coordinate system |
[in] | xPoint | The 100 point of coordinate system |
[in] | yPoint | The 010 point of coordinate system |
void InitFromPrincipleAxisRotations | ( | TransformCR | inTransform, |
double | xrot, | ||
double | yrot, | ||
double | zrot | ||
) |
Sets this instance to the transformation obtained by premultiplying inTransform by 3 matrix rotations about principle axes, given by the angles xrot, yrot and zrot.
inTransform may be the same as this instance. Symbolically, given transform [M t] and rotation matrices X,Y,Z, the resulting transform is [X*Y*Z*M X*Y*Z*t]
[in] | inTransform | The base transformation |
[in] | xrot | The x axis rotation, in radians |
[in] | yrot | The y axis rotation, in radians |
[in] | zrot | The z axis rotation, in radians |
bool InitFromProjectionToPlane | ( | DPoint3dCR | origin, |
DVec3dCR | normal | ||
) |
Initialize a transform that projects to a plane.
[in] | origin | any point on the target plane. |
[in] | normal | vector perpendicular to target plane |
void InitFromRowValues | ( | double | x00, |
double | x01, | ||
double | x02, | ||
double | tx, | ||
double | x10, | ||
double | x11, | ||
double | x12, | ||
double | ty, | ||
double | x20, | ||
double | x21, | ||
double | x22, | ||
double | tz | ||
) |
Copies the double values directly into the rows of this instance.
[in] | x00 | The (0,0) entry of the matrix (row, column) |
[in] | x01 | The (0,1) entry |
[in] | x02 | The (0,2) entry |
[in] | tx | The x-coordinate of the translation part |
[in] | x10 | The (1,0) entry |
[in] | x11 | The (1,1) entry |
[in] | x12 | The (1,2) entry |
[in] | ty | The y-coordinate of the translation part |
[in] | x20 | The (2,0) entry |
[in] | x21 | The (2,1) entry |
[in] | x22 | The (2,2) entry |
[in] | tz | The z-coordinate of the translation part |
bool InitFromScalePerpendicularToPlane | ( | DPoint3dCR | origin, |
DVec3dCR | normal, | ||
double | scale | ||
) |
Initialize a transform that scales around a plane.
[in] | origin | any point on the target plane |
[in] | normal | vector perpendicular to target plane. |
[in] | scale | scale factor. (e.g. 0.0 to project onto the plane, -1 to mirror) |
void InitIdentity | ( | ) |
returns an identity transformation, i.e.
zero translation part and identity matrix part.
Referenced by SolverGeometry::SolverGeometry().
bool InitNormalizedFrameFromOriginXPointYPoint | ( | DPoint3dCR | origin, |
DPoint3dCR | xPoint, | ||
DPoint3dCR | yPoint | ||
) |
Attempt to set up a coordinate frame origin at origin, x-axis from origin to xPoint, y-axis in plane with yPoint, All axes are normalized.
Return false with identity at origin if unable to do cross products.
[in] | origin | The origin of coordinate system |
[in] | xPoint | The 100 point of coordinate system |
[in] | yPoint | The 010 point of coordinate system |
void InitProduct | ( | TransformCR | transform1, |
TransformCR | transform2 | ||
) |
Returns the product of two transformations.
Symbolically, given transforms [R t] and [S u], return the product transform [R t][S u] = [R*S t+R*u].
[in] | transform1 | The first factor |
[in] | transform2 | The second factor |
void InitProduct | ( | RotMatrixCR | matrix, |
TransformCR | transform | ||
) |
Returns the product of a matrix and a transformation.
The matrix acts like a transformation with a zero point as its translation part.
[in] | matrix | The first factor (matrix) |
[in] | transform | The second factor (transform) |
void InitProduct | ( | TransformCR | transform, |
RotMatrixCR | matrix | ||
) |
returns the product of a transformation times a matrix, treating the matrix as a transformation with zero as its translation components.
[in] | transform | The first facpatentor (transform) |
[in] | matrix | The second factor (matrix) |
bool InitUniformScaleApproximation | ( | TransformCR | transform, |
int | primaryAxis, | ||
int | secondaryAxis | ||
) |
Construct a transform which preserves both a primary column directon and a secondary column plane.
Scale all columns to length of primary axis.
[in] | transform | original matrix. |
[in] | primaryAxis | axis to be retained. |
[in] | secondaryAxis | axis defining plane to be maintained. |
bool InverseOf | ( | TransformCR | in | ) |
Sets this instance to the inverse transform of in.
in may be the same as this instance. This is a modestly expensive floating point computation (33 multiplies, 14 adds). Symbolically, given transform [R t] return transform [Q Q*(-t)] where Q is the inverse of matrix R.
[in] | in | The input transformation |
void InvertRigidBodyTransformation | ( | TransformCR | in | ) |
Sets this instance to a matrix which is the inverse of in IN THE SPECIAL CASE WHERE in HAS ONLY PURE ROTATION OR MIRRORING IN ITS ROTATIONAL PART.
These special conditions allow the 'inversion' to be done by only a transposition and one matrix-times-point multiplication, rather than the full effort of inverting a general transformation. It is the caller's responsibility to be sure that these special conditions hold. This usually occurs when the caller has just constructed the transform by a sequence of translations and rotations. If the caller has received the matrix from nonverified external sources and therefore does not know if the special conditions apply, the inverseOf
method should be used instead. in may be the same as this instance. The specific computations in this special-case inversion are (1) the output transform's translation is the input transform's matrix times the negative of the input transform's translation, and (2) the output transform's matrix part is the tranpose of the input transform's matrix part. Symbolically, given transform [R t] return transform [R^ (R^)*(-t)] where ^ indicates transposition.
[in] | in | The input transformation (TransformCR) |
bool IsEqual | ( | TransformCR | transform2 | ) | const |
Returns true if two transforms have exact (bitwise) equality.
[in] | transform2 | The second transform |
bool IsEqual | ( | TransformCR | transform2, |
double | matrixTolerance, | ||
double | pointTolerance | ||
) | const |
Returns true if two transformations are equal within tolerance, using separate tolerances for the matrix and point parts.
bool IsIdentity | ( | ) | const |
Returns true if the transform is the identity transform.
Returns true if the transform is a mirror with respect to a plane.
[out] | planePoint | Some point on the plane. |
[out] | unitNormal | unit vector perpendicular to the plane. |
bool IsNearRigidScale | ( | TransformR | dest, |
int | primaryAxis = 0 , |
||
double | tolerance = 1.0e-6 |
||
) | const |
Clean up a transform that is close to a pure rotate and scale.
If source is NOT near to a rigid scale, return false and copy to the dest. If near an identity return identity. If nearly perpendicular with scales other than 1, clean preserving the length and direction of the primary axis. This is intended to be used with a crude (e.g. 1.0e-6) reltol to identify old DGN file matrices that are "dirty" by modern standards but were meant to be identity, rotation, or scaled rotations in the UOR era.
[in] | dest | result |
[in] | primaryAxis | axis whose orientation and direction is preserved. |
[in] | tolerance | relative tolerance for recognizing near-perpendicular conditions. |
bool IsPlanar | ( | DVec3dCR | normal | ) | const |
Returns true if transformation effects are entirely within the plane with given normal.
[in] | normal | The plane normal |
bool IsRigid | ( | ) | const |
Returns true if the matrix part of a transform is a rigid body rotation, i.e.
its transpose is its inverse and it has a positive determinant.
bool IsRigidScale | ( | double & | scale | ) | const |
Returns true if the matrix part of a transform is a rigid body rotation, i.e.
its transpose is its inverse and it has a positive determinant.
[out] | scale | scale factor. |
Returns true if the transform is a non-zero rotation around a line.
[out] | fixedPoint | a point on the line. |
[out] | directionVector | vector in the line direction. |
[out] | radians | rotation angle in radians. |
bool IsTranslate | ( | DPoint3dR | translation | ) | const |
Returns true if the transform is a simple translation.
[out] | translation | the translation vector. Zero of not a translation transform. |
bool IsUniformScale | ( | DPoint3dR | fixedPoint, |
double & | scale | ||
) | const |
Returns true if the transform is a uniform scale with scale factor other than 1.0.
[out] | fixedPoint | (If function result is true) the (one) point which remains in place in the transformation. |
[out] | scale | The scale factor. If the transform is not a scale, this is returned as 1.0. |
bool IsUniformScaleAndRotateAroundLine | ( | DPoint3dR | fixedPoint, |
DVec3dR | directionVector, | ||
double & | radians, | ||
double & | scale | ||
) | const |
Returns true if the transform is a uniform scale combined with a rotation.
One, but not both, of the two steps may be null (unit scale or no rotation)
[out] | fixedPoint | fixed point of scaling. This is also a point on the line. |
[out] | directionVector | vector in the direction of the rotation. |
[out] | radians | rotation angle |
[out] | scale | scale factor. |
double MatrixColumnMagnitude | ( | int | i | ) | const |
return the magnitude of a column of the matrix.
[in] | i | column index. Adjusted cyclically if outside 012 |
double MaxDiff | ( | TransformCR | otherTransform | ) | const |
Returns the largest absolute value difference between corresponding coefficients.
[in] | otherTransform |
void Multiply | ( | DPoint3dR | point | ) | const |
Multiplies a point by a transform, returning the result in place of the input point.
[in,out] | point | point to be updated |
void Multiply | ( | DPoint3dR | result, |
DPoint3dCR | point | ||
) | const |
Returns the product of a transform times a point.
[out] | result | returned point. |
[in] | point | The input point. |
void Multiply | ( | DPoint3dR | point, |
double | x, | ||
double | y, | ||
double | z | ||
) | const |
Returns the product of a matrix times a point, with the point specified as explict x, y, and z values.
[out] | point | result of transformation * point operation |
[in] | x | The x component of the point |
[in] | y | The y component of the point |
[in] | z | The z component of the point |
void Multiply | ( | DPoint3dP | pointArray, |
int | numPoint | ||
) | const |
Multiplies this instance times each column vector in pointArray and replaces pointArray with the resulting points.
Symbolically, given transform [R t], each returned point is of the form R*p + t, where p is a column vector.
[in,out] | pointArray | array of points to be multiplied |
[in] | numPoint | The number of points |
void Multiply | ( | DPoint3dP | outPoint, |
DPoint3dCP | inPoint, | ||
int | numPoint | ||
) | const |
Multiplies this instance times each column vector in inPoint and places the resulting points in outPoint.
inPoint and outPoint may be the same. Symbolically, given transform [R t], each returned point has the form R*p + t, where p is a column vector.
[out] | outPoint | transformed points |
[in] | inPoint | The input points |
[in] | numPoint | The number of points |
void Multiply | ( | DPoint2dR | result, |
DPoint2dCR | point | ||
) | const |
Returns the product of a transform times a point, using only the leading 2x2 part of the matrix part.
[out] | result | returned point. |
[in] | point | The input point. |
void Multiply | ( | DPoint2dP | outPoint, |
DPoint2dCP | inPoint, | ||
int | numPoint | ||
) | const |
Multiplies this instance times each column vector in inPoint and places the resulting points in outPoint.
inPoint and outPoint may be the same. All z parts (i.e. last row and column) of this instance are ignored.
[out] | outPoint | transformed points |
[in] | inPoint | The input points |
[in] | numPoint | The number of points |
void Multiply | ( | DPoint3dR | result, |
DPoint2dCR | point | ||
) | const |
Returns the product of a transform times a point, using only the leading 2x3 part of the matrix part.
[out] | result | returned point. |
[in] | point | The input point. |
void Multiply | ( | DPoint3dP | outPoint, |
DPoint2dCP | inPoint, | ||
int | numPoint | ||
) | const |
Multiplies this instance times each column vector in inPoint and places the resulting points in outPoint.
Each input point is given a z=0.
[out] | outPoint | transformed points |
[in] | inPoint | The input points |
[in] | numPoint | The number of points |
void Multiply | ( | DPoint2dR | result, |
DPoint3dCR | point | ||
) | const |
Returns the product of a transform times a point, using only the leading xy rows (but xyz columns) of the transform.
[out] | result | returned point. |
[in] | point | The input point. |
void Multiply | ( | DPoint2dP | outPoint, |
DPoint3dCP | inPoint, | ||
int | numPoint | ||
) | const |
Multiplies this instance times each column vector in inPoint and places the x and y components of the resulting points in outPoint.
[out] | outPoint | transformed points |
[in] | inPoint | The input points |
[in] | numPoint | The number of points |
void Multiply | ( | DPoint4dR | result, |
DPoint4dCR | point | ||
) | const |
Returns the product of a transform times a homogeneous point.
(Transform is extended by a 0001 row.)
[out] | result | returned point. |
[in] | point | The input point. |
void Multiply | ( | DPoint4dP | outPoint, |
DPoint4dCP | inPoint, | ||
int | numPoint | ||
) | const |
Multiplies this instance times each column vector in inPoint and places the resulting points in outPoint.
inPoint and outPoint may be the same. Symbolically, given transform [R t], each returned point has the form R*p + t*w (with weight w), where p is a column vector and w is its weight.
[out] | outPoint | transformed points |
[in] | inPoint | The input points |
[in] | numPoint | The number of points |
void Multiply | ( | DRange3dR | outRange, |
DRange3dCR | inRange | ||
) | const |
Computes the 8 corner points of the range cube defined by the two points of pRange, multiplies pTransform times each point, and computes the twopoint range limits (min max) of the resulting rotated box.
Note that the volume of the rotated box is generally larger than that of the input because the postrotation minmax operation expands the box.
[out] | outRange | range of transformed cube |
[in] | inRange | The any two corners of original cube |
void Multiply | ( | DEllipse3dR | inoutEllipse | ) | const |
Trasnform an ellipse.
inoutEllipse | ellipse to transform in place |
void Multiply | ( | DEllipse3dR | outEllipse, |
DEllipse3dCR | inEllipse | ||
) | const |
Trasnform an ellipse.
outEllipse | destination ellipse |
inEllipse | source ellipse |
bool Multiply | ( | DPlane3dR | inoutPlane | ) | const |
Trasnform a plane.
inoutPlane | plane to transform in place |
bool Multiply | ( | DPlane3dR | outPlane, |
DPlane3dCR | inPlane | ||
) | const |
Trasnform an plane.
outPlane | destination plane |
inPlane | source plane |
void Multiply | ( | DSegment3dR | inoutSegment | ) | const |
Trasnform a segment.
inoutSegment | segment to transform in place |
void Multiply | ( | DSegment3dR | outSegment, |
DSegment3dCR | inSegment | ||
) | const |
Trasnform an segment.
outSegment | destination segment |
inSegment | source segment |
void Multiply | ( | DRay3dR | inoutRay | ) | const |
Trasnform a ray.
inoutRay | ray to transform in place |
Trasnform an ray.
outRay | destination ray |
inRay | source ray |
Multiply weighted points.,wy,wz> parts but does not affect the weights.
[out] | xyzwOut | transformed weighted coordinates. |
[in] | xyzwIn | original weighted coordinates. |
Mutliply 3D points.
[out] | xyzOut | transformed points. |
[in] | xyzIn | original points. |
Mutliply 2D points.
[out] | xyOut | transformed points.. z parts from transform are ignored. |
[in] | xyIn | original points. Implicitly z=0 for mutliplication. |
Mutliply 3D points.
[out] | xyzOut | transformed points. |
[in] | xyIn | original points. Implicitly z=0 for mutliplication. |
Mutliply 3D points.
[out] | xyOut | transformed points. z row from transform is ignored. |
[in] | xyzIn | original points. |
void MultiplyMatrixOnly | ( | DPoint3dR | point, |
double | x, | ||
double | y, | ||
double | z | ||
) | const |
Multiplies the matrix part of this instance times the column vector constructed from components x,y,z.
Symbolically, given transform [R t] and column vector p, the returned point is R*p.
[out] | point | result of matrix * point operation |
[in] | x | The x component of the point |
[in] | y | The y component of the point |
[in] | z | The z component of the point |
void MultiplyMatrixOnly | ( | DPoint3dR | outPoint, |
DPoint3dCR | inPoint | ||
) | const |
Multiplies the matrix part of this instance times column vector inPoint.
Symbolically, given transform [R t] and column vector p, the returned point is R*p.
[out] | outPoint | result of matrix * point operation |
[in] | inPoint | The point by which matrix is multiplied |
void MultiplyMatrixOnly | ( | DPoint3dR | point | ) | const |
Multiplies the matrix part of this instance times column vector point and replaces point with the result.
Symbolically, given transform [R t] and column vector p, the returned point is R*p.
[in,out] | point | point to be updated |
void MultiplyTransformTranslation | ( | TransformCR | transformIn, |
DVec3dCR | translationIn, | ||
double | scaleFactor | ||
) |
Multiply by a translation "from the left": result = transformIn * (Identity , scaled translationIn)
[in] | transformIn | full transform for right factor. |
[in] | translationIn | translation vector for right term |
[in] | scaleFactor | scale factor for translation |
void MultiplyTranslationTransform | ( | DVec3dCR | translationIn, |
double | scaleFactor, | ||
TransformCR | transformIn | ||
) |
Multiply by a translation "from the left": result = (Identity , scaled translationIn) * transformIn.
[in] | translationIn | translation vector for left term |
[in] | scaleFactor | factor for translation |
[in] | transformIn | full transform for right factor. |
void MultiplyTranspose | ( | DPoint3dP | outPoint, |
DPoint3dCP | inPoint, | ||
int | numPoint | ||
) | const |
Multiplies this instance times each column vector in inPoint, using the transpose of the matrix part of this instance in the multiplications, and places the resulting points in outPoint.
Symbolically, given transform [R t], each returned point has the equivalent form p*R + t, where p is a row vector. inPoint and outPoint may be the same.
[out] | outPoint | transformed points |
[in] | inPoint | The input points |
[in] | numPoint | The number of points |
void MultiplyTranspose | ( | DPoint3dP | pointArray, |
int | numPoint | ||
) | const |
Multiplies this instance times each column vector in pointArray, using the transpose of the matrix part of this instance in the multiplications, and replaces pointArray with the resulting points.
Symbolically, given transform [R t], each returned point has the equivalent form p*R + t, where p is a row vector.
[in,out] | pointArray | array of points to be multiplied |
[in] | numPoint | The number of points |
void MultiplyTransposeMatrixOnly | ( | DPoint3dR | point, |
double | x, | ||
double | y, | ||
double | z | ||
) | const |
Multiplies the row vector constructed from components x,y,z times the matrix part of this instance.
Symbolically, given transform [R t] and row vector p, the returned point is p*R.
[out] | point | result of point * matrix operation |
[in] | x | The x component of the point |
[in] | y | The y component of the point |
[in] | z | The z component of the point |
void MultiplyTransposeMatrixOnly | ( | DPoint3dR | point | ) | const |
Multiplies the row vector point times the matrix part of this instance, and replaces point with the result.
Symbolically, given transform [R t] and row vector p, the returned point is p*R.
[in,out] | point | point to be updated |
void MultiplyTransposeMatrixOnly | ( | DPoint3dR | outPoint, |
DPoint3dCR | inPoint | ||
) | const |
Multiplies the row vector inPoint times the matrix part of this instance.
Symbolically, given transform [R t] and row vector p, the returned point is p*R.
[out] | outPoint | result of point * matrix operation |
[in] | inPoint | The point which multiplies matrix |
void MultiplyWeighted | ( | DPoint3dR | point, |
double | weight | ||
) | const |
Multiplies a "weighted point" in place.
That is, the point is input and output as (wx,wy,wz,w) where x,y,z are the cartesian image coordinates.
[in,out] | point | point to be updated |
[in] | weight | The weight |
void MultiplyWeighted | ( | DPoint3dP | outPoint, |
DPoint3dCP | inPoint, | ||
const double * | pWeight, | ||
int | numPoint | ||
) | const |
Multiplies an array of "weighted points" in place.
That is, the point is input and output as (wx,wy,wz,w) where x,y,z are the cartesian image coordinates.
[in] | outPoint | The transformed points. |
[in] | inPoint | The original points |
[in] | pWeight | The weight array. If null, unit weight is used. |
[in] | numPoint | number of points in arrays |
void MultiplyWeighted | ( | bvector< DPoint3d > & | weightedXYZOut, |
bvector< DPoint3d >const & | weightedXYZIn, | ||
bvector< double > const * | weights | ||
) | const |
Multiply weighted points.
[out] | weightedXYZOut | transformed weighted coordinates. |
[in] | weightedXYZIn | original weighted coordinates. |
[in] | weights | weights. |
void OffsetPointByColumn | ( | DPoint3dR | out, |
DPoint3dCR | in, | ||
int | i | ||
) | const |
Adds column i of the matrix part of this instance to point in and places the result in out.
[out] | out | sum of in and column i |
[in] | in | The base point for sum |
[in] | i | The column index of matrix |
void ScaleCompleteRows | ( | TransformCR | transform, |
double | xscale, | ||
double | yscale, | ||
double | zscale | ||
) |
Scale the complete rows by respective factors.
(See also scaleMatrixColumns, scaleMatrixRows, which only act on the matrix part)
[in] | transform | The input transform. |
[in] | xscale | The x column scale factor |
[in] | yscale | The y column scale factor |
[in] | zscale | The z column scale factor |
void ScaleDoubleArrayByXColumnMagnitude | ( | double * | data, |
int | n | ||
) | const |
scale all values in an array of doubles by the magnitude of a specified column of the matrix.
[in] | data | array of doubles. |
[in] | n | number of values. |
void ScaleMatrixColumns | ( | TransformCR | transform, |
double | xscale, | ||
double | yscale, | ||
double | zscale | ||
) |
Scale the columns of the matrix part by respective factors.
Translation part is unaffected. (See also scaleMatrixRows, scaleTransformRows)
[in] | transform | The input transform. |
[in] | xscale | The x column scale factor |
[in] | yscale | The y column scale factor |
[in] | zscale | The z column scale factor |
void ScaleMatrixColumns | ( | double | xscale, |
double | yscale, | ||
double | zscale | ||
) |
Scale the columns (in place) of the matrix part by respective factors.
Translation part is unaffected. (See also scaleMatrixRows, scaleTransformRows)
[in] | xscale | The x column scale factor |
[in] | yscale | The y column scale factor |
[in] | zscale | The z column scale factor |
void ScaleMatrixRows | ( | TransformCR | transform, |
double | xscale, | ||
double | yscale, | ||
double | zscale | ||
) |
Scale the rows of the matrix part by respective factors.
Translation part is unaffected. (See also scaleMatrixColumns, scaleTransformRows)
[in] | transform | The input transform. |
[in] | xscale | The x column scale factor |
[in] | yscale | The y column scale factor |
[in] | zscale | The z column scale factor |
void SetFixedPoint | ( | DPoint3dCR | point | ) |
Sets the translation part of this instance so that it leaves point point unchanged, i.e.
so that this instance may be interpreted as applying its matrix part as a rotation or scaling about point. Symbolically, given transform [R t] and column vector p, the returned transform is [R p-R*p]. (The prior translation part is destroyed, and does not affect the result in any way.)
[in] | point | The point that is to remain fixed when multiplied by the modified transformation |
void SetFixedPoint | ( | DPoint2dCR | point | ) |
Sets the translation part of this instance so that it leaves the given point unchanged, i.e.
so that this instance may be interpreted as applying its matrix part as a rotation or scaling (in the xy-plane) about the point. Symbolically, given transform [R t] and column vector p, the returned transform is [R p-R*p]. (The prior translation part is destroyed, and does not affect the result in any way.)
[in] | point | The point that is to remain fixed when multiplied by the modified transformation |
void SetMatrix | ( | RotMatrixCR | matrix | ) |
Overwrites the matrix part of a preexisting transformation.
The translation part is unchanged.
[in] | matrix | The matrix to insert |
void SetTranslation | ( | DPoint3dCR | point | ) |
Sets the translation part of this instance to point.
The prior translation part is overwritten, and the matrix part is unchanged. Symbolically, if point is u then this instance [R t] becomes the transformation [R u].
[in] | point | The vector to insert |
void SetTranslation | ( | DPoint2dCR | point | ) |
Sets the translation part of this instance to the given point.
The prior translation part is overwritten (and z-coord set to zero) and the matrix part is unchanged. Symbolically, if point is u then this instance [R t] becomes the transformation [R u].
[in] | point | The point to insert |
bool Solve | ( | DPoint3dR | outPoint, |
DPoint3dCR | inPoint | ||
) | const |
Solves the linear system Tx=b, where T is this instance, b is the input point and x is the output point.
No simplifying assumptions are made regarding the matrix part of T. Symbolically, if T = [M t], then x = Q (b - t), where Q is the inverse of M (i.e., the system is equivalent to Mx = b - t). inPoint and outPoint may have identical addresses.
[out] | outPoint | solution to system |
[in] | inPoint | The constant point of the system |
bool SolveArray | ( | DPoint3dP | outPoint, |
DPoint3dCP | inPoint, | ||
int | numPoints | ||
) | const |
Solves the linear systems TX=B, where T is this instance, B is the matrix of numPoints input points and X is the matrix of numPoints output points.
No simplifying assumptions are made regarding the matrix part of T. Symbolically, if T = [M t], then for each input/output point i, X[i] = Q (B[i] - t), where Q is the inverse of M (i.e., the i_th system is equivalent to MX[i] = B[i] - t). inPoint and outPoint may have identical addresses.
[out] | outPoint | column points of solution matrix to system |
[in] | inPoint | The column points of constant matrix of system |
[in] | numPoints | The number of input/output points |
Solve {transform * xyzOut[i] = xyzIn[i]} for each point in the arrays.
(i.e. multiply by the inverse array.)
[out] | xyzOut | solution points. |
[in] | xyzIn | original points. |
bool TransformImplicitPlane | ( | double & | aOut, |
double & | bOut, | ||
double & | cOut, | ||
double & | dOut, | ||
double | a, | ||
double | b, | ||
double | c, | ||
double | d | ||
) | const |
Transform the a,b,c,d components for an implicit plane.
The plane equation format is ax+by+cz=d.
[out] | aOut | x coefficient in transformed plane equation |
[out] | bOut | y coefficient in transformed plane equation |
[out] | cOut | z coefficient in transformed plane equation |
[out] | dOut | constant coefficient for equation. |
[in] | a | The x coefficient in plane equation |
[in] | b | The y coefficient in plane equation |
[in] | c | The z coefficient in plane equation |
[in] | d | The constant on right hand side of plane equation |
void TranslateInLocalCoordinates | ( | TransformCR | in, |
double | x, | ||
double | y, | ||
double | z | ||
) |
Sets this instance to a transformation that has the same matrix part as transform in and a translation part that is the SUM of the translation part of in plus the product of the matrix part of in times the given point.
If the translation part of in is interpreted as the origin of a coordinate system (whose axis directions and sizes are given by the columns of the matrix part), this instance becomes a coordinate frame with the same axis directions and sizes, but with the origin shifted to point x,y,z of the in system. That is, x,y,z are the local coordinates of the new origin, and the translation part of this instance becomes the global coordinates of the new origin. in may be identical to this instance. Symbolically, if in is the transform [R t] and the local origin coordinates x,y,z are in column vector p, the result is the transformation [R t+R*p].
[in] | in | The input transformation |
[in] | x | The x-coordinate of the local origin |
[in] | y | The y-coordinate of the local origin |
[in] | z | The z-coordinate of the local origin |
|
static |
Returns a transformation that maps corners of the source range to corners of the destination range.
ValidatedTransform ValidatedInverse | ( | ) | const |
Return the inverse of the instance transform.
This is a modestly expensive floating point computation (33 multiplies, 14 adds). Symbolically, given transform [R t] return transform [Q Q*(-t)] where Q is the inverse of matrix R.
void ZeroTranslation | ( | ) |
Sets the translation part of this instance to zero.
The prior translation part is overwritten, and the matrix part is unchanged. Symbolically, this instance [R t] becomes the transformation [R 0].
double form3d[3][4] |
3x4 matrix. Leading 3x3 part is 3x3 matrix commonly called "rotation part"; final column is commonly called "translation part".