Esempio n. 1
0
        public void Rotate(float x, float y, float z)
        {
            Point3d center = CalcCenter();
            float   cz     = center.z;

            if ((x == 0) && (y == 0))
            {
                cz = 0;
            }
            // else - i think we need to delete all supports -SHS
            Translate((float)-center.x, (float)-center.y, (float)-cz);

            Matrix3D rotmat = new Matrix3D();

            rotmat.Identity();
            rotmat.Rotate(x, y, z);
            Rotate(rotmat);
            if ((x == 0) && (y == 0))
            {
                foreach (Object3d sup in m_supports)
                {
                    sup.Rotate(rotmat);
                }
            }
            Translate((float)center.x, (float)center.y, (float)cz);
        }
Esempio n. 2
0
        public void  Rotate(float Xa, float Ya, float Za)
        {
            Matrix3D Rmat    = new Matrix3D();
            Matrix3D RMatrix = new Matrix3D();
            float    sinxa   = (float)Math.Sin(Xa);
            float    cosxa   = (float)Math.Cos(Xa);
            float    sinza   = (float)Math.Sin(Za);
            float    cosza   = (float)Math.Cos(Za);
            float    sinya   = (float)Math.Sin(Ya);
            float    cosya   = (float)Math.Cos(Ya);

            Rmat.Identity();
            RMatrix.Identity();

            // Initialize Z rotation matrix - Note: we perform Z
            // rotation first to align the 3D Z axis with the 2D Z axis.
            Rmat.Matrix[0, 0] = cosza;    Rmat.Matrix[0, 1] = sinza;    Rmat.Matrix[0, 2] = 0;    Rmat.Matrix[0, 3] = 0;
            Rmat.Matrix[1, 0] = -sinza;   Rmat.Matrix[1, 1] = cosza;    Rmat.Matrix[1, 2] = 0;    Rmat.Matrix[1, 3] = 0;
            Rmat.Matrix[2, 0] = 0;        Rmat.Matrix[2, 1] = 0;        Rmat.Matrix[2, 2] = 1;    Rmat.Matrix[2, 3] = 0;
            Rmat.Matrix[3, 0] = 0;        Rmat.Matrix[3, 1] = 0;        Rmat.Matrix[3, 2] = 0;    Rmat.Matrix[3, 3] = 1;

            // Merge matrix with master matrix:
            MergeMatrices(ref RMatrix, Rmat);

            // Initialize X rotation matrix:
            Rmat.Matrix[0, 0] = 1;  Rmat.Matrix[0, 1] = 0;        Rmat.Matrix[0, 2] = 0;       Rmat.Matrix[0, 3] = 0;
            Rmat.Matrix[1, 0] = 0;  Rmat.Matrix[1, 1] = cosxa;    Rmat.Matrix[1, 2] = sinxa;   Rmat.Matrix[1, 3] = 0;
            Rmat.Matrix[2, 0] = 0;  Rmat.Matrix[2, 1] = -sinxa;   Rmat.Matrix[2, 2] = cosxa;   Rmat.Matrix[2, 3] = 0;
            Rmat.Matrix[3, 0] = 0;  Rmat.Matrix[3, 1] = 0;        Rmat.Matrix[3, 2] = 0;       Rmat.Matrix[3, 3] = 1;

            // Merge matrix with master matrix:
            MergeMatrices(ref RMatrix, Rmat);

            // Initialize Y rotation matrix:
            Rmat.Matrix[0, 0] = cosya;   Rmat.Matrix[0, 1] = 0;   Rmat.Matrix[0, 2] = -sinya;   Rmat.Matrix[0, 3] = 0;
            Rmat.Matrix[1, 0] = 0;       Rmat.Matrix[1, 1] = 1;   Rmat.Matrix[1, 2] = 0;        Rmat.Matrix[1, 3] = 0;
            Rmat.Matrix[2, 0] = sinya;   Rmat.Matrix[2, 1] = 0;   Rmat.Matrix[2, 2] = cosya;    Rmat.Matrix[2, 3] = 0;
            Rmat.Matrix[3, 0] = 0;       Rmat.Matrix[3, 1] = 0;   Rmat.Matrix[3, 2] = 0;        Rmat.Matrix[3, 3] = 1;

            // Merge matrix with master matrix:
            MergeMatrices(ref RMatrix, Rmat);

            MergeMatrix(RMatrix);    // now merge with this one.
        }
