Public Member Functions  
ippCsyTransform ()  
~ippCsyTransform ()  
void  update (double x0In, double y0In, double z0In, double thetaIn, double psiIn, double phiIn) 
double  fwdPointX (double xIn, double yIn, double zIn) const 
double  fwdPointY (double xIn, double yIn, double zIn) const 
double  fwdPointZ (double xIn, double yIn, double zIn) const 
double  invPointX (double xIn, double yIn, double zIn) const 
double  invPointY (double xIn, double yIn, double zIn) const 
double  invPointZ (double xIn, double yIn, double zIn) const 
double  fwdDirectionX (double xIn, double yIn, double zIn) const 
double  fwdDirectionY (double xIn, double yIn, double zIn) const 
double  fwdDirectionZ (double xIn, double yIn, double zIn) const 
double  invDirectionX (double xIn, double yIn, double zIn) const 
double  invDirectionY (double xIn, double yIn, double zIn) const 
double  invDirectionZ (double xIn, double yIn, double zIn) const 
double  getX () const 
double  getY () const 
double  getZ () const 
double  getTheta () const 
double  getPsi () const 
double  getPhi () const 
The parameters for SetCsyTransformation are X0, Y0, Z0, Theta, Psi, and Phi. X0, Y0, and Z0 are described in the spec as the origin of the machine coordinate system in "Part coordinates" (the coordinate system whose tranformation is being assigned). The spec says Theta, Psi, and Phi are Euler angles that define the rotation matrix of the transformation. The spec does not say how Theta, Psi and Phi are intended to be used in performing the rotation. The spec does provide an error message saying that Theta is out of range, so the intended method should have a limited range for Theta. The spec does not say what the range is.
Appendix A to the spec gives C++ code for building a rotation matrix from Theta, Psi, and Phi and for the inverse operation of calculating Theta, Psi, and Phi given a rotation matrix. Appendix A does not say how the matrix is intended to be used in performing transformations.
The term "Euler angles" does not have a universally accepted meaning. There is one widely accepted meaning that matches the spec, so that is, presumably, what is intended. The gaps left by the spec are filled in the following paragraphs.
For the purposes of description, "PartCsy" is used here as the other coordinate system in addition to MachineCsy.
The parameters X0, Y0, Z0, Theta, Psi, and Phi are used as follows to move the MachineCsy so that it is coincident with the PartCsy.
First, translate the MachineCsy so that its origin ((X0, Y0, Z0) in the part coordinates) is at (0, 0, 0) in part coordinates. Call the new coordinate system MachineCsy1.
Second, rotate MachineCsy1 about the MachineCsy1 Zaxis so that the MachineCsy1 Xaxis is on the line of intersection of the MachineCsy1 XYplane with the PartCsy XYplane. Call the angle of rotation Psi. If the two planes are the same, Psi = 0. Call the new coordinate system MachineCsy2.
Third, rotate MachineCsy2 about the MachineCsy2 Xaxis so that the positive MachineCsy2 Zaxis is coincident with the positive PartCsy Zaxis. Call the angle of rotation Theta. If the positive MachineCsy2 Zaxis is already coincident with the positive PartCsy Zaxis, Theta = 0. Call the new coordinate system MachineCsy3.
[In the preceding step, it is not obvious that any rotation about the MachineCsy2 Xaxis will cause the two Zaxes to be coincident. To see that this is possible, imagine a rotation about the MachineCsy2 Xaxis that puts the MachineCsy2 Yaxis in the PartCsy XYplane. This same rotation will cause the MachineCsy2 Zaxis to be coincident with the PartCsy Zaxis, since the two coordinate systems now have the same XYplane and same origin.]
Fourth, rotate the MachineCsy3 about the MachineCsy3 Zaxis so that the positive MachineCsy3 Xaxis is coincident with the positive PartCsy Xaxis. Call the angle of rotation Phi. If the Xaxes are already coincident, Phi = 0.
With these meanings for the angles, the rotation matrix for each individual rotation can be easily written. The rotation matrix for the net effect of the three rotations is found by taking the product of the three matrices. As stated on page 68 of the spec, using normal matrix indexing (row index first, column index second, top to bottom for rows, left to right for columns, indexes starting at 1) this matrix is given by:
M11 = [(c2 * c3)  (c1 * s2 * s3)] M12 = [(s2 * c3) + (c1 * c2 * s3)] M13 = [(s1 * s3)] M21 = [(c2 * s3)  (c1 * s2 * c3)] M22 = [(s2 * s3) + (c1 * c2 * c3)] M23 = [(s1 * c3)] M31 = [(s1 * s2)] M32 = [(s1 * c2)] M33 = [(c1)]
where:
c1 = cos(Theta) s1 = sin(Theta) c2 = cos(Psi) s2 = sin(Psi) c3 = cos(Phi) s3 = sin(Phi)
If matrix M is put in a 2D C++ array (call it Marray), the indexes are zerobased, so M11 = Marray[0,0], M32 = Marray[2,1] and so forth.
The transformation matrix M may be used as follows:
If P is a point (xm, ym, zm) given in machine coordinates, to find its coordinates (xp, yp, zp) in part coordinates, first find its coordinates (xmr, ymr, zmr) in rotated machine coordinates:
xmr = [(M11 * xm) + (M12 * ym) + (M13 * zm)] ymr = [(M21 * xm) + (M22 * ym) + (M23 * zm)] zmr = [(M31 * xm) + (M32 * ym) + (M33 * zm)]
Then translate:
xp = (xmr + X0) yp = (ymr + Y0) zp = (zmr + Z0)
If P is a point (xp, yp, zp) in part coordinates, to find its coordinates (xm, ym, zm) in machine coordinates, first find its coordinates (xpt, ypt, zpt) in translated part coordinates:
xpt = (xp  X0) ypt = (yp  Y0) zpt = (zp  Z0)Then rotate:
xm = [(M11 * xpt) + (M21 * ypt) + (M31 * zpt)] ym = [(M12 * xpt) + (M22 * ypt) + (M32 * zpt)] zm = [(M13 * xpt) + (M23 * ypt) + (M33 * zpt)]
The rotation matrix used here is the transpose of the one used earlier. This is also the inverse, since for rotation matrices, the transpose is the inverse. The inverse of a rotation, of course, is an equally large rotation about the same axis in the opposite direction.
Theta, Psi, and Phi correspond well with widely used equipment, namely rotary tables (which rotate around an axis parallel to the MachineCsy Zaxis) and tilt tables (which rotate around an axis parallel to the MachineCsy XYplane  this rotation axis is often also parallel to the Xaxis).
For a rotary table, Theta is zero, and either Psi or Phi (or even both, but that would be silly) can be used for the rotation angle.
For a tilt table, Psi and Phi are both zero, and Theta is used for the rotation angle if the rotation axis is parallel to the Xaxis. If the rotation angle is not parallel to the Xaxis, Psi can be used before Theta, since the effect is the same as a tilt table mounted on a rotary table.
For a tilt table mounted on a rotary table with the rotary axis passing through the tilt axis, Psi and Theta, or Theta and Phi can be used.
For a rotary table mounted on a tilt table with the rotary axis passing through the tilt axis, Theta and Phi can be used.
The range of Theta, Psi and Phi is a full 360 degrees, which might reasonably be either 0 to 360 or 180 to +180. It is not clear why Theta has been singled out for possibly being out of range. There does not need to be any limitation of range for any of the angles, since every rotation outside any 360 degree range has the same effect as some rotation inside the range.
The spec is not clear about which transformation is being set by SetCsyTransformation. There are two choices:
The diagram on page 59 of release 1.4 implies choice 2 is what is intended, since the PartCsy transformation is based on the Rotary Table coordinate system. In this case, X0, Y0, Z0 would be the location of the origin of the rotary table coordinate system in part coordinates. But the text in the section about SetCsyTransformation on page 60 implies choice 1 is intended, since it says "X0, Y0, and Z0 define the zero point of the machine coordinate system in part coordinates."
We are assuming here that choice 1 is intended.
An alternative parameterization for SetCsyTransformation would be to use nine parameters (X0, Y0, Z0, Zx, Zy, Zz, Xx, Xy, Xz) where the Euler angles have been replaced by (Zx, Zy, Zz) [which is the direction in the PartCsy of the vector (0, 0, 1) in the MachineCsy] and (Xx, Xy, Xz) [which is the direction in the PartCsy of (1, 0, 0) in the MachineCsy]. The values of (Yx, Yy, Yz) can be computed easily (since the transformed Y axis is the cross product of the transformed Z axis with the transformed X axis) or they can be provided as additional parameters. The rotation matrix then has (Xx, Xy, Xz), (Yx, Yy, Yz), and (Zx, Zy, Zz) as its rows (or columns, depending on how the matrix is used). This parameterization is the one used in STEP geometry.
In the implementation below, two sets of data about the transformation are included, namely both the data provided in the SetCsyTransformation command and the Matrix that may be derived from that data.
The first constructor makes an identity transformation.
In the method names below, "fwd" (forward) means from machine coordinates to part (or whatever) coordinates, and "inv" (inverse) means from part (or whatever) coordinates to machine coordinates.
The equations for transforming the coordinates of points are given above. The equations for transforming directions are simpler. The translation can be ignored. This is obvious in the forward direction, since the translation occurs after the rotation and has no effect on directions. We can also show this mathematically. Mathematically, a direction may be viewed as a vector from the origin O of a coordinate system to a point P having the same coordinates as the direction.
For transforming forward, we can compute the direction in the new system as the difference between the transformed P and the transformed O. For the X coordinate, for example,
newDirectionX = X_of(P_TransformedForward)  X_of(OtransformedForward) = ((M11 * Px) + (M12 * Py) + (M13 * Pz) + x0)  ((M11 * 0) + (M12 * 0) + (M13 * 0) + x0) = ((M11 * Px) + (M12 * Py) + (M13 * Pz))
For transforming backward (inverse), we can compute the direction in machine coordinates as the same difference, but now P and O are expressed in the new coordinate system.
machineDirectionX = X_of(P_TransformedInverse)  X_of(O_TransformedInverse) = ((M11 * (Px  x0)) + (M21 * (Py  y0)) + (M31 * (Pz  z0))) ((M11 * ( 0  x0)) + (M21 * ( 0  y0)) + (M31 * ( 0  z0))) = ((M11 * Px) + (M21 * Py) + (M31 * Pz))
The calculations for Y and Z are similar. Thus, for directions, we have proved we can just ignore the translation for both forward and inverse applications of the csyTransform.
Definition at line 19 of file ippCsyTransform.h.

