Example #1
0
        //---------------------------------------------------------------------------
        // setupParentToLocal
        //
        // Setup the matrix to perform a parent -> local transformation, given
        // the position and orientation of the local reference frame within the
        // parent reference frame.
        //
        // A very common use of this will be to construct a world -> object matrix.
        // To perform this transformation, we would normally FIRST transform
        // from world to inertial space, and then rotate from inertial space into
        // object space.  However, out 4x3 matrix always translates last.  So
        // we think about creating two matrices T and R, and then concatonating
        // M = TR.
        //
        // We allow the orientation to be specified using either euler angles,
        // or a RotationMatrix
        public void setupParentToLocal(Vector3 pos, EulerAngles orient)
        {
            // Create a rotation matrix.

            RotationMatrix orientMatrix = new RotationMatrix();
            orientMatrix.setup(orient);

            // Setup the 4x3 matrix.

            setupParentToLocal(pos, orientMatrix);
        }
Example #2
0
        //---------------------------------------------------------------------------
        // setupLocalToParent
        //
        // Setup the matrix to perform a local -> parent transformation, given
        // the position and orientation of the local reference frame within the
        // parent reference frame.
        //
        // A very common use of this will be to construct a object -> world matrix.
        // As an example, the transformation in this case is straightforward.  We
        // first rotate from object space into inertial space, then we translate
        // into world space.
        //
        // We allow the orientation to be specified using either euler angles,
        // or a RotationMatrix
        public void setupLocalToParent(Vector3 pos, EulerAngles orient)
        {
            // Create a rotation matrix.

            RotationMatrix orientMatrix = new RotationMatrix();
            orientMatrix.setup(orient);

            // Setup the 4x3 matrix.  Note: if we were really concerned with
            // speed, we could create the matrix directly into these variables,
            // without using the temporary RotationMatrix object.  This would
            // save us a function call and a few copy operations.

            setupLocalToParent(pos, orientMatrix);
        }