Beispiel #1
0
        public void PushRotation(double fAngleX, double fAngleY, double fAngleZ)
        {
            m_stackMatrices.Push(m_values);
            CTransformation3D t = GetRotation(fAngleX, fAngleY, fAngleZ);

            m_values = (this * t).m_values;
        }
Beispiel #2
0
        public void PushTranslation(double fDx, double fDy, double fDz)
        {
            m_stackMatrices.Push(m_values);
            CTransformation3D t = GetTranslation(fDx, fDy, fDz);

            m_values = (this * t).m_values;
        }
Beispiel #3
0
        //--------------------------------------
        public C3DSize GlobalToClient(C3DSize size)
        {
            CTransformation3D t = CTransformation3D.Identity;

            PushTransformationGlobalToChild(t);
            return(t.Transforme(size));
        }
Beispiel #4
0
        //--------------------------------------
        public C3DSize ClientToGlobal(C3DSize size)
        {
            CTransformation3D t = CTransformation3D.Identity;

            PushTransformationChildToGlobal(t);
            return(t.Transforme(size));
        }
Beispiel #5
0
        }/*
          * C3DPoint newPt = pt;
          * newPt.Offset(OrigineCliente.X, OrigineCliente.Y, OrigineCliente.Z);
          * newPt.Offset(Position.X, Position.Y, Position.Z);
          * if (Parent != null)
          *     return Parent.ClientToGlobal(newPt);
          * else
          *     return newPt;
          * }*/

        //--------------------------------------
        public C3DPoint GlobalToClient(C3DPoint pt)
        {
            CTransformation3D t = CTransformation3D.Identity;

            PushTransformationGlobalToChild(t);
            return(t.Transforme(pt));
        }
Beispiel #6
0
        //--------------------------------------
        public C3DPoint ClientToGlobal(C3DPoint pt)
        {
            CTransformation3D t = CTransformation3D.Identity;

            PushTransformationChildToGlobal(t);
            return(t.Transforme(pt));
        }/*
Beispiel #7
0
        public static CTransformation3D GetTranslation(double fDx, double fDy, double fDz)
        {
            CTransformation3D t = new CTransformation3D();

            t[0, 3] = fDx;
            t[1, 3] = fDy;
            t[2, 3] = fDz;
            return(t);
        }
Beispiel #8
0
 //-----------------------------------------------------
 public void PushTransformationGlobalToChild(CTransformation3D t)
 {
     t.PushRotation(0, 0, -(int)m_rotationZ);
     t.PushRotation(0, -(int)m_rotationY, 0);
     t.PushRotation(-(int)m_rotationX, 0, 0);
     t.PushTranslation(-Offset.X, -Offset.Y, -Offset.Z);
     t.PushTranslation(-Position.X, -Position.Y, -Position.Z);
     if (Parent != null)
     {
         Parent.PushTransformationGlobalToChild(t);
     }
 }
Beispiel #9
0
 //-----------------------------------------------------
 public void PushTransformationChildToGlobal(CTransformation3D t)
 {
     if (Parent != null)
     {
         Parent.PushTransformationChildToGlobal(t);
     }
     t.PushTranslation(Position.X, Position.Y, Position.Z);
     t.PushTranslation(Offset.X, Offset.Y, Offset.Z);
     t.PushRotation((int)m_rotationX, 0, 0);
     t.PushRotation(0, (int)m_rotationY, 0);
     t.PushRotation(0, 0, (int)m_rotationZ);
 }
Beispiel #10
0
        //-----------------------------------------------------
        public EFaceVueDynamique ConvertFaceToGlobal(EFaceVueDynamique face)
        {
            C3DSize           vecteur = m_NormalesFace[(int)face];
            CTransformation3D t       = CTransformation3D.Identity;

            PushTransformationChildToGlobal(t);
            vecteur = t.Transforme(vecteur);
            foreach (EFaceVueDynamique faceTest in Enum.GetValues(typeof(EFaceVueDynamique)))
            {
                if (m_NormalesFace[(int)faceTest].Equals(vecteur))
                {
                    return(faceTest);
                }
            }
            return(face);
        }
Beispiel #11
0
        public static CTransformation3D operator *(CTransformation3D matriceGauche, CTransformation3D matriceDroite)
        {
            CTransformation3D trans = new CTransformation3D();

            for (int nCol = 0; nCol < 4; nCol++)
            {
                for (int nLigne = 0; nLigne < 4; nLigne++)
                {
                    double fVal = 0;
                    for (int nTmp = 0; nTmp < 4; nTmp++)
                    {
                        fVal += matriceGauche[nLigne, nTmp] * matriceDroite[nTmp, nCol];
                    }
                    trans[nLigne, nCol] = fVal;
                }
            }
            return(trans);
        }
Beispiel #12
0
        public static CTransformation3D GetRotation(EAxe axe, double fAngleDegres)
        {
            CTransformation3D matrice = CTransformation3D.Identity;

            if (fAngleDegres == 0)
            {
                return(matrice);
            }
            double fAngle = fAngleDegres / 180.0 * Math.PI;
            double fCos   = Math.Cos(fAngle);
            double fSin   = Math.Sin(fAngle);


            switch (axe)
            {
            case EAxe.X:
                matrice[1, 1] = fCos;
                matrice[1, 2] = -fSin;
                matrice[2, 1] = fSin;
                matrice[2, 2] = fCos;
                break;

            case EAxe.Y:
                matrice[0, 0] = fCos;
                matrice[0, 2] = fSin;
                matrice[2, 0] = -fSin;
                matrice[2, 2] = fCos;
                break;

            case EAxe.Z:
                matrice[0, 0] = fCos;
                matrice[0, 1] = -fSin;
                matrice[1, 0] = fSin;
                matrice[1, 1] = fCos;
                break;
            }
            return(matrice);
        }