openNURBS SDK Help  6.0
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ON_Xform Class Reference

#include <opennurbs_xform.h>

Public Member Functions

 ON_Xform ()
 Default constructor transformation has diagonal (0,0,0,1) More...
 
 ON_Xform (const ON_Xform &)=default
 
 ON_Xform (double x)
 Constructs transformation with diagonal (x,x,x,1) More...
 
 ON_Xform (const double[4][4])
 from standard double m[4][4] More...
 
 ON_Xform (const float[4][4])
 from standard float m[4][4] More...
 
 ON_Xform (const double *)
 from array of 16 doubles (row0,row1,row2,row3) More...
 
 ON_Xform (const float *)
 from array of 16 floats (row0,row1,row2,row3) More...
 
 ON_Xform (const ON_Matrix &)
 
 ON_Xform (const ON_3dPoint &P, const ON_3dVector &X, const ON_3dVector &Y, const ON_3dVector &Z)
 
 ~ON_Xform ()=default
 
void ActOnLeft (double, double, double, double, double[4]) const
 
void ActOnRight (double, double, double, double, double[4]) const
 
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_Plane &plane0, const ON_Plane &plane1)
 
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_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)
 
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
 
double Determinant (double *=nullptr) const
 
void Diagonal (double d)
 
double GetMappingXforms (ON_Xform &P_xform, ON_Xform &N_xform) const
 
double GetSurfaceNormalXform (ON_Xform &N_xform) 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 IsNan () const
 
bool IsNotIdentity (double zero_tolerance=0.0) const
 
int IsSimilarity () 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 IsZeroTransformation () const
 
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_3dPoint operator* (const ON_3dPoint &) const
 
ON_4dPoint operator* (const ON_4dPoint &) const
 
ON_2dVector operator* (const ON_2dVector &) const
 
ON_3dVector operator* (const ON_3dVector &) const
 
ON_Xform operator* (const ON_Xform &) const
 
ON_Xform operator+ (const ON_Xform &) const
 
ON_Xform operator- (const ON_Xform &) const
 
ON_Xformoperator= (const ON_Xform &)=default
 
ON_Xformoperator= (const ON_Matrix &)
 xform = scalar results in a diagonal 3x3 with bottom row = 0,0,0,1 More...
 
bool operator== (const ON_Xform &rhs) const
 
double * operator[] (int)
 
const double * operator[] (int) const
 
void PlanarProjection (const ON_Plane &plane)
 
int Rank (double *=nullptr) const
 
void Rotation (double sin_angle, double cos_angle, ON_3dVector rotation_axis, ON_3dPoint rotation_center)
 
void Rotation (double angle_radians, ON_3dVector rotation_axis, ON_3dPoint rotation_center)
 
void Rotation (ON_3dVector start_dir, ON_3dVector end_dir, ON_3dPoint rotation_center)
 
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_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_Plane &plane0, const ON_Plane &plane1)
 
void Scale (double x_scale_factor, double y_scale_factor, double z_scale_factor)
 
void Scale (const ON_3dVector &scale_vector)
 
void Scale (ON_3dPoint fixed_point, double scale_factor)
 
void Scale (const ON_Plane &plane, double x_scale_factor, double y_scale_factor, double z_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)
 
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 (double d)
 
static const ON_Xform DiagonalTransformation (double d0, double d1, double d2)
 
static const ON_Xform DiagonalTransformation (const ON_3dVector &diagnoal)
 
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 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...
 

Constructor & Destructor Documentation

◆ ON_Xform() [1/9]

ON_Xform::ON_Xform ( )

Default constructor transformation has diagonal (0,0,0,1)

◆ ~ON_Xform()

ON_Xform::~ON_Xform ( )
default

◆ ON_Xform() [2/9]

ON_Xform::ON_Xform ( const ON_Xform )
default

◆ ON_Xform() [3/9]

ON_Xform::ON_Xform ( double  x)
explicit

Constructs transformation with diagonal (x,x,x,1)

◆ ON_Xform() [4/9]

ON_Xform::ON_Xform ( const double  [4][4])
explicit

from standard double m[4][4]

◆ ON_Xform() [5/9]

ON_Xform::ON_Xform ( const float  [4][4])
explicit

from standard float m[4][4]

◆ ON_Xform() [6/9]

ON_Xform::ON_Xform ( const double *  )
explicit

from array of 16 doubles (row0,row1,row2,row3)

◆ ON_Xform() [7/9]

ON_Xform::ON_Xform ( const float *  )
explicit

from array of 16 floats (row0,row1,row2,row3)

◆ ON_Xform() [8/9]

ON_Xform::ON_Xform ( const ON_Matrix )
explicit

from upper left 4x4 of an

◆ ON_Xform() [9/9]

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.

Parameters
Pas a frame.

Member Function Documentation

◆ ActOnLeft()

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])

◆ ActOnRight()

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

◆ CameraToClip()

