shtransform.h File Reference

Detailed Description

Module to manage symbolic homogeneous transforms in R^3.

See Also
shtransform.c, TSHTransform, THTransform.

Definition in file shtransform.h.

Typedefs

typedef Tequation *** TSHTransform
 A symbolid homogeneous transform in R^3. More...
 

Functions

void SHTransformIdentity (TSHTransform *t)
 Constructor. More...
 
void SHTransformFromEqVectors (TEqVector *x, TEqVector *y, TEqVector *d, TSHTransform *t)
 Initializes a symbolic homogeneous transform from vectors. More...
 
void SHTransformCopy (TSHTransform *t_dst, TSHTransform *t_org)
 Copy constructor. More...
 
void SHTransformTx (double tx, TSHTransform *t)
 Constructor. More...
 
void SHTransformVarTx (unsigned int x, TSHTransform *t)
 Constructor. More...
 
void SHTransformTy (double ty, TSHTransform *t)
 Constructor. More...
 
void SHTransformVarTy (unsigned int y, TSHTransform *t)
 Constructor. More...
 
void SHTransformTz (double tz, TSHTransform *t)
 Constructor. More...
 
void SHTransformVarTz (unsigned int z, TSHTransform *t)
 Constructor. More...
 
void SHTransformTxyz (double tx, double ty, double tz, TSHTransform *t)
 Constructor. More...
 
void SHTransformVarTxyz (unsigned int x, unsigned int y, unsigned int z, TSHTransform *t)
 Constructor. More...
 
void SHTransformVarDisplacementAlongVector (double *v, unsigned int vID, TSHTransform *t)
 Constructor. More...
 
void SHTransformRx (double rx, TSHTransform *t)
 Constructor. More...
 
void SHTransformVarRx (unsigned int x, TSHTransform *t)
 Constructor. More...
 
void SHTransformRy (double ry, TSHTransform *t)
 Constructor. More...
 
void SHTransformVarRy (unsigned int y, TSHTransform *t)
 Constructor. More...
 
void SHTransformRz (double rz, TSHTransform *t)
 Constructor. More...
 
void SHTransformVarRz (unsigned int z, TSHTransform *t)
 Constructor. More...
 
void SHTransformCreate (unsigned int dof_r3, double v, TSHTransform *t)
 Constructor. More...
 
void SHTransformVarCreate (unsigned int dof_r3, unsigned int v, TSHTransform *t)
 Constructor. More...
 
TequationSHTransformGetElement (unsigned int i, unsigned int j, TSHTransform *t)
 Gets an element in a homogeneous transform. More...
 
void SHTransformProduct (TSHTransform *t1, TSHTransform *t2, TSHTransform *t3)
 Product of two symbolic homogeneous transforms. More...
 
void SHTransformPreCtProduct (THTransform *t1, TSHTransform *t2, TSHTransform *t3)
 Product of a constant and a symbolic homogeneous transforms. More...
 
void SHTransformPostCtProduct (TSHTransform *t1, THTransform *t2, TSHTransform *t3)
 Product of a symbolic and a constant homogeneous transforms. More...
 
void SHTransformAdd (TSHTransform *t1, TSHTransform *t2, TSHTransform *t3)
 Addition of two homogeneous transforms. More...
 
void SHTransformInverse (TSHTransform *t, TSHTransform *ti)
 Inverse of a homogeneous transform. More...
 
void SHTransformTranspose (TSHTransform *t, TSHTransform *tt)
 Transpose of a homogeneous transform. More...
 
void SHTransformApply (double *p_in, Tequation *p_out, TSHTransform *t)
 Multiply a symbolic homogeneous transform and a vector. More...
 
void SHTransformApplyRot (double *p_in, Tequation *p_out, TSHTransform *t)
 Multiply the rotation part of the homogeneous transform and a vector. More...
 
void SHTransformEvaluate (double *varValues, THTransform *tc, TSHTransform *t)
 Evaluates a symbolic homogeneous transform. More...
 
