예제 #1
0
        public override MMatrix asMatrix(double percent)
        {
            MPxTransformationMatrix m = new MPxTransformationMatrix(this);
            //	Apply the percentage to the matrix components
            MVector trans = m.translation();

            trans *= percent;
            m.translateTo(trans);
            MPoint rotatePivotTrans = m.rotatePivot();

            rotatePivotTrans = rotatePivotTrans * percent;
            m.setRotatePivot(rotatePivotTrans);
            MPoint scalePivotTrans = new MPoint(m.scalePivotTranslation());

            scalePivotTrans = scalePivotTrans * percent;
            m.setScalePivotTranslation(new MVector(scalePivotTrans));

            //	Apply the percentage to the rotate value.  Same
            // as above + the percentage gets applied
            MQuaternion           quat = rotation();
            DegreeRadianConverter conv = new DegreeRadianConverter();
            double newTheta            = conv.degreesToRadians(getRockInX());

            quat.setToXAxis(newTheta);
            m.rotateBy(quat);
            MEulerRotation eulRotate = m.eulerRotation();

            m.rotateTo(eulRotate.multiply(percent), MSpace.Space.kTransform);

            //	Apply the percentage to the scale
            MVector s = new MVector(scale(MSpace.Space.kTransform));

            s.x = 1.0 + (s.x - 1.0) * percent;
            s.y = 1.0 + (s.y - 1.0) * percent;
            s.z = 1.0 + (s.z - 1.0) * percent;
            m.scaleTo(s, MSpace.Space.kTransform);

            return(m.asMatrix());
        }