Esempio n. 3
0
        public void Rotate( double Xa, double Ya, double Za )
        {
            Matrix3D Rmat = new Matrix3D();
            Matrix3D RMatrix = new Matrix3D();
            double sinxa = Math.Sin(Xa);
            double cosxa = Math.Cos(Xa);
            double sinza = Math.Sin(Za);
            double cosza = Math.Cos(Za);
            double sinya = Math.Sin(Ya);
            double cosya = Math.Cos(Ya);
            Rmat.Identity();
            RMatrix.Identity();

            // Initialize Z rotation matrix - Note: we perform Z
            // rotation first to align the 3D Z axis with the 2D Z axis.
            Rmat.Matrix[0,0]=cosza;    Rmat.Matrix[0,1]=sinza;    Rmat.Matrix[0,2]=0;    Rmat.Matrix[0,3]=0;
            Rmat.Matrix[1,0]=-sinza;   Rmat.Matrix[1,1]=cosza;    Rmat.Matrix[1,2]=0;    Rmat.Matrix[1,3]=0;
            Rmat.Matrix[2,0]=0;        Rmat.Matrix[2,1]=0;        Rmat.Matrix[2,2]=1;    Rmat.Matrix[2,3]=0;
            Rmat.Matrix[3,0]=0;        Rmat.Matrix[3,1]=0;        Rmat.Matrix[3,2]=0;    Rmat.Matrix[3,3]=1;

            // Merge matrix with master matrix:
            MergeMatrices (ref RMatrix, Rmat );

            // Initialize X rotation matrix:
            Rmat.Matrix[0,0]=1;  Rmat.Matrix[0,1]=0;        Rmat.Matrix[0,2]=0;       Rmat.Matrix[0,3]=0;
            Rmat.Matrix[1,0]=0;  Rmat.Matrix[1,1]=cosxa;    Rmat.Matrix[1,2]=sinxa;   Rmat.Matrix[1,3]=0;
            Rmat.Matrix[2,0]=0;  Rmat.Matrix[2,1]=-sinxa;   Rmat.Matrix[2,2]=cosxa;   Rmat.Matrix[2,3]=0;
            Rmat.Matrix[3,0]=0;  Rmat.Matrix[3,1]=0;        Rmat.Matrix[3,2]=0;       Rmat.Matrix[3,3]=1;

            // Merge matrix with master matrix:
            MergeMatrices(ref RMatrix, Rmat);

            // Initialize Y rotation matrix:
            Rmat.Matrix[0,0]=cosya;   Rmat.Matrix[0,1]=0;   Rmat.Matrix[0,2]=-sinya;   Rmat.Matrix[0,3]=0;
            Rmat.Matrix[1,0]=0;       Rmat.Matrix[1,1]=1;   Rmat.Matrix[1,2]=0;        Rmat.Matrix[1,3]=0;
            Rmat.Matrix[2,0]=sinya;   Rmat.Matrix[2,1]=0;   Rmat.Matrix[2,2]=cosya;    Rmat.Matrix[2,3]=0;
            Rmat.Matrix[3,0]=0;       Rmat.Matrix[3,1]=0;   Rmat.Matrix[3,2]=0;        Rmat.Matrix[3,3]=1;

            // Merge matrix with master matrix:
            MergeMatrices (ref RMatrix, Rmat );

            MergeMatrix ( RMatrix ); // now merge with this one.
        }
Esempio n. 4
0
        public void Rotate(float x, float y, float z)
        {
            Point3d center = CalcCenter();

            Translate((float)-center.x, (float)-center.y, (float)-center.z);

            Matrix3D rotmat = new Matrix3D();

            rotmat.Identity();
            rotmat.Rotate(x, y, z);
            for (int c = 0; c < m_lstpoints.Count; c++)
            {
                Point3d p  = (Point3d)m_lstpoints[c];
                Point3d p1 = rotmat.Transform(p);
                p.x = p1.x;
                p.y = p1.y;
                p.z = p1.z;
            }
            Translate((float)center.x, (float)center.y, (float)center.z);
        }
        public void Rotate(float x, float y, float z) 
        {
            Point3d center = CalcCenter();
            Translate((float)-center.x, (float)-center.y, (float)-center.z);

            Matrix3D rotmat = new Matrix3D();
            rotmat.Identity();
            rotmat.Rotate(x, y, z);
            for(int c = 0; c< m_lstpoints.Count;c++)            
            {
                Point3d p = (Point3d)m_lstpoints[c];
                Point3d p1 = rotmat.Transform(p);
                p.x = p1.x;
                p.y = p1.y;
                p.z = p1.z;
            }
            Translate((float)center.x, (float)center.y, (float)center.z);
        }
Esempio n. 6
0
        public void Rotate(float x, float y, float z) 
        {
            Point3d center = CalcCenter();
            float cz = center.z;
            if ((x == 0) && (y == 0))
                cz = 0;
            // else - i think we need to delete all supports -SHS
            Translate((float)-center.x, (float)-center.y, (float)-cz);

            Matrix3D rotmat = new Matrix3D();
            rotmat.Identity();
            rotmat.Rotate(x, y, z);
            Rotate(rotmat);
            if ((x == 0) && (y == 0))
            {
                foreach (Object3d sup in m_supports)
                    sup.Rotate(rotmat);
            }
            Translate((float)center.x, (float)center.y, (float)cz);
        }
Esempio n. 7
0
 public void Reset()
 {
     viewmat.Identity();
     m_scalex = 22;
     m_scaley = 22;
 }