void SHTransformPrint (FILE *f, char **varNames, TSHTransform *t)
 Prints the a homogeneous transform to a file. More...
 
void SHTransformDelete (TSHTransform *t)
 Destructor. More...
 

Typedef Documentation

typedef Tequation*** TSHTransform

A 4x4 matrix representing a homogenous matrix in R^3.

See Also
shtransform.h, shtransform.c

Definition at line 37 of file shtransform.h.

Function Documentation

void SHTransformIdentity ( TSHTransform t)
void SHTransformFromEqVectors ( TEqVector x,
TEqVector y,
TEqVector d,
TSHTransform t 
)

Initializes a symbolic homogeneous transform from 3D symbolic vectors. No test is done to check the orthonomality of the give vectors. The caller must take care of this.

The third column of the matrix is computed as the cross product of x and y.

Parameters
xThe first column of the symbolic transform.
yThe second column of the symbolic transform.
dThe fourth column of the symbolic transform.
tThe matrix to initialize.

Definition at line 53 of file shtransform.c.

References AXIS_H, AXIS_X, AXIS_Y, AXIS_Z, CopyEquation(), CrossProductEqVectors(), DeleteEqVector(), DIM_SP, GetEqVectorElement(), InitEquation(), NEW, and SetEquationValue().

void SHTransformCopy ( TSHTransform t_dst,
TSHTransform t_org 
)

Initializes a homogeneous transform from another transform.

Parameters
t_dstThe matrix to initialize.
t_orgThe matrix from where to copy.

Definition at line 90 of file shtransform.c.

References CopyEquation(), DIM_SP, and NEW.

Referenced by SHTransformAdd(), SHTransformPostCtProduct(), SHTransformPreCtProduct(), SHTransformProduct(), and SHTransformTranspose().

void SHTransformTx ( double  tx,
TSHTransform t 
)

Initializes a symbolic homogeneous transform as a constant translation along X.

Parameters
txThe constant displacement along X.
tThe matrix to initialize.

Definition at line 107 of file shtransform.c.

References AXIS_H, AXIS_X, SetEquationValue(), and SHTransformIdentity().

Referenced by SHTransformCreate().

void SHTransformVarTx ( unsigned int  x,
TSHTransform t 
)

Initializes a homogeneous transform as a variable translation along X.

Parameters
xThe variable displacement along X.
tThe matrix to initialize.

Definition at line 113 of file shtransform.c.

References AddMonomial(), AddVariable2Monomial(), AXIS_H, AXIS_X, DeleteMonomial(), InitMonomial(), NFUN, and SHTransformIdentity().

Referenced by SHTransformVarCreate().

void SHTransformTy ( double  ty,
TSHTransform t 
)

Initializes a symbolic homogeneous transform as a constant translation along Y.

Parameters
tyThe displacement along Y.
tThe matrix to initialize.

Definition at line 125 of file shtransform.c.

References AXIS_H, AXIS_Y, SetEquationValue(), and SHTransformIdentity().

Referenced by SHTransformCreate().

void SHTransformVarTy ( unsigned int  y,
TSHTransform t 
)

Initializes a symbolic homogeneous transform as a variable translation along Y.

Parameters
yThe variable displacement along Y.
tThe matrix to initialize.

Definition at line 131 of file shtransform.c.

References AddMonomial(), AddVariable2Monomial(), AXIS_H, AXIS_Y, DeleteMonomial(), InitMonomial(), NFUN, and SHTransformIdentity().

Referenced by SHTransformVarCreate().

void SHTransformTz ( double  tz,
TSHTransform t 
)

Initializes a homogeneous transform as a constant translation along Z.

Parameters
tzThe constant displacement along Z.
tThe matrix to initialize.

Definition at line 143 of file shtransform.c.

References AXIS_H, AXIS_Z, SetEquationValue(), and SHTransformIdentity().