Definition at line 39 of file ippCsyTransform.h. 

Definition at line 45 of file ippCsyTransform.h. 

Definition at line 63 of file ippCsyTransform.h. Referenced by world::getCurrentAlignment(). 

Definition at line 65 of file ippCsyTransform.h. Referenced by world::getCurrentAlignment(). 

Definition at line 67 of file ippCsyTransform.h. Referenced by world::getCurrentAlignment(). 

Definition at line 50 of file ippCsyTransform.h. 

Definition at line 52 of file ippCsyTransform.h. 

Definition at line 54 of file ippCsyTransform.h. 

Definition at line 82 of file ippCsyTransform.h. Referenced by ippBasicExecutor::executeGetCsyTransformation(). 

Definition at line 81 of file ippCsyTransform.h. Referenced by ippBasicExecutor::executeGetCsyTransformation(). 

Definition at line 80 of file ippCsyTransform.h. Referenced by ippBasicExecutor::executeGetCsyTransformation(). 

Definition at line 77 of file ippCsyTransform.h. Referenced by ippBasicExecutor::executeGetCsyTransformation(). 

Definition at line 78 of file ippCsyTransform.h. Referenced by ippBasicExecutor::executeGetCsyTransformation(). 

Definition at line 79 of file ippCsyTransform.h. Referenced by ippBasicExecutor::executeGetCsyTransformation(). 

Definition at line 69 of file ippCsyTransform.h. 

Definition at line 71 of file ippCsyTransform.h. 

Definition at line 73 of file ippCsyTransform.h. 

Definition at line 56 of file ippCsyTransform.h. Referenced by world::inWorkVolume(). 

Definition at line 58 of file ippCsyTransform.h. Referenced by world::inWorkVolume(). 

Definition at line 60 of file ippCsyTransform.h. Referenced by world::inWorkVolume(). 

Definition at line 17 of file ippCsyTransform.cpp. References IPP_PI. 