bool ON_Xform::CameraToClip ( bool  bIsPerspective,
double  ,
double  ,
double  ,
double  ,
double  ,
double   
)
Parameters
bIsPerspectivemaps viewport frustum to -1 <= x,y,z <= 1 box true for perspective, false for orthographic

◆ CameraToWorld()

void ON_Xform::CameraToWorld ( const ON_3dPoint ,
const ON_3dVector ,
const ON_3dVector ,
const ON_3dVector  
)

◆ ChangeBasis() [1/3]

bool ON_Xform::ChangeBasis ( const ON_Plane plane0,
const ON_Plane plane1 
)

Description: The ChangeBasis() function is overloaded and provides several ways to compute a change of basis transformation.

Parameters: plane0 - inital plane plane1 - final plane

Returns: 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().

◆ ChangeBasis() [2/3]

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)

◆ ChangeBasis() [3/3]

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)

◆ ClipFlag3d() [1/2]

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: bit point location 1 x < -1 2 x > +1 4 y < -1 8 y > +1 16 z < -1 32 z > +1

◆ ClipFlag3d() [2/2]

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

Parameters
bTestZbTestZ

◆ ClipFlag3dBox()

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: 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

◆ ClipFlag4d() [1/2]

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: 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

◆ ClipFlag4d() [2/2]

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

Parameters
bTestZbTeztZ

◆ ClipToCamera()

bool ON_Xform::ClipToCamera ( bool  bIsPerspective,
double  ,
double  ,
double  ,
double  ,
double  ,
double   
)

maps -1 <= x,y,z <= 1 box to viewport frustum

Parameters
bIsPerspectivetrue for perspective, false for orthographic

◆ ClipToScreen()

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)  

◆ Compare()

int ON_Xform::Compare ( const ON_Xform other) const

Description: Well ordered dictionary compare that is nan aware.

◆ Determinant()

double ON_Xform::Determinant ( double *  = nullptr) const

◆ Diagonal()

void ON_Xform::Diagonal ( double  d)

◆ DiagonalTransformation() [1/3]

static const ON_Xform ON_Xform::DiagonalTransformation ( double  d)
static

Returns: Transformation with diagonal (d,d,d,1).

◆ DiagonalTransformation() [2/3]

static const ON_Xform ON_Xform::DiagonalTransformation ( double  d0,
double  d1,
double  d2 
)
static

Returns: Transformation with diagonal (d0,d1,d2,1.0).

◆ DiagonalTransformation() [3/3]

static const ON_Xform ON_Xform::DiagonalTransformation ( const ON_3dVector diagnoal)
static

Returns: Transformation with diagonal (d0,d1,d2,1.0).

◆ GetMappingXforms()

double ON_Xform::GetMappingXforms ( ON_Xform P_xform,
ON_Xform N_xform 
) const

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 recalcalculate 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 invertable and P_xform and N_xform were calculated. False if "this" is not invertable, in which case the returned P_xform and N_xform are the identity.

◆ GetSurfaceNormalXform()

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 tranform normal vectors. Parameters: N_xform - [out] Returns: The determinant of the transformation. If non-zero, "this" is invertable and N_xform can be calculated. False if "this" is not invertable, in which case the returned N_xform = this with the right hand column and bottom row zeroed out.

◆ Identity()

void ON_Xform::Identity ( )

standard transformations

diagonal is (1,1,1,1)

◆ IntervalChange()

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]

◆ Inverse()

ON_Xform ON_Xform::Inverse ( double *  = nullptr) const

◆ Invert()

bool ON_Xform::Invert ( double *  = nullptr)

◆ IsAffine()

bool ON_Xform::IsAffine ( ) const

Description: A transformation is affine if it is valid and its last row is 0 0 0 1 An affine transformation can be broken into a linear transformation and a translation. Example: A perspective transformation is not affine. Returns: True if this is an affine transformation.

◆ IsIdentity()

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.

◆ IsNan()

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.

◆ IsNotIdentity()

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.

◆ IsSimilarity()

int ON_Xform::IsSimilarity ( ) const

Description: A similarity transformation can be broken into a sequence of dialations, translations, rotations, and reflections. Returns: +1: This transformation is an orientation preserving similarity. -1: This transformation is an orientation reversing similarity. 0: This transformation is not a similarity.

◆ IsTranslation()

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.

◆ IsValid()

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.

◆ IsValidAndNotZeroAndNotIdentity()

bool ON_Xform::IsValidAndNotZeroAndNotIdentity ( double  zero_tolerance = 0.0) const

◆ IsZero()

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 *

◆ IsZero4x4()

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

◆ IsZeroTransformation()

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

◆ Mirror()

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.

◆ operator!=()

bool ON_Xform::operator!= ( const ON_Xform rhs) const

◆ operator*() [1/6]

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.

◆ operator*() [2/6]

ON_3dPoint ON_Xform::operator* ( const ON_3dPoint ) const

◆ operator*() [3/6]