Referenced by SHTransformCreate().

void SHTransformVarTz ( unsigned int  z,
TSHTransform t 
)

Initializes a homogeneous transform as a variable translation along Z.

Parameters
zThe variable displacement along Z.
tThe matrix to initialize.

Definition at line 149 of file shtransform.c.

References AddMonomial(), AddVariable2Monomial(), AXIS_H, AXIS_Z, DeleteMonomial(), InitMonomial(), NFUN, and SHTransformIdentity().

Referenced by SHTransformVarCreate().

void SHTransformTxyz ( double  tx,
double  ty,
double  tz,
TSHTransform t 
)

Initializes a homogeneous transform as a constant translation.

Parameters
txThe constant displacement along X.
tyThe constant displacement along Y.
tzThe constant displacement along Z.
tThe matrix to initialize.

Definition at line 161 of file shtransform.c.

References AXIS_H, AXIS_X, AXIS_Y, AXIS_Z, SetEquationValue(), and SHTransformIdentity().

void SHTransformVarTxyz ( unsigned int  x,
unsigned int  y,
unsigned int  z,
TSHTransform t 
)

Initializes a homogeneous transform as a variable translation.

Parameters
xThe variable displacement along X.
yThe variable displacement along Y.
zThe variable displacement along Z.
tThe matrix to initialize.

Definition at line 169 of file shtransform.c.

References AddMonomial(), AddVariable2Monomial(), AXIS_H, AXIS_X, AXIS_Y, AXIS_Z, DeleteMonomial(), InitMonomial(), NFUN, ResetMonomial(), and SHTransformIdentity().

void SHTransformVarDisplacementAlongVector ( double *  v,
unsigned int  vID,
TSHTransform t 
)

Initializes a homogeneous transform as a scaled variable translation. This is basically used define a scaled displacements along a given vector.

Parameters
vThe vector with the scale factors. The vector definig the translation direction.
vIDThe variable displacement along the vector.
tThe matrix to initialize.

Definition at line 191 of file shtransform.c.

References AddCt2Monomial(), AddMonomial(), AddVariable2Monomial(), AXIS_H, AXIS_X, AXIS_Y, AXIS_Z, DeleteMonomial(), InitMonomial(), NFUN, ResetMonomial(), and SHTransformIdentity().

void SHTransformRx ( double  rx,
TSHTransform t 
)

Initializes a homogeneous transform as a constant rotation about X.

Parameters
rxThe constant rotation about X in radiants.
tThe matrix to initialize.

Definition at line 215 of file shtransform.c.

References AXIS_Y, AXIS_Z, SetEquationValue(), and SHTransformIdentity().

Referenced by SHTransformCreate().

void SHTransformVarRx ( unsigned int  x,
TSHTransform t 
)

Initializes a homogeneous transform as a constant rotation about X.

Parameters
xThe variable rotation about X.
tThe matrix to initialize.

Definition at line 231 of file shtransform.c.

References AddCt2Monomial(), AddMonomial(), AddVariable2Monomial(), AXIS_H, AXIS_X, AXIS_Y, AXIS_Z, COSV, DeleteMonomial(), InitMonomial(), SetEquationValue(), SHTransformInit(), and SINV.

Referenced by SHTransformVarCreate().

void SHTransformRy ( double  ry,
TSHTransform t 
)

Initializes a homogeneous transform as a constant rotation about Y.

Parameters
ryThe constant rotation about Y in radiants.
tThe matrix to initialize.

Definition at line 256 of file shtransform.c.

References AXIS_X, AXIS_Z, SetEquationValue(), and SHTransformIdentity().

Referenced by SHTransformCreate().

void SHTransformVarRy ( unsigned int  y,
TSHTransform t 
)

Initializes a homogeneous transform as a constant rotation about Y.

Parameters
yThe variable rotation about Y.
tThe matrix to initialize.

Definition at line 272 of file shtransform.c.

