Пример #1
0
        //"Spin" = rotate around a relative center of motion :o)
        //----------------------------------------------------------------
        public void Spin(float radians, IVector3H1 axisUnitVector, IVector3H1 RelCenter)
        {
            Matrix3H4 Trans1 = new Matrix3H4();

            Trans1.SetTranslate(-(Vector3H1)RelCenter); //translate relative center to oragine
            Matrix3H4 RotateMat = new Matrix3H4();

            RotateMat.RotateAnyAxis(radians, axisUnitVector); //Do 3D rotation
            Matrix3H4 Trans2 = new Matrix3H4();

            Trans2.SetTranslate(RelCenter);                  // put it back
            IMatrix3H4 Answer = Trans2 * RotateMat * Trans1; //multiply out answer

            this.Copy(Answer);
        }
Пример #2
0
        //"stretch" = scale around a relative (quasi-center) point
        //basically you move to the origin, do a normal scale, then move the object back
        public void Stretch(float SX, float SY, float SZ, IVector3H1 RelCenter) //probably cannot be done in 3x3... 3H4???
        {
            //translate relative center to oragine
            Matrix3H4 Trans1 = new Matrix3H4();

            Trans1.SetTranslate(-RelCenter.X, -RelCenter.Y, -RelCenter.Z);

            //do the scaling
            Matrix3H4 ScaleMat = new Matrix3H4();

            ScaleMat.SetScale(SX, SY, SZ);

            // put it back
            Matrix3H4 Trans2 = new Matrix3H4();

            Trans2.SetTranslate(RelCenter);

            IMatrix3H4 Answer = Trans2 * ScaleMat * Trans1;

            this.Copy(Answer);
        }
Пример #3
0
 public Matrix3H4(IMatrix3H4 OtherMatrix) //copy constructor
 {
     Data = new float[3, 4];
     this.Copy(OtherMatrix);
 }