Home

SPAtransf Class Reference
[Geometric Atoms]

Represents a general 3D affine transformation. More...

#include <transf.hxx>

Inherited by HH_Trans.

Collaboration diagram for SPAtransf:

Collaboration graph
[legend]

List of all members.

Public Member Functions

SPAmatrix affine () const
 Returns the affine portion of the transformation.
logical compose (const transf_decompose_data &data, logical rotate_xyz_axes)
 Interprets the transf_decompose_data structure as a series of transformations.
void debug (char const *strlead, FILE *fp=debug_file_ptr) const
 Outputs the details of a transform to the specified file.
logical decompose (transf_decompose_data &data) const
 Decomposes a non-degenerate transformation into data that represent a unique sequence of scaling, shearing, rotating, and translating.
logical identity () const
 Queries whether or not the transformation is the identity.
SPAtransf inverse () const
 Returns the inverse transformation.
logical operator!= (SPAtransf const &rhs) const
 Compares two transformations.
SPAtransf const & operator*= (SPAtransf const &t)
 Composes this transformation with another.
logical operator== (SPAtransf const &t) const
 Compares two transformations.
void print () const
 Prints the transform data.
logical reflect () const
 Queries whether or not the transformation is reflecting.
logical rotate () const
 Queries whether or not the transformation has a rotational component.
double scaling () const
 Returns the scaling factor of the transformation.
logical shear () const
 Queries whether or not the transformation has a shearing component.
 SPAtransf (SPAtransf const &t)
 C++ copy constructor requests memory for this object and populates it with the data from the object supplied as an argument.
 SPAtransf ()
 C++ allocation constructor requests memory for this object but does not populate it.
SPAvector translation () const
 Returns the vector representing the translational portion of the transformation.

Friends

SPAtransf coordinate_transf (SPAposition const &new_origin, SPAunit_vector const &new_x_axis, SPAunit_vector const &new_y_axis)
 Constructs a coordinate transformation.
SPAposition operator* (SPAposition const &p, SPAtransf const &t)
 Transforms a position.
SPAunit_vector operator* (SPAunit_vector const &uv, SPAtransf const &t)
 Transforms a unit vector by the rotation matrix in a transformation.
SPAvector operator* (SPAvector const &v, SPAtransf const &t)
 Transforms a vector by an affine transformation.
SPAtransf operator* (SPAtransf const &t1, SPAtransf const *t2)
 Creates the composition of two transforms.
SPAtransf operator* (SPAtransf const &t1, SPAtransf const &t2)
 Creates the composition of two transforms.
SPAtransf reflect_transf (SPAvector const &axis)
 Constructs a transformation corresponding to a reflection through a plane, specified by its normal.
SPAtransf rotate_transf (double angle, SPAvector const &axis)
 Constructs a transformation corresponding to a simple rotation by an angle about a given axis.
SPAtransf scale_transf (double xs, double ys, double zs, double xys, double xzs, double yzs)
 Constructs a transformation that both scales non-uniformly and shears.
SPAtransf scale_transf (double xs, double ys, double zs)
 Constructs a transformation that scales non-uniformly in the x, y, and z directions.
SPAtransf scale_transf (double scale)
 Constructs a transformation that scales uniformly in all directions.
SPAtransf shear_transf (double shearxy, double shearxz, double shearyz)
 Constructs a shear transformation.
SPAtransf translate_transf (SPAvector const &disp)
 Constructs a transformation corresponding to a translation by a given vector.


Detailed Description

Represents a general 3D affine transformation.


Role: This class is used to represent any combination of translations, rotations, reflections, shearing, and scaling. When shearing and/or non-uniform scaling are present, the application of such transforms to an ENTITY makes use of the Space Warping component.

See also:
SPAmatrix, SPAvector, SPAposition

Constructor & Destructor Documentation

SPAtransf::SPAtransf (  ) 

C++ allocation constructor requests memory for this object but does not populate it.

SPAtransf::SPAtransf ( SPAtransf const &  t  ) 