References AddCt2Monomial(), AddMonomial(), AddVariable2Monomial(), AXIS_H, AXIS_X, AXIS_Y, AXIS_Z, COSV, DeleteMonomial(), InitMonomial(), SetEquationValue(), SHTransformInit(), and SINV.

Referenced by SHTransformVarCreate().

void SHTransformRz ( double  rz,
TSHTransform t 
)

Initializes a homogeneous transform as a constant rotation about Z.

Parameters
rzThe constant rotation about X in radiants.
tThe matrix to initialize.

Definition at line 297 of file shtransform.c.

References AXIS_X, AXIS_Y, SetEquationValue(), and SHTransformIdentity().

Referenced by SHTransformCreate().

void SHTransformVarRz ( unsigned int  z,
TSHTransform t 
)

Initializes a homogeneous transform as a constant rotation about Z.

Parameters
zThe variable rotation about Z.
tThe matrix to initialize.

Definition at line 313 of file shtransform.c.

References AddCt2Monomial(), AddMonomial(), AddVariable2Monomial(), AXIS_H, AXIS_X, AXIS_Y, AXIS_Z, COSV, DeleteMonomial(), InitMonomial(), SetEquationValue(), SHTransformInit(), and SINV.

Referenced by SHTransformVarCreate().

void SHTransformCreate ( unsigned int  dof_r3,
double  v,
TSHTransform t 
)

Initializes a homogeneous transform as xonstant translation/rotation in a given degree of freedom.

Parameters
dof_r3The degree of freedom: TX, TY, TZ, RX, RY, RZ.
vThe constant translation or rotation (in radiants) for the selected degree of freedom.
tThe matrix to initialize.

Definition at line 338 of file shtransform.c.

References RX, RY, RZ, SHTransformRx(), SHTransformRy(), SHTransformRz(), SHTransformTx(), SHTransformTy(), SHTransformTz(), TX, TY, and TZ.

void SHTransformVarCreate ( unsigned int  dof_r3,
unsigned int  v,
TSHTransform t 
)

Initializes a homogeneous transform as variable translation/rotation in a given degree of freedom.

Parameters
dof_r3The degree of freedom: TX, TY, TZ, RX, RY, RZ.
vThe variable translation or rotation (in radiants) for the selected degree of freedom.
tThe matrix to initialize.

Definition at line 363 of file shtransform.c.

References RX, RY, RZ, SHTransformVarRx(), SHTransformVarRy(), SHTransformVarRz(), SHTransformVarTx(), SHTransformVarTy(), SHTransformVarTz(), TX, TY, and TZ.

Tequation* SHTransformGetElement ( unsigned int  i,
unsigned int  j,
TSHTransform t 
)

Gets an element from a homogeneous transform.

Parameters
iRow of the element to get.
jColumn of the element to get.
tThe matrix to update.
Returns
The element at row i column j of homogeneous transform t.

Definition at line 388 of file shtransform.c.

References AXIS_H, and Error().

void SHTransformProduct ( TSHTransform t1,
TSHTransform t2,
TSHTransform t3 
)

Product of two homogeneous transforms.

Parameters
t1The first transform to operate.
t2The second transform to operate.
t3The result.

Definition at line 398 of file shtransform.c.

References AccumulateEquations(), DeleteEquation(), DIM_SP, ProductEquations(), SHTransformCopy(), SHTransformDelete(), and SHTransformInit().

Referenced by SHTransformInverse().

void SHTransformPreCtProduct ( THTransform t1,
TSHTransform t2,
TSHTransform t3 
)

Product of constnat and a symbolic homogeneous transforms.

Parameters
t1The constant transform to operate.
t2The symbolic transform to operate.
t3The result.

Definition at line 424 of file shtransform.c.

References AccumulateEquations(), DIM_SP, HTransformGetElement(), SHTransformCopy(), SHTransformDelete(), and SHTransformInit().

