Пример #1
0
 public Transformation Inverse()
 {
     Transformation tempTrans = new Transformation(this);
     tempTrans.Matrix = this.Matrix.Inverse();
     tempTrans.Vector = tempTrans.Matrix * -this.Vector;
     return tempTrans;
 }
Пример #2
0
 public Transformation Transform(Transformation trans)
 {
     Transformation tempTrans = new Transformation();
     tempTrans.Matrix = this.Matrix * trans.Matrix;
     tempTrans.Vector = this.Matrix * trans.Vector + this.Vector;
     return tempTrans;
 }
Пример #3
0
        public Transformation Rotate(float angle, float x, float y, float z)
        {
            float xy = x * y;
            float xz = x * z;
            float yz = y * z;
            float rads = Math.Utils.Deg2Rad(angle);
            float cos = (float)System.Math.Cos(rads);
            float sin = (float)System.Math.Sin(rads);
            float omc = 1 - cos;
            float oms = 1 - sin;

            Matrix rotMat = new Matrix();
            rotMat[0, 0] = cos + x * x * omc;
            rotMat[0, 1] = xy * omc - z * sin;
            rotMat[0, 2] = xz * omc + y * sin;
            rotMat[1, 0] = xy * omc + z * sin;
            rotMat[1, 1] = cos + y * y * omc;
            rotMat[1, 2] = yz * omc - x * sin;
            rotMat[2, 0] = xz * omc - y * sin;
            rotMat[2, 1] = yz * omc + x * sin;
            rotMat[2, 2] = cos + z * z * omc;

            Transformation tempTrans = new Transformation(this);
            tempTrans.Matrix *= rotMat;
            return tempTrans;
        }
Пример #4
0
 public void Transform(Transformation trans)
 {
     for (int i = 0; i < this._corners.Length; ++i)
     {
         this._corners[i] = this._corners[i].Transform(trans);
     }
 }
Пример #5
0
 public Transformation Scale(float x, float y, float z)
 {
     Matrix scaleMat = Matrix.Identity();
     scaleMat[0, 0] = x;
     scaleMat[1, 1] = y;
     scaleMat[2, 2] = z;
     Transformation tempTrans = new Transformation(this);
     tempTrans.Matrix *= scaleMat;
     return tempTrans;
 }
Пример #6
0
 public Transformation Translate(float x, float y, float z)
 {
     Vector translate = new Vector(x, y, z);
     Transformation tempTrans = new Transformation(this);
     tempTrans.Vector += tempTrans.Matrix * translate;
     return tempTrans;
 }
Пример #7
0
 public Transformation(Transformation copy)
 {
     this.Matrix = new Matrix(copy.Matrix);
     this.Vector = new Vector(copy.Vector);
 }
Пример #8
0
 public Vector Trasnform(Transformation trans)
 {
     Vector tempVec = new Vector(this);
     tempVec = trans.Matrix * tempVec;
     return tempVec;
 }
Пример #9
0
 public void Transform(Transformation trans)
 {
     this.Position = this.Position.Transform(trans);
 }
Пример #10
0
 public void Transform(Transformation trans)
 {
     this._transform = this._transform.Transform(trans);
 }
Пример #11
0
 public void Transform(Transformation trans)
 {
     this._center = this._center.Transform(trans);
 }
Пример #12
0
 public void Transform(Transformation trans)
 {
     this.Origin = this.Origin.Transform(trans);
     this.Direction = this.Direction.Transform(trans);
 }