C++ copy constructor requests memory for this object and populates it with the data from the object supplied as an argument.



Parameters:
t transformation.


Member Function Documentation

SPAmatrix SPAtransf::affine (  )  const

Returns the affine portion of the transformation.



Role: Always normalized: det == + or -1.

logical SPAtransf::compose ( const transf_decompose_data data,
logical  rotate_xyz_axes 
)

Interprets the transf_decompose_data structure as a series of transformations.



Role: If the logical rotate_xyz_axes is TRUE, the sequence is: [scalex] [scaley] [scalez] [shearxy] [shearxz] [shearyz] [rotatex] [rotatey] [rotatez] [translatex] [translatey] [translatez].

Or, if the logical rotate_xyz_axes is FALSE, the sequence is: [scalex] [scaley] [scalez] [shearxy] [shearxz] [shearyz] [rotate_radians / rotate_axis] [translatex] [translatey] [translatez].

Parameters:
data input data.
rotate_xyz_axes flag indicating the format of rotation data.

void SPAtransf::debug ( char const *  strlead,
FILE *  fp = debug_file_ptr 
) const

Outputs the details of a transform to the specified file.



Parameters:
strlead leader string.
fp file pointer.

logical SPAtransf::decompose ( transf_decompose_data data  )  const

Decomposes a non-degenerate transformation into data that represent a unique sequence of scaling, shearing, rotating, and translating.



Parameters:
data output data.

logical SPAtransf::identity (  )  const [inline]

Queries whether or not the transformation is the identity.

SPAtransf SPAtransf::inverse (  )  const

Returns the inverse transformation.



Role: There must be no shear in the given transformation.

logical SPAtransf::operator!= ( SPAtransf const &  rhs  )  const [inline]

Compares two transformations.



Role: This method does not allow any tolerance. It is therefore not a general equality operator, but returns FALSE if one transform is a copy of the other.

Parameters:
rhs transformation with which to compare.

SPAtransf const& SPAtransf::operator*= ( SPAtransf const &  t  ) 

Composes this transformation with another.



Parameters:
t transformation with which to form a composition.

logical SPAtransf::operator== ( SPAtransf const &  t  )  const

Compares two transformations.



Role: This method does not allow any tolerance. It is therefore not a general equality operator, but returns TRUE if one transform is a copy of the other.

Parameters:
t transformation with which to compare.

void SPAtransf::print (  )  const

Prints the transform data.

logical SPAtransf::reflect (  )  const [inline]

Queries whether or not the transformation is reflecting.

logical SPAtransf::rotate (  )  const [inline]

Queries whether or not the transformation has a rotational component.

double SPAtransf::scaling (  )  const [inline]

Returns the scaling factor of the transformation.

logical SPAtransf::shear (  )  const [inline]

Queries whether or not the transformation has a shearing component.

SPAvector SPAtransf::translation (  )  const

Returns the vector representing the translational portion of the transformation.


Friends And Related Function Documentation

SPAtransf coordinate_transf ( SPAposition const &  new_origin,
SPAunit_vector const &  new_x_axis,
SPAunit_vector const &  new_y_axis 
) [friend]

Constructs a coordinate transformation.



Role: Creates a transformation that carries the origin to the given position, and the x-axis and y-axis to the given unit vectors. If the second unit vector is not orthogonal to the first, this method uses an orthogonal unit vector in the plane of the two given vectors to direct the y-axis.

Effect: System routine

Parameters:
new_origin position to which the origin is to be translated.
new_x_axis vector with which the x-axis is to be aligned.
new_y_axis vector with which the y-axis is to be aligned.

SPAposition operator* ( SPAposition const &  p,
SPAtransf const &  t 
) [friend]

Transforms a position.



Parameters:
p position.
t transformation.

SPAunit_vector operator* ( SPAunit_vector const &  uv,
SPAtransf const &  t 
) [friend]

Transforms a unit vector by the rotation matrix in a transformation.