void SHTransformPostCtProduct ( TSHTransform t1,
THTransform t2,
TSHTransform t3 
)

Product of a symbolic and a constant homogeneous transforms.

Parameters
t1The symbolic transform to operate.
t2The constant transform to operate.
t3The result.

Definition at line 448 of file shtransform.c.

References AccumulateEquations(), DIM_SP, HTransformGetElement(), SHTransformCopy(), SHTransformDelete(), and SHTransformInit().

void SHTransformAdd ( TSHTransform t1,
TSHTransform t2,
TSHTransform t3 
)

Addition of two homogeneous transforms.

Parameters
t1The first transform to operate.
t2The second transform to operate.
t3The result.

Definition at line 472 of file shtransform.c.

References AccumulateEquations(), DIM_SP, SHTransformCopy(), SHTransformDelete(), and SHTransformInit().

void SHTransformInverse ( TSHTransform t,
TSHTransform ti 
)

Addition of a homogeneous transform.

Parameters
tThe transform to invert.
tiThe result transform with the inverse of the output.

Definition at line 492 of file shtransform.c.

References AccumulateEquations(), AXIS_H, CopyEquation(), DeleteEquation(), DIM_SP, SetEquationValue(), SHTransformDelete(), SHTransformIdentity(), SHTransformInit(), and SHTransformProduct().

void SHTransformTranspose ( TSHTransform t,
TSHTransform tt 
)

Transpose of a homogeneous transform. Note that, in general the transpose of a homogeneous transform is not a homogeneous transform.

Parameters
tThe transform to transpose.
ttThe result with the transposed matrix.

Definition at line 521 of file shtransform.c.

References CopyEquation(), DIM_SP, NEW, SHTransformCopy(), and SHTransformDelete().

void SHTransformApply ( double *  p_in,
Tequation p_out,
TSHTransform t 
)

Multiply a symbolic homogeneous transform and a vector.

Parameters
p_inA input vector in R^3.
p_outThe resulting 3 equation vector.
tThe matrix to apply to the input vector.

Definition at line 543 of file shtransform.c.

References AccumulateEquations(), AXIS_H, CopyEquation(), and DIM_SP.

void SHTransformApplyRot ( double *  p_in,
Tequation p_out,
TSHTransform t 
)

Applies the rotation encoded in a homogeneous transform to a vector (i.e., rotates the vector).

Parameters
p_inA input vector in R^3.
p_outThe resulting vector (3 equations).
tThe matrix with the rotation to apply to the input vector.

Definition at line 556 of file shtransform.c.

References AccumulateEquations(), DIM_SP, and InitEquation().

void SHTransformEvaluate ( double *  varValues,
THTransform tc,
TSHTransform t 
)

Evaluates a symbolic homogeneus transform to produce a constant homogeneous transform.

Parameters
varValuesValues for the variables involved in the symbolic homogeneous transform.
tcThe output constant transform.
tThe input symbolic transform.

Definition at line 569 of file shtransform.c.

References DIM_SP, EvaluateWholeEquation(), HTransformIdentity(), and HTransformSetElement().

void SHTransformPrint ( FILE *  f,
char **  varNames,
TSHTransform t 
)

Prints the a homogeneous transform to a stream that can be stdtout.

Parameters
fThe file where to print.
varNamesName of the variables involved int the symbolic transform. Can be NULL and then generic names are used.
tThe matrix to print.

Definition at line 586 of file shtransform.c.

References DIM_SP, and PrintMonomials().

void SHTransformDelete ( TSHTransform t)

Deletes the information stored in the TSHTransform and frees the allocated memory space.

Parameters
tThe transform to delete.

Definition at line 600 of file shtransform.c.

References DeleteEquation(), and DIM_SP.

Referenced by SHTransformAdd(), SHTransformInverse(), SHTransformPostCtProduct(), SHTransformPreCtProduct(), SHTransformProduct(), and SHTransformTranspose().