Rhino C++ API
8.14
|
#include <opennurbs_xform.h>
Public Member Functions | |
ON_Xform () | |
Default constructor transformation has diagonal (0,0,0,1) More... | |
ON_Xform (const double *) | |
from array of 16 doubles (row0,row1,row2,row3) More... | |
ON_Xform (const double[4][4]) | |
from standard double m[4][4] More... | |
ON_Xform (const float *) | |
from array of 16 floats (row0,row1,row2,row3) More... | |
ON_Xform (const float[4][4]) | |
from standard float m[4][4] More... | |
ON_Xform (const ON_3dPoint &P, const ON_3dVector &X, const ON_3dVector &Y, const ON_3dVector &Z) | |
ON_Xform (const ON_Matrix &) | |
ON_Xform (const ON_Xform &)=default | |
ON_Xform (double x) | |
Constructs transformation with diagonal (x,x,x,1) More... | |
~ON_Xform ()=default | |
void | ActOnLeft (double, double, double, double, double[4]) const |
void | ActOnRight (double, double, double, double, double[4]) const |
void | Affineize () |
bool | CameraToClip (bool bIsPerspective, double, double, double, double, double, double) |
void | CameraToWorld (const ON_3dPoint &, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &) |
bool | ChangeBasis (const ON_3dPoint &P0, const ON_3dVector &X0, const ON_3dVector &Y0, const ON_3dVector &Z0, const ON_3dPoint &P1, const ON_3dVector &X1, const ON_3dVector &Y1, const ON_3dVector &Z1) |
bool | ChangeBasis (const ON_3dVector &X0, const ON_3dVector &Y0, const ON_3dVector &Z0, const ON_3dVector &X1, const ON_3dVector &Y1, const ON_3dVector &Z1) |
bool | ChangeBasis (const ON_Plane &plane0, const ON_Plane &plane1) |
int | ClipFlag3d (const double *) const |
int | ClipFlag3d (int, int, const double *, bool bTestZ=true) const |
int | ClipFlag3dBox (const double *, const double *) const |
int | ClipFlag4d (const double *) const |
int | ClipFlag4d (int, int, const double *, bool bTestZ=true) const |
bool | ClipToCamera (bool bIsPerspective, double, double, double, double, double, double) |
maps -1 <= x,y,z <= 1 box to viewport frustum More... | |
bool | ClipToScreen (double, double, double, double, double, double) |
int | Compare (const ON_Xform &other) const |
ON__UINT32 | CRC32 (ON__UINT32 current_remainder) const |
bool | DecomposeAffine (ON_3dVector &Translation, ON_Xform &Linear) const |
bool | DecomposeAffine (ON_3dVector &Translation, ON_Xform &Rotation, ON_Xform &OrthBasis, ON_3dVector &Diagonal) const |
bool | DecomposeAffine (ON_Xform &Linear, ON_3dVector &Translation) const |
int | DecomposeRigid (ON_3dVector &Translation, ON_Xform &Rotation, double tolerance=ON_ZERO_TOLERANCE) const |
int | DecomposeSimilarity (ON_3dVector &Translation, double &dilation, ON_Xform &Rotation, double tolerance) const |
bool | DecomposeSymmetric (ON_Xform &Q, ON_3dVector &diagonal) const |
void | DecomposeTextureMapping (ON_3dVector &offset, ON_3dVector &repeat, ON_3dVector &rotation) const |
Convert an ON_Xform into the offset, repeat and rotation values used in ON_Texture and similar classes. More... | |
double | Determinant (double *minimum_pivot=nullptr) const |
If you need a slow and accurate determinant, this is the function to call. If you need a fast sign check, used SignOfDeterminant(true). More... | |
void | Diagonal (double d) |
bool | GetEulerZYZ (double &alpha, double &beta, double &gamma) const |
bool | GetKMLOrientationAnglesDegrees (double &heading_degrees, double &tilt_degrees, double &roll_degrees) const |
bool | GetKMLOrientationAnglesRadians (double &heading_radians, double &tilt_radians, double &roll_radians) const |
double | GetMappingXforms (ON_Xform &P_xform, ON_Xform &N_xform) const |
bool | GetQuaternion (ON_Quaternion &Q) const |
double | GetSurfaceNormalXform (ON_Xform &N_xform) const |
double | GetSurfaceNormalXformKeepLengthAndOrientation (ON_Xform &N_xform) const |
bool | GetYawPitchRoll (double &yaw, double &pitch, double &roll) const |
const ON_SHA1_Hash | Hash () const |
void | Identity () |
standard transformations More... | |
bool | IntervalChange (int dir, ON_Interval old_interval, ON_Interval new_interval) |
ON_Xform | Inverse (double *=nullptr) const |
bool | Invert (double *=nullptr) |
bool | IsAffine () const |
bool | IsIdentity (double zero_tolerance=0.0) const |
bool | IsLinear () const |
bool | IsNan () const |
bool | IsNotIdentity (double zero_tolerance=0.0) const |
int | IsRigid (double tolerance=ON_ZERO_TOLERANCE) const |
bool | IsRotation () const |
true if this is a proper rotation. More... | |
int | IsSimilarity () const |
int | IsSimilarity (double tolerance) const |
bool | IsTranslation (double zero_tolerance=0.0) const |
bool | IsValid () const |
bool | IsValidAndNotZeroAndNotIdentity (double zero_tolerance=0.0) const |
bool | IsZero () const |
bool | IsZero4x4 () const |
bool | IsZero4x4 (double zero_tolerance) const |
bool | IsZeroTransformation () const |
bool | IsZeroTransformation (double zero_tolerance) const |
void | Linearize () |
void | Mirror (ON_3dPoint point_on_mirror_plane, ON_3dVector normal_to_mirror_plane) |
bool | operator!= (const ON_Xform &rhs) const |
ON_2dPoint | operator* (const ON_2dPoint &) const |
ON_2dVector | operator* (const ON_2dVector &) const |
ON_3dPoint | operator* (const ON_3dPoint &) const |
ON_3dVector | operator* (const ON_3dVector &) const |
ON_4dPoint | operator* (const ON_4dPoint &) const |
ON_Xform | operator* (const ON_Xform &) const |
ON_Xform | operator+ (const ON_Xform &) const |
ON_Xform | operator- (const ON_Xform &) const |
ON_Xform & | operator= (const ON_Matrix &) |
xform = scalar results in a diagonal 3x3 with bottom row = 0,0,0,1 More... | |
ON_Xform & | operator= (const ON_Xform &)=default |
bool | operator== (const ON_Xform &rhs) const |
double * | operator[] (int) |
const double * | operator[] (int) const |
bool | Orthogonalize (double tol) |
void | PlanarProjection (const ON_Plane &plane) |
int | Rank (double *=nullptr) const |
void | Rotation (const ON_3dPoint &P0, const ON_3dVector &X0, const ON_3dVector &Y0, const ON_3dVector &Z0, const ON_3dPoint &P1, const ON_3dVector &X1, const ON_3dVector &Y1, const ON_3dVector &Z1) |
void | Rotation (const ON_3dVector &X0, const ON_3dVector &Y0, const ON_3dVector &Z0, const ON_3dVector &X1, const ON_3dVector &Y1, const ON_3dVector &Z1) |
void | Rotation (const ON_Plane &plane0, const ON_Plane &plane1) |
void | Rotation (double angle_radians, ON_3dVector rotation_axis, ON_3dPoint rotation_center) |
void | Rotation (double sin_angle, double cos_angle, ON_3dVector rotation_axis, ON_3dPoint rotation_center) |
void | Rotation (ON_3dVector start_dir, ON_3dVector end_dir, ON_3dPoint rotation_center) |
void | RotationZYX (double yaw, double pitch, double roll) |
void | RotationZYZ (double alpha, double beta, double gamma) |
void | Scale (const ON_3dVector &scale_vector) |
void | Scale (const ON_Plane &plane, double x_scale_factor, double y_scale_factor, double z_scale_factor) |
void | Scale (double x_scale_factor, double y_scale_factor, double z_scale_factor) |
void | Scale (ON_3dPoint fixed_point, double scale_factor) |
bool | ScreenToClip (double, double, double, double, double, double) |
void | Shear (const ON_Plane &plane, const ON_3dVector &x1, const ON_3dVector &y1, const ON_3dVector &z1) |
int | SignOfDeterminant (bool bFastTest) const |
Quickly determine the sign of the determinant. Definitely good enough for graphics code. More... | |
void | Translation (const ON_3dVector &delta) |
void | Translation (double dx, double dy, double dz) |
void | Transpose () |
matrix operations More... | |
void | WorldToCamera (const ON_3dPoint &, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &) |
standard viewing transformations More... | |
Static Public Member Functions | |
static const ON_Xform | DiagonalTransformation (const ON_3dVector &diagonal) |
static const ON_Xform | DiagonalTransformation (double d) |
static const ON_Xform | DiagonalTransformation (double d0, double d1, double d2) |
static const ON_Xform | MirrorTransformation (ON_PlaneEquation mirror_plane) |
static const ON_Xform | RotationTransformationFromKMLAnglesDegrees (double heading_degrees, double tilt_degrees, double roll_degrees) |
static const ON_Xform | RotationTransformationFromKMLAnglesRadians (double heading_radians, double tilt_radians, double roll_radians) |
static const ON_Xform | ScaleTransformation (const ON_3dPoint &fixed_point, double scale_factor) |
static const ON_Xform | ScaleTransformation (const ON_3dPoint &fixed_point, double x_scale_factor, double y_scale_factor, double z_scale_factor) |
static const ON_Xform | ScaleTransformation (const ON_Plane &plane, double x_scale_factor, double y_scale_factor, double z_scale_factor) |
static const ON_Xform | ShearTransformation (const ON_Plane &plane, const ON_3dVector &x1, const ON_3dVector &y1, const ON_3dVector &z1) |
static const ON_Xform | TextureMapping (const ON_3dVector &offset, const ON_3dVector &repeat, const ON_3dVector &rotation) |
static const ON_Xform | TranslationTransformation (const ON_2dVector &delta) |
Right column is (delta.x, delta.y, 0, 1). More... | |
static const ON_Xform | TranslationTransformation (const ON_3dVector &delta) |
Right column is (delta.x, delta.y, delta.z, 1). More... | |
static const ON_Xform | TranslationTransformation (double dx, double dy, double dz) |
Right column is (dx, dy, dz, 1). More... | |
Public Attributes | |
double | m_xform [4][4] |
Static Public Attributes | |
static const ON_Xform | IdentityTransformation |
ON_Xform IdentityTransformation diagonal = (1,1,1,1) More... | |
static const ON_Xform | Nan |
ON_Xform::Nan - every coefficient is ON_DBL_QNAN. More... | |
static const ON_Xform | Unset |
ON_Xform::Unset - every coefficient is ON_UNSET_VALUE. More... | |
static const ON_Xform | Zero4x4 |
ON_Xform::Zero4x4 - every coefficient is 0.0. More... | |
static const ON_Xform | ZeroTransformation |
ON_Xform ZeroTransformation diagonal = (0,0,0,1) More... | |
ON_Xform::ON_Xform | ( | ) |
Default constructor transformation has diagonal (0,0,0,1)
|
default |
|
default |
|
explicit |
Constructs transformation with diagonal (x,x,x,1)
|
explicit |
from standard double m[4][4]
|
explicit |
from standard float m[4][4]
|
explicit |
from array of 16 doubles (row0,row1,row2,row3)
|
explicit |
from array of 16 floats (row0,row1,row2,row3)
|
explicit |
from upper left 4x4 of an
ON_Xform::ON_Xform | ( | const ON_3dPoint & | P, |
const ON_3dVector & | X, | ||
const ON_3dVector & | Y, | ||
const ON_3dVector & | Z | ||
) |
arbitrary matrix. Any missing rows/columns are set to identity.
P | as a frame. |
void ON_Xform::ActOnLeft | ( | double | , |
double | , | ||
double | , | ||
double | , | ||
double | [4] | ||
) | const |
Description: Computes matrix * transpose([x,y,z,w]).
Parameters: x - [in] y - [in] z - [in] z - [in] ans - [out] = matrix * transpose([x,y,z,w])
void ON_Xform::ActOnRight | ( | double | , |
double | , | ||
double | , | ||
double | , | ||
double | [4] | ||
) | const |
Description: Computes [x,y,z,w] * matrix.
Parameters: x - [in] y - [in] z - [in] z - [in] ans - [out] = [x,y,z,w] * matrix
void ON_Xform::Affineize | ( | ) |
Description: Replace last row with 0 0 0 1 discarding any perspective part of this transform
bool ON_Xform::CameraToClip | ( | bool | bIsPerspective, |
double | , | ||
double | , | ||
double | , | ||
double | , | ||
double | , | ||
double | |||
) |
bIsPerspective | maps viewport frustum to -1 <= x,y,z <= 1 box true for perspective, false for orthographic |
void ON_Xform::CameraToWorld | ( | const ON_3dPoint & | , |
const ON_3dVector & | , | ||
const ON_3dVector & | , | ||
const ON_3dVector & | |||
) |
bool ON_Xform::ChangeBasis | ( | const ON_3dPoint & | P0, |
const ON_3dVector & | X0, | ||
const ON_3dVector & | Y0, | ||
const ON_3dVector & | Z0, | ||
const ON_3dPoint & | P1, | ||
const ON_3dVector & | X1, | ||
const ON_3dVector & | Y1, | ||
const ON_3dVector & | Z1 | ||
) |
Parameters: P0 - initial center X0 - initial basis X (X0,Y0,Z0 can be any 3d basis) Y0 - initial basis Y Z0 - initial basis Z P1 - final center X1 - final basis X (X1,Y1,Z1 can be any 3d basis) Y1 - final basis Y Z1 - final basis Z Remarks: Change of basis transformations and rotation transformations are often confused. This is a change of basis transformation. If Q = P0 + a0*X0 + b0*Y0 + c0*Z0 = P1 + a1*X1 + b1*Y1 + c1*Z1 then this transform will map the point (a0,b0,c0) to (a1,b1,c1)
bool ON_Xform::ChangeBasis | ( | const ON_3dVector & | X0, |
const ON_3dVector & | Y0, | ||
const ON_3dVector & | Z0, | ||
const ON_3dVector & | X1, | ||
const ON_3dVector & | Y1, | ||
const ON_3dVector & | Z1 | ||
) |
Description: Get a change of basis transformation. Parameters: X0 - initial basis X (X0,Y0,Z0 can be any 3d basis) Y0 - initial basis Y Z0 - initial basis Z X1 - final basis X (X1,Y1,Z1 can be any 3d basis) Y1 - final basis Y Z1 - final basis Z Remarks: Change of basis transformations and rotation transformations are often confused. This is a change of basis transformation. If Q = a0*X0 + b0*Y0 + c0*Z0 = a1*X1 + b1*Y1 + c1*Z1 then this transform will map the point (a0,b0,c0) to (a1,b1,c1)
Description: The ChangeBasis() function is overloaded and provides several ways to compute a change of basis transformation.
Parameters: plane0 - initial plane plane1 - final plane
Returns: @untitled table true success false vectors for initial frame are not a basis
Remarks: If you have points defined with respect to planes, the version of ChangeBasis() that takes two planes computes the transformation to change coordinates from one plane to another. The predefined world plane ON_world_plane can be used as an argument.
If P = plane0.Evaluate( a0,b0,c0 ) and
(a1,b1,c1) = ChangeBasis(plane0,plane1)*ON_3dPoint(a0,b0,c0),
then P = plane1.Evaluate( a1, b1, c1 )
The version of ChangeBasis() that takes six vectors maps (a0,b0,c0) to (a1,b1,c1) where a0*X0 + b0*Y0 + c0*Z0 = a1*X1 + b1*Y1 + c1*Z1
The version of ChangeBasis() that takes six vectors with center points maps (a0,b0,c0) to (a1,b1,c1) where P0 + a0*X0 + b0*Y0 + c0*Z0 = P1 + a1*X1 + b1*Y1 + c1*Z1
The change of basis transformation is not the same as the rotation transformation that rotates one orthonormal frame to another. See ON_Xform::Rotation().
int ON_Xform::ClipFlag3d | ( | const double * | ) | const |
Description: Computes 3d point clipping flags and returns an int with bits set to indicate if the point is outside of the clipping box.
Parameters: point - [in] 3d clipping coordinate point
Returns:
@table
bit point location 1 x < -1 2 x > +1 4 y < -1 8 y > +1 16 z < -1 32 z > +1
int ON_Xform::ClipFlag3d | ( | int | , |
int | , | ||
const double * | , | ||
bool | bTestZ = true |
||
) | const |
Parameters: count - [in] number of 3d points stride - [in] (>=3) points - [in] 3d clipping coordinate points (array of stride*count doubles) bTestZ - [in] (default=true) if false, do not test "z" coordinate
bTestZ | bTestZ |
int ON_Xform::ClipFlag3dBox | ( | const double * | , |
const double * | |||
) | const |
Description: Computes 3d clipping flags for a 3d bounding box and returns an int with bits set to indicate if the bounding box is outside of the clipping box.
Parameters: boxmin - [in] 3d boxmin corner boxmax - [in] 3d boxmax corner
Returns:
@table
bit box location 1 boxmax x < -1 2 boxmin x > +1 4 boxmax y < -1 8 boxmin y > +1 16 boxmax z < -1 32 boxmin z > +1
int ON_Xform::ClipFlag4d | ( | const double * | ) | const |
Description: Computes homogeneous point clipping flags and returns an int with bits set to indicate if the point is outside of the clipping box.
Parameters: point - [in] 4d homogeneous clipping coordinate point
Returns:
@table
bit point location 1 x/w < -1 2 x/w > +1 4 y/w < -1 8 y/w > +1 16 z/w < -1 32 z/w > +1
int ON_Xform::ClipFlag4d | ( | int | , |
int | , | ||
const double * | , | ||
bool | bTestZ = true |
||
) | const |
Parameters: count - [in] number of 4d points stride - [in] (>=4) points - [in] 4d clipping coordinate points (array of stride*count doubles) bTestZ - [in] (default=true) if false, do not test "z" coordinate
bTestZ | bTestZ |
bool ON_Xform::ClipToCamera | ( | bool | bIsPerspective, |
double | , | ||
double | , | ||
double | , | ||
double | , | ||
double | , | ||
double | |||
) |
maps -1 <= x,y,z <= 1 box to viewport frustum
bIsPerspective | true for perspective, false for orthographic |
bool ON_Xform::ClipToScreen | ( | double | , |
double | , | ||
double | , | ||
double | , | ||
double | , | ||
double | |||
) |
Computes transform that maps the clipping box
-1<x<1,-1<y<1,-1<z<1
to the screen box
(left,right) X (bottom,top) X (near,far)
int ON_Xform::Compare | ( | const ON_Xform & | other | ) | const |
Description: Well ordered dictionary compare that is nan aware.
ON__UINT32 ON_Xform::CRC32 | ( | ON__UINT32 | current_remainder | ) | const |
bool ON_Xform::DecomposeAffine | ( | ON_3dVector & | Translation, |
ON_Xform & | Linear | ||
) | const |
bool ON_Xform::DecomposeAffine | ( | ON_3dVector & | Translation, |
ON_Xform & | Rotation, | ||
ON_Xform & | OrthBasis, | ||
ON_3dVector & | Diagonal | ||
) | const |
Description: An affine transformation can be decomposed into a Symmetric, Rotation and Translation. Then the Symmetric component may be further decomposed as non-uniform scale in an orthonormal coordinate system.
Parameters: this - must be IsAffine(). Translation-[out] Translation vector Rotation - [out] Proper Rotation transformation OrthBasis - [out] Orthogonal Basis Diagonal - [out] diagonal elements of a DiagonalTransformation Details: DecomposeAffine(T,R,Q,diag) (*this) == TranslationTransformation(T) * R * Q * DiagonalTransformation(diag) * Q.Transpose() Returns: true if decomposition succeeds
bool ON_Xform::DecomposeAffine | ( | ON_Xform & | Linear, |
ON_3dVector & | Translation | ||
) | const |
int ON_Xform::DecomposeRigid | ( | ON_3dVector & | Translation, |
ON_Xform & | Rotation, | ||
double | tolerance = ON_ZERO_TOLERANCE |
||
) | const |
Description: A rigid transformation preserves distances and orientation and can be broken into a proper rotation and a translation. An isometry transformation preserves distance and may include a reflection. Parameters: this - must be IsAffine(). Translation - [out] Translation vector Rotation - [out] Proper Rotation transformation, ie. R*Transpose(R)=I and det(R)=1 Details: If X.DecomposeRigid(T, R) is 1 then X ~ TranslationTransformation(T)*R -1 X ~ ON_Xform(-1) *TranslationTransformation(T)*R where ~ means approximates to within tolerance. DecomposeRigid will find the closest rotation to the linear part of this transformation. Returns: +1: This transformation is an rigid transformation. -1: This transformation is an orientation reversing isometry. 0 : This transformation is not an orthogonal transformation.
int ON_Xform::DecomposeSimilarity | ( | ON_3dVector & | Translation, |
double & | dilation, | ||
ON_Xform & | Rotation, | ||
double | tolerance | ||
) | const |
bool ON_Xform::DecomposeSymmetric | ( | ON_Xform & | Q, |
ON_3dVector & | diagonal | ||
) | const |
Description: A Symmetric linear transformation can be decomposed A = Q * Diag * Q^T where Diag is a diagonal transformation. Diag[i][i] is an eigenvalue of A and the i-th column of Q is a corresponding unit length eigenvector. Parameters: This transformation must be Linear() and Symmetric, that is *this==Transpose(). Q -[out] is set to an orthonormal matrix of eigenvectors when true is returned. diagonal -[out] is set to a vector of eigenvalues when true is returned. Details: If success then *this== Q*DiagonalTransformation(diagonal) * QT, where QT == Q.Transpose(). If L.IsLinear() and LT==L.Transpose() then LT*L is symmetric and is a common source of symmetric transformations. Return: true if success.
void ON_Xform::DecomposeTextureMapping | ( | ON_3dVector & | offset, |
ON_3dVector & | repeat, | ||
ON_3dVector & | rotation | ||
) | const |
Convert an ON_Xform into the offset, repeat and rotation values used in ON_Texture and similar classes.
double ON_Xform::Determinant | ( | double * | minimum_pivot = nullptr | ) | const |
If you need a slow and accurate determinant, this is the function to call. If you need a fast sign check, used SignOfDeterminant(true).
minimum_pivot | If not nullptr, returns the minimum pivot |
void ON_Xform::Diagonal | ( | double | d | ) |
|
static |
Returns: Transformation with diagonal (d0,d1,d2,1.0).
|
static |
Returns: Transformation with diagonal (d,d,d,1).
|
static |
Returns: Transformation with diagonal (d0,d1,d2,1.0).
bool ON_Xform::GetEulerZYZ | ( | double & | alpha, |
double & | beta, | ||
double & | gamma | ||
) | const |
Description: Find the Euler angles for a rotation transformation. Parameters: alpha - angle (in radians) to rotate about the Z axis beta - angle (in radians) to rotate about the Y axis gamma - angle (in radians) to rotate about the Z axis Details: When true is returned. this = RotationZYZ(alpha, beta, gamma) = R_z( alpha) * R_y(beta) * R_z(gamma) where R_*(angle) is rotation of angle radians about the corresponding *-world coordinate axis. Returns false if this is not a rotation. Notes: alpha and gamma are in the range (-pi, pi] while beta in in the range [0, pi]
bool ON_Xform::GetKMLOrientationAnglesDegrees | ( | double & | heading_degrees, |
double & | tilt_degrees, | ||
double & | roll_degrees | ||
) | const |
Description: Find the Keyhole Markup Language (KML) orientation angles (in degrees) of a rotation transformation that maps model (east,north,up) to ((1,0,0),(0,1,0),(0,0,1)). KML Earth Z axis = up, KML Earth X axis = east, KML Earth Y axis = north. NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. This is rotation direction is opposite the conventional "right hand rule." Parameters: heading_degrees - [out] angle (in degrees) of rotation around KML Earth Z axis (Earth up). NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. This is rotation direction is opposite the conventional "right hand rule." tilt_degrees - [out] angle (in degrees) of rotation around KML Earth X axis (Earth east). NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. This is rotation direction is opposite the conventional "right hand rule." roll_degrees - [out] angle (in degrees) of rotation around KML Earth Y axis (Earth north). NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. This is rotation direction is opposite the conventional "right hand rule." Returns: True if this transformation is a rotation and the KML angles are returned. False if this transformation is not a rotation, in which case all returned angle values are ON_DLB_QNAN. See Also: https://developers.google.com/kml/documentation/kmlreference#orientation
bool ON_Xform::GetKMLOrientationAnglesRadians | ( | double & | heading_radians, |
double & | tilt_radians, | ||
double & | roll_radians | ||
) | const |
Description: Find the Keyhole Markup Language (KML) orientation angles (in radians) of a rotation transformation that maps model (east,north,up) to ((1,0,0),(0,1,0),(0,0,1)). KML Earth Z axis = up, KML Earth X axis = east, KML Earth Y axis = north. NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. This is rotation direction is opposite the conventional "right hand rule." Parameters: heading_radians - [out] angle (in radians) of rotation around KML Earth Z axis (Earth up). NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. This is rotation direction is opposite the conventional "right hand rule." tilt_radians - [out] angle (in radians) of rotation around KML Earth X axis (Earth east). NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. This is rotation direction is opposite the conventional "right hand rule." roll_radians - [out] angle (in radians) of rotation around KML Earth Y axis (Earth north). NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. This is rotation direction is opposite the conventional "right hand rule." Returns: True if this transformation is a rotation and the KML angles are returned. False if this transformation is not a rotation, in which case all returned angle values are ON_DLB_QNAN. See Also: https://developers.google.com/kml/documentation/kmlreference#orientation
Description: If a texture mapping is applied to an object, the object is subsequently transformed by T, and the texture mapping needs to be recalculated, then two transforms are required to recalculate the texture mapping. Parameters: P_xform - [out] Transform to apply to points before applying the texture mapping transformation. N_xform - [out] Transform to apply to surface normals before applying the texture mapping transformation. Returns: The determinant of the "this" transformation. If non-zero, "this" is invertible and P_xform and N_xform were calculated. False if "this" is not invertible, in which case the returned P_xform and N_xform are the identity.
bool ON_Xform::GetQuaternion | ( | ON_Quaternion & | Q | ) | const |
Description: If *this is a proper rotation then find the equivalent quaternion.
Parameters: Q - [out] Quaternion that represents this rotation transformation Returns: True - if *this is a proper rotation
double ON_Xform::GetSurfaceNormalXform | ( | ON_Xform & | N_xform | ) | const |
Description: When transforming 3d point and surface or mesh normals two different transforms must be used. If P_xform transforms the point, then the inverse transpose of P_xform must be used to transform normal vectors. Parameters: N_xform - [out] Returns: The determinant of the transformation. If non-zero, "this" is invertible and N_xform can be calculated. False if "this" is not invertible, in which case the returned N_xform = this with the right hand column and bottom row zeroed out.
double ON_Xform::GetSurfaceNormalXformKeepLengthAndOrientation | ( | ON_Xform & | N_xform | ) | const |
Description: When transforming 3d point and surface or mesh normals two different transforms must be used. If P_xform transforms the point, then N_xform, the transformation that transforms unit-length and oriented normals of the face to unit-length and oriented normals of the transformed face is:
N_xform = (IsOrientationPreserving() >= 0 ? 1 : -1) * pow(Determinant(), -1/3) * Transpose(Inverse(P_xform)) Parameters: N_xform - [out] Returns: The determinant of the transformation. If non-zero, "this" is invertible and N_xform can be calculated. False if "this" is not invertible, in which case the returned N_xform = this with the right hand column and bottom row zeroed out.
bool ON_Xform::GetYawPitchRoll | ( | double & | yaw, |
double & | pitch, | ||
double & | roll | ||
) | const |
Description: Find the Tait-Byran angles (also loosely called Euler angles) for a rotation transformation. Parameters: yaw - angle (in radians) to rotate about the Z axis pitch - angle (in radians) to rotate about the Y axis roll - angle (in radians) to rotate about the X axis Details: When true is returned.
this = RotationZYX(yaw, pitch, roll) = R_z( yaw) * R_y(pitch) * R_x(roll) where R_*(angle) is rotation of angle radians about the corresponding world coordinate axis. Returns false if this is not a rotation. Notes: roll and yaw are in the range (-pi, pi] and pitch is in [-pi/2, pi/2]
const ON_SHA1_Hash ON_Xform::Hash | ( | ) | const |
void ON_Xform::Identity | ( | ) |
standard transformations
diagonal is (1,1,1,1)
bool ON_Xform::IntervalChange | ( | int | dir, |
ON_Interval | old_interval, | ||
ON_Interval | new_interval | ||
) |
Description: Calculates the transformation that linearly maps old_interval to new_interval. Parameters: dir - [in] 0 = x, 1 = y, 2= z; old_interval - [in] new_interval - [in]
ON_Xform ON_Xform::Inverse | ( | double * | = nullptr | ) | const |
bool ON_Xform::Invert | ( | double * | = nullptr | ) |
bool ON_Xform::IsAffine | ( | ) | const |
Description: A transformation is affine if it is valid and its last row is 0 0 0 1 If in addition its last column is ( 0, 0, 0, 1)^T then it is linear. An affine transformation can be broken into a linear transformation and a translation. Parameters: this - IsAffine() must be true for DecomposeAffine(..) to succeed Translation - [out] Translation vector Linear - [out] Linear transformation Example: A perspective transformation is not affine. Details: If X.DecomposeAffine(T, L) is true then X == TranslationTransformation(T)*L If X.DecomposeAffine(L, T) is true then X == L* TranslationTransformation(T). Note: DecomposeAffine(T,L) succeeds for all affine transformations and is a simple copying of values. DecomposeAffine(L, T), on the otherhand, may fail for affine transformations if L is not invertible and is more computationally expensive. Returns: True - if successful decomposition
bool ON_Xform::IsIdentity | ( | double | zero_tolerance = 0.0 | ) | const |
Returns: true if matrix is the identity transformation
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
Remarks: An element of the matrix is "zero" if fabs(x) <= zero_tolerance. An element of the matrix is "one" if fabs(1.0-x) <= zero_tolerance. If the matrix contains a nan, false is returned.
bool ON_Xform::IsLinear | ( | ) | const |
bool ON_Xform::IsNan | ( | ) | const |
Description: Test the entries of the transformation matrix to see if they are valid number. Returns: True if any coefficient in the transformation matrix is a nan.
bool ON_Xform::IsNotIdentity | ( | double | zero_tolerance = 0.0 | ) | const |
Returns: true if the matrix is valid and is not the identity transformation Remarks: An element of the matrix is "zero" if fabs(x) <= zero_tolerance. An element of the matrix is "one" if fabs(1.0-x) <= zero_tolerance. If the matrix contains a nan, false is returned.
int ON_Xform::IsRigid | ( | double | tolerance = ON_ZERO_TOLERANCE | ) | const |
Description: NOTE: A better name for this function would be IsIsometry().
An "isometry" transformation is an affine transformation that preserves distances. Isometries include transformation like reflections that reverse orientation.
A "rigid" transformation is an isometry that preserves orientation and can be broken into a proper rotation and a translation.
Returns: +1: This transformation is an orientation preserving isometry transformation ("rigid and determinant = 1). -1: This transformation is an orientation reversing isometry (determinant = -1). 0 : This transformation is not an orthogonal transformation.
bool ON_Xform::IsRotation | ( | ) | const |
true if this is a proper rotation.
int ON_Xform::IsSimilarity | ( | ) | const |
Description: A similarity transformation can be broken into a sequence of a dilation, translation, rotation, and a reflection. Parameters: this - must be IsAffine(). Translation - [out] Translation vector dilation - [out] dilation, (dilation <0 iff this is an orientation reversing similarity ) Rotation - [out] a proper rotation transformation ie. R*Transpose(R)=I and det(R)=1 Details: If X.DecomposeSimilarity(T, d, R, tol) !=0 then X ~ TranslationTransformation(T)*DiagonalTransformation(d)*R note when d>0 the transformation is orientation preserving. Note: If dilation<0 then DiagonalTransformation(dilation) is actually a reflection combined with a "true" dilation, i.e. DiagonalTransformation(dilation) = DiagonalTransformation(-1) * DiagonalTransformation( |diagonal| ) Returns: +1: This transformation is an orientation preserving similarity. -1: This transformation is an orientation reversing similarity. 0: This transformation is not a similarity.
int ON_Xform::IsSimilarity | ( | double | tolerance | ) | const |
bool ON_Xform::IsTranslation | ( | double | zero_tolerance = 0.0 | ) | const |
Returns: true if matrix is a pure translation
1 0 0 dx 0 1 0 dy 0 0 1 dz 0 0 0 1
Remarks: The test for zero is fabs(x) <= zero_tolerance. The test for one is fabs(x-1) <= zero_tolerance.
bool ON_Xform::IsValid | ( | ) | const |
Description: Test the entries of the transformation matrix to see if they are valid number. Returns: True if ON_IsValid() is true for every coefficient in the transformation matrix.
bool ON_Xform::IsValidAndNotZeroAndNotIdentity | ( | double | zero_tolerance = 0.0 | ) | const |
bool ON_Xform::IsZero | ( | ) | const |
Returns: true if matrix is ON_Xform::Zero4x4, ON_Xform::ZeroTransformation, or some other type of zero. The value xform[3][3] can be anything. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *
bool ON_Xform::IsZero4x4 | ( | ) | const |
Returns: true if matrix is ON_Xform::Zero4x4 The value xform[3][3] must be zero. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
bool ON_Xform::IsZero4x4 | ( | double | zero_tolerance | ) | const |
Returns: true if matrix is ON_Xform::Zero4x4 The value xform[3][3] must be zero. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
bool ON_Xform::IsZeroTransformation | ( | ) | const |
Returns: true if matrix is ON_Xform::ZeroTransformation The value xform[3][3] must be 1. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 An element of the matrix is "zero" if fabs(x) <= zero_tolerance. IsZeroTransformation() is the same as IsZeroTransformation( 0.0 );
bool ON_Xform::IsZeroTransformation | ( | double | zero_tolerance | ) | const |
void ON_Xform::Linearize | ( | ) |
Description: Affineize() and replace last column with (0 0 0 1)^T discarding any translation part of this transform.
void ON_Xform::Mirror | ( | ON_3dPoint | point_on_mirror_plane, |
ON_3dVector | normal_to_mirror_plane | ||
) |
Description: Create mirror transformation matrix. Parameters: point_on_mirror_plane - [in] point on mirror plane normal_to_mirror_plane - [in] normal to mirror plane Remarks: The mirror transform maps a point Q to Q - (2*(Q-P)oN)*N, where P = point_on_mirror_plane and N = normal_to_mirror_plane.
|
static |
bool ON_Xform::operator!= | ( | const ON_Xform & | rhs | ) | const |
ON_2dPoint ON_Xform::operator* | ( | const ON_2dPoint & | ) | const |
arbitrary matrix. Any missing rows/columns are set to identity. All non-commutative operations have "this" as left hand side and argument as right hand side. Note well: The right hand column and bottom row have an important effect when transforming a Euclidean point and have no effect when transforming a vector. Be sure you understand the differences between vectors and points when applying a 4x4 transformation.
ON_2dVector ON_Xform::operator* | ( | const ON_2dVector & | ) | const |
Note well: The right hand column and bottom row have an important effect when transforming a Euclidean point and have no effect when transforming a vector. Be sure you understand the differences between vectors and points when applying a 4x4 transformation.
ON_3dPoint ON_Xform::operator* | ( | const ON_3dPoint & | ) | const |
ON_3dVector ON_Xform::operator* | ( | const ON_3dVector & | ) | const |
ON_4dPoint ON_Xform::operator* | ( | const ON_4dPoint & | ) | const |
xform = scalar results in a diagonal 3x3 with bottom row = 0,0,0,1
from upper left 4x4 of an
bool ON_Xform::operator== | ( | const ON_Xform & | rhs | ) | const |
double* ON_Xform::operator[] | ( | int | ) |
const double* ON_Xform::operator[] | ( | int | ) | const |
bool ON_Xform::Orthogonalize | ( | double | tol | ) |
Description: Force the linear part of this transformation to be a rotation (or a rotation with reflection). This is probably best to perform minute tweaks. Use DecomposeRigid(T,R) to find the nearest rotation
void ON_Xform::PlanarProjection | ( | const ON_Plane & | plane | ) |
Description: Get transformation that projects to a plane Parameters: plane - [in] plane to project to Remarks: This transformation maps a 3d point P to the point plane.ClosestPointTo(Q).
int ON_Xform::Rank | ( | double * | = nullptr | ) | const |
void ON_Xform::Rotation | ( | const ON_3dPoint & | P0, |
const ON_3dVector & | X0, | ||
const ON_3dVector & | Y0, | ||
const ON_3dVector & | Z0, | ||
const ON_3dPoint & | P1, | ||
const ON_3dVector & | X1, | ||
const ON_3dVector & | Y1, | ||
const ON_3dVector & | Z1 | ||
) |
Parameters: P0 - initial frame center X0 - initial frame X Y0 - initial frame Y Z0 - initial frame Z P1 - initial frame center X1 - final frame X Y1 - final frame Y Z1 - final frame Z
void ON_Xform::Rotation | ( | const ON_3dVector & | X0, |
const ON_3dVector & | Y0, | ||
const ON_3dVector & | Z0, | ||
const ON_3dVector & | X1, | ||
const ON_3dVector & | Y1, | ||
const ON_3dVector & | Z1 | ||
) |
Parameters: X0 - initial frame X Y0 - initial frame Y Z0 - initial frame Z X1 - final frame X Y1 - final frame Y Z1 - final frame Z
Description: Create rotation transformation that maps plane0 to plane1. Parameters: plane0 - [in] plane1 - [in]
void ON_Xform::Rotation | ( | double | angle_radians, |
ON_3dVector | rotation_axis, | ||
ON_3dPoint | rotation_center | ||
) |
Parameters: angle - rotation angle in radians rotation_axis - 3d unit axis of rotation rotation_center - 3d center of rotation
void ON_Xform::Rotation | ( | double | sin_angle, |
double | cos_angle, | ||
ON_3dVector | rotation_axis, | ||
ON_3dPoint | rotation_center | ||
) |
Description: The Rotation() function is overloaded and provides several ways to compute a rotation transformation. A positive rotation angle indicates a counter-clockwise (right hand rule) rotation about the axis of rotation.
Parameters: sin_angle - sin(rotation angle) cos_angle - cos(rotation angle) rotation_axis - 3d unit axis of rotation rotation_center - 3d center of rotation
Remarks: In the overloads that take frames, the frames should be right hand orthonormal frames (unit vectors with Z = X x Y).
The resulting rotation fixes the origin (0,0,0), maps initial X to final X, initial Y to final Y, and initial Z to final Z.
In the overload that takes frames with center points, if the initial and final center are equal, then that center point is the fixed point of the rotation. If the initial and final point differ, then the resulting transform is the composition of a rotation fixing P0 and translation from P0 to P1. The resulting transformation maps P0 to P1, P0+X0 to P1+X1, ...
The rotation transformations that map frames to frames are not the same as the change of basis transformations for those frames. See ON_Xform::ChangeBasis().
void ON_Xform::Rotation | ( | ON_3dVector | start_dir, |
ON_3dVector | end_dir, | ||
ON_3dPoint | rotation_center | ||
) |
Description: Calculate the minimal transformation that rotates start_dir to end_dir while fixing rotation_center.
|
static |
Description: Get a rotation transformation from the Keyhole Markup Language (KML) orientation angles in degrees. (KML Earth Z axis = up, KML Earth X axis = east, KML Earth Y axis = north). KML rotations are applied in the following order: first roll, second tilt, third heading. NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. This is rotation direction is opposite the conventional "right hand rule." Parameters: heading_degrees - [in] angle (in degrees) of rotation around KML Earth Z axis (Earth up). NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. If R = RotationTransformationFromKMLAnglesDegrees(90,0,0), then R*(1,0,0) = (0,-1,0), R*(0,1,0) = (1,0,0), R*(0,0,1) = (0,0,1) tilt_degrees - [in] angle (in degrees) of rotation around KML Earth X axis (Earth east). NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. If R = RotationTransformationFromKMLAnglesDegrees(0,90,0), then R*(1,0,0) = (1,0,0), R*(0,1,0) = (0,0,-1), R*(0,0,1) = (0,1,0) roll_degrees - [in] angle (in degrees) of rotation around KML Earth Y axis (Earth north). NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. If R = RotationTransformationFromKMLAnglesDegrees(0,0,90), then R*(1,0,0) = (0,0,1), R*(0,1,0) = (0,1,0), R*(0,0,1) = (-1,0,0) Returns: If the input is valid, the rotation transformation is returned. Otherwise the ON_Xform::Nan is returned. See Also: https://developers.google.com/kml/documentation/kmlreference#orientation
|
static |
Description: Get a rotation transformation from the Keyhole Markup Language (KML) orientation angles in radians. (KML Earth Z axis = up, KML Earth X axis = east, KML Earth Y axis = north). KML rotations are applied in the following order: first roll, second tilt, third heading. NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. This is rotation direction is opposite the conventional "right hand rule." Parameters: heading_radians - [in] angle (in radians) of rotation around KML Earth Z axis (Earth up). NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. If R = RotationTransformationFromKMLAnglesRadians(pi/2,0,0), then R*(1,0,0) = (0,-1,0), R*(0,1,0) = (1,0,0), R*(0,0,1) = (0,0,1) tilt_radians - [in] angle (in radians) of rotation around KML Earth X axis (Earth east). NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. If R = RotationTransformationFromKMLAnglesRadians(0,pi/2,0), then R*(1,0,0) = (1,0,0), R*(0,1,0) = (0,0,-1), R*(0,0,1) = (0,1,0) roll_radians - [in] angle (in radians) of rotation around KML Earth Y axis (Earth north). NOTE WELL: In KML, positive rotations are CLOCKWISE looking down specified axis vector towards the origin. If R = RotationTransformationFromKMLAnglesRadians(0,0,pi/2), then R*(1,0,0) = (0,0,1), R*(0,1,0) = (0,1,0), R*(0,0,1) = (-1,0,0) Returns: If the input is valid, the rotation transformation is returned. Otherwise the ON_Xform::Nan is returned. See Also: https://developers.google.com/kml/documentation/kmlreference#orientation
void ON_Xform::RotationZYX | ( | double | yaw, |
double | pitch, | ||
double | roll | ||
) |
Description: Create rotation transformation From Tait-Byran angles (also loosely known as Euler angles). Parameters: yaw - angle (in radians) to rotate about the Z axis pitch - angle (in radians) to rotate about the Y axis roll - angle (in radians) to rotate about the X axis Details: RotationZYX(yaw, pitch, roll) = R_z( yaw) * R_y(pitch) * R_x(roll) where R_*(angle) is rotation of angle radians about the corresponding world coordinate axis.
void ON_Xform::RotationZYZ | ( | double | alpha, |
double | beta, | ||
double | gamma | ||
) |
Description: Create rotation transformation From Euler angles. Parameters: alpha - angle (in radians) to rotate about the Z axis beta - angle (in radians) to rotate about the Y axis gamma - angle (in radians) to rotate about the Z axis Details: RotationZYZ(alpha, beta, gamma) = R_z( alpha) * R_y(beta) * R_z(gamma) where R_*(angle) is rotation of angle radians about the corresponding *-world coordinate axis.
void ON_Xform::Scale | ( | const ON_3dVector & | scale_vector | ) |
Description: Create non-uniform scale transformation with the origin as the fixed point. Parameters: fixed_point - [in] scale_vector - [in] Remarks: The diagonal is (scale_vector.x, scale_vector.y, scale_vector.z, 1)
void ON_Xform::Scale | ( | const ON_Plane & | plane, |
double | x_scale_factor, | ||
double | y_scale_factor, | ||
double | z_scale_factor | ||
) |
Description: Create non-uniform scale transformation with a specified fixed point. Parameters: plane - [in] plane.origin is the fixed point x_scale_factor - [in] plane.xaxis scale factor y_scale_factor - [in] plane.yaxis scale factor z_scale_factor - [in] plane.zaxis scale factor
void ON_Xform::Scale | ( | double | x_scale_factor, |
double | y_scale_factor, | ||
double | z_scale_factor | ||
) |
Description: Create non-uniform scale transformation with the origin as a fixed point. Parameters: fixed_point - [in] x_scale_factor - [in] y_scale_factor - [in] z_scale_factor - [in] Remarks: The diagonal is (x_scale_factor, y_scale_factor, z_scale_factor, 1)
void ON_Xform::Scale | ( | ON_3dPoint | fixed_point, |
double | scale_factor | ||
) |
Description: Create uniform scale transformation with a specified fixed point. Parameters: fixed_point - [in] scale_factor - [in]
|
static |
|
static |
|
static |
Description: Create non-uniform scale transformation with a specified fixed point. Parameters: plane - [in] plane.origin is the fixed point x_scale_factor - [in] plane.xaxis scale factor y_scale_factor - [in] plane.yaxis scale factor z_scale_factor - [in] plane.zaxis scale factor
bool ON_Xform::ScreenToClip | ( | double | , |
double | , | ||
double | , | ||
double | , | ||
double | , | ||
double | |||
) |
Computes transform that maps the screen box
(left,right) X (bottom,top) X (near,far)
to the clipping box
-1<x<1,-1<y<1,-1<z<1
void ON_Xform::Shear | ( | const ON_Plane & | plane, |
const ON_3dVector & | x1, | ||
const ON_3dVector & | y1, | ||
const ON_3dVector & | z1 | ||
) |
|
static |
Description: Create shear transformation. Parameters: plane - [in] plane.origin is the fixed point x1 - [in] plane.xaxis scale factor y1 - [in] plane.yaxis scale factor z1 - [in] plane.zaxis scale factor
int ON_Xform::SignOfDeterminant | ( | bool | bFastTest | ) | const |
Quickly determine the sign of the determinant. Definitely good enough for graphics code.
bFastTest | When in double, pass true. If you need a fast answer and can tolerate extremely rare wrong answers, pass true. True definitely works for all common matrices used to transform 3d objects and all common view projection matrices. |
|
static |
void ON_Xform::Translation | ( | const ON_3dVector & | delta | ) |
void ON_Xform::Translation | ( | double | dx, |
double | dy, | ||
double | dz | ||
) |
|
static |
Right column is (delta.x, delta.y, 0, 1).
|
static |
Right column is (delta.x, delta.y, delta.z, 1).
|
static |
Right column is (dx, dy, dz, 1).
void ON_Xform::Transpose | ( | ) |
matrix operations
transposes 4x4 matrix
void ON_Xform::WorldToCamera | ( | const ON_3dPoint & | , |
const ON_3dVector & | , | ||
const ON_3dVector & | , | ||
const ON_3dVector & | |||
) |
standard viewing transformations
|
static |
ON_Xform IdentityTransformation diagonal = (1,1,1,1)
double ON_Xform::m_xform[4][4] |
[i][j] = row i, column j. I.e.,
[0][0] [0][1] [0][2] [0][3] [1][0] [1][1] [1][2] [1][3] [2][0] [2][1] [2][2] [2][3] [3][0] [3][1] [3][2] [3][3]
|
static |
ON_Xform::Nan - every coefficient is ON_DBL_QNAN.
|
static |
ON_Xform::Unset - every coefficient is ON_UNSET_VALUE.
|
static |
ON_Xform::Zero4x4 - every coefficient is 0.0.