ON_4dPoint ON_Xform::operator* ( const ON_4dPoint ) const

◆ operator*() [4/6]

ON_2dVector ON_Xform::operator* ( const ON_2dVector ) const

◆ operator*() [5/6]

ON_3dVector ON_Xform::operator* ( const ON_3dVector ) const

◆ operator*() [6/6]

ON_Xform ON_Xform::operator* ( const ON_Xform ) const

◆ operator+()

ON_Xform ON_Xform::operator+ ( const ON_Xform ) const

◆ operator-()

ON_Xform ON_Xform::operator- ( const ON_Xform ) const

◆ operator=() [1/2]

ON_Xform& ON_Xform::operator= ( const ON_Xform )
default

◆ operator=() [2/2]

ON_Xform& ON_Xform::operator= ( const ON_Matrix )

xform = scalar results in a diagonal 3x3 with bottom row = 0,0,0,1

from upper left 4x4 of an

◆ operator==()

bool ON_Xform::operator== ( const ON_Xform rhs) const

◆ operator[]() [1/2]

double* ON_Xform::operator[] ( int  )

◆ operator[]() [2/2]

const double* ON_Xform::operator[] ( int  ) const

◆ PlanarProjection()

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 transformaton maps a 3d point P to the point plane.ClosestPointTo(Q).

◆ Rank()

int ON_Xform::Rank ( double *  = nullptr) const

◆ Rotation() [1/6]

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().

◆ Rotation() [2/6]

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

◆ Rotation() [3/6]

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.

◆ Rotation() [4/6]

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

◆ Rotation() [5/6]

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

◆ Rotation() [6/6]

void ON_Xform::Rotation ( const ON_Plane plane0,
const ON_Plane plane1 
)

Description: Create rotation transformation that maps plane0 to plane1. Parameters: plane0 - [in] plane1 - [in]

◆ Scale() [1/4]

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)

◆ Scale() [2/4]

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)

◆ Scale() [3/4]

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]

◆ Scale() [4/4]

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

◆ ScaleTransformation() [1/3]

static const ON_Xform ON_Xform::ScaleTransformation ( const ON_3dPoint fixed_point,
double  scale_factor 
)
static

◆ ScaleTransformation() [2/3]

static const ON_Xform ON_Xform::ScaleTransformation ( const ON_3dPoint fixed_point,
double  x_scale_factor,
double  y_scale_factor,
double  z_scale_factor 
)
static

◆ ScaleTransformation() [3/3]

static const ON_Xform ON_Xform::ScaleTransformation ( const ON_Plane plane,
double  x_scale_factor,
double  y_scale_factor,
double  z_scale_factor 
)
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

◆ ScreenToClip()

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   

◆ Shear()

void ON_Xform::Shear ( const ON_Plane plane,
const ON_3dVector x1,
const ON_3dVector y1,
const ON_3dVector z1 
)

◆ ShearTransformation()

static const ON_Xform ON_Xform::ShearTransformation ( 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

◆ Translation() [1/2]

void ON_Xform::Translation ( const ON_3dVector delta)

◆ Translation() [2/2]

void ON_Xform::Translation ( double  dx,
double  dy,
double  dz 
)

◆ TranslationTransformation() [1/3]

static const ON_Xform ON_Xform::TranslationTransformation ( const ON_2dVector delta)
static

Right column is (delta.x, delta.y, 0, 1).

◆ TranslationTransformation() [2/3]

static const ON_Xform ON_Xform::TranslationTransformation ( const ON_3dVector delta)
static

Right column is (delta.x, delta.y, delta.z, 1).

◆ TranslationTransformation() [3/3]

static const ON_Xform ON_Xform::TranslationTransformation ( double  dx,
double  dy,
double  dz 
)
static

Right column is (dx, dy, dz, 1).

◆ Transpose()

void ON_Xform::Transpose ( )

matrix operations

transposes 4x4 matrix

◆ WorldToCamera()

void ON_Xform::WorldToCamera ( const ON_3dPoint ,
const ON_3dVector ,
const ON_3dVector ,
const ON_3dVector  
)

standard viewing transformations

Member Data Documentation

◆ IdentityTransformation

const ON_Xform ON_Xform::IdentityTransformation
static

ON_Xform IdentityTransformation diagonal = (1,1,1,1)

◆ m_xform

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]  

◆ Nan

const ON_Xform ON_Xform::Nan
static

ON_Xform::Nan - every coefficient is ON_DBL_QNAN.

◆ Unset

const ON_Xform ON_Xform::Unset
static

ON_Xform::Unset - every coefficient is ON_UNSET_VALUE.

◆ Zero4x4

const ON_Xform ON_Xform::Zero4x4
static

ON_Xform::Zero4x4 - every coefficient is 0.0.

◆ ZeroTransformation

const ON_Xform ON_Xform::ZeroTransformation
static

ON_Xform ZeroTransformation diagonal = (0,0,0,1)