udfBuildMmo()
Build the mesh motion transformation matrix.
Syntax
udfBuildMmo( udfHd, rot, rotOrg, trans, mmoMtx ) ;
Type
AcuSolve User-Defined Function Global
Parameters
- udfHd
- The opaque handle (pointer) which was passed to the user function.
- rot (real)
- Rotation vector.
- rotOrg (real)
- Origin of rotation.
- trans (real)
- Translation vector.
- mmoMts (real)
- Mesh motion transformation matrix.
Return Value
None
Description
Void
usrRotTransMmo( UdfHd udfHd, /* opaque handle for accessing information */
Real* outVec, /* output vector */
Integer nItems, /* No. of items in outVec (=1 here) */
Integer vecDim ) /* vector dimension of outVec (=12 here) */
{
Integer i ; /* a running index */
Real angle ; /* rot/trans angle */
Real rotOmega ; /* rotation frequency */
Real trnOmega ; /* translation frequency */
Real trnAmp ; /* translation amplitude */
Real rotOrg[3] ; /* origin of rotation */
Real rot[3] ; /* rotation angle */
Real trans[3] ; /* translation */
Real mmoMtx[12] ; /* transformation matrix */
Real time ; /* current time */
Real sa ; /* sine of angle */
Real* usrVals ; /* user supplied values */
/* Get global data */
time = udfGetTime( udfHd ) ;
/* Get the user data */
udfCheckNumUsrVals( udfHd, 6 ) ; /* check for error */
usrVals = udfGetUsrVals( udfHd ) ; /* get the user vals */
rotOrg[0] = usrVals[0] ; /* get x-origin of rotation */
rotOrg[1] = usrVals[1] ; /* get y-origin of rotation */
rotOrg[2] = usrVals[2] ; /* get z-origin of rotation */
rotOmega = usrVals[3] ; /* get rotation frequency */
trnOmega = usrVals[4] ; /* get translation frequency */
trnAmp = usrVals[5] ; /* get translation amplitude */
/* Construct rotation and translation vectors */
angle = time * rotOmega * 2 * 3.1415926535897931E+00 ;
rot[0] = 0.0 ;
rot[1] = 0.0 ;
rot[2] = angle ;
angle = time * trnOmega * 2 * 3.1415926535897931E+00 ;
sa = sin( angle ) ;
trans[0] = 0.0 ;
trans[1] = 0.0 ;
trans[2] = trnAmp * sa ;
/* Build rotation matrix */
udfBuildMmo( udfHd, rot, rotOrg, trans, mmoMtx ) ;
/* Output vector */
for ( i = 0 ; i < 12 ; i++ ) {
outVec[i] = mmoMtx[i] ;
}
} /* end of usrRotTransMmo() */
Errors
This routine expects a valid udfHd.