Role: This method returns an error if the transformation contains a shear component.

Parameters:
uv unit vector.
t transformation.

SPAvector operator* ( SPAvector const &  v,
SPAtransf const &  t 
) [friend]

Transforms a vector by an affine transformation.



Parameters:
v vector.
t transformation.

SPAtransf operator* ( SPAtransf const &  t1,
SPAtransf const *  t2 
) [friend]

Creates the composition of two transforms.



Parameters:
t1 first transformation.
t2 second transformation.

SPAtransf operator* ( SPAtransf const &  t1,
SPAtransf const &  t2 
) [friend]

Creates the composition of two transforms.



Parameters:
t1 first transformation.
t2 second transformation.

SPAtransf reflect_transf ( SPAvector const &  axis  )  [friend]

Constructs a transformation corresponding to a reflection through a plane, specified by its normal.



Role: The vector defines the normal to a plane passing through the origin. The function generates a transformation matrix describing a reflection across this plane.

Effect: Read-only

Parameters:
axis normal to the reflection plane.

SPAtransf rotate_transf ( double  angle,
SPAvector const &  axis 
) [friend]

Constructs a transformation corresponding to a simple rotation by an angle about a given axis.



Role: The angle should be specified in radians.

Effect: Read-only

Parameters:
angle rotation angle in radians.
axis axis of rotation.

SPAtransf scale_transf ( double  xs,
double  ys,
double  zs,
double  xys,
double  xzs,
double  yzs 
) [friend]

Constructs a transformation that both scales non-uniformly and shears.



Role: When the desired transformation is effectively scalar (i.e., the x, y, and z scale factors are within SPAresabs of one another and the shear factors are all within SPAresabs of zero), this function uses scale_transf(double) to construct the desired transformation. In all other cases, application of the returned transformation to an ENTITY invokes the Space Warping component.

Effect: Read-only

Parameters:
xs x scale factor.
ys y scale factor.
zs z scale factor.
xys xy shear factor.
xzs xz shear factor.
yzs yz shear factor.

SPAtransf scale_transf ( double  xs,
double  ys,
double  zs 
) [friend]

Constructs a transformation that scales non-uniformly in the x, y, and z directions.



Role: When the desired transformation is effectively scalar (i.e., all three scale factors are within SPAresabs of one another), this function uses scale_transf(double) to construct the desired transformation. In all other cases, application of the returned transformation to an ENTITY invokes the Space Warping component.

Effect: Read-only

Parameters:
xs x scale factor.
ys y scale factor.
zs z scale factor.

SPAtransf scale_transf ( double  scale  )  [friend]

Constructs a transformation that scales uniformly in all directions.



Role: The scale factor must be positive definite. If a transformation producing an inversion is desired, one should use a combination of reflections rather than a negative scaling. For example, the transformation

 T = reflect_transf(x_axis) * reflect_transf(y_axis) * reflect_transf(z_axis)
may be used to point-reflect an object about the origin.

Errors: The scale factor is not positive definite.

Effect: Read-only

Parameters:
scale scale factor.

SPAtransf shear_transf ( double  shearxy,
double  shearxz,
double  shearyz 
) [friend]

Constructs a shear transformation.



Role: Non-zero values supplied as input to this function result in a transformation that involves changing the angles between axes. This shearing is more than just non-uniform scaling. Shearxy is a ratio of the displacement of the x coordinate as the y coordinate changes. When shearxy = 1, the x axis appears at a 45-degree angle to how it normally appears; a value of 2 results in a 63.435-degree angle. Note that application of such a transformation to an ENTITY makes use of the Space Warping component.

Effect: Read-only

Parameters:
shearxy Shears the x coord as the y coord changes.
shearxz Shears the x coord as the z coord changes.
shearyz Shears the y coord as the z coord changes.

SPAtransf translate_transf ( SPAvector const &  disp  )  [friend]

Constructs a transformation corresponding to a translation by a given vector.



Effect: Read-only

Parameters:
disp displacement vector defining the translation.