Exemple #1
0
        private void ScaleWireframe(ref WIREFRAME wf, float aX, float aY, float aZ)
        {
            // Thực hiện phép Scale cho các khối 3D

            // Biến đổi tất cả các đỉnh
            for (int i = 0; i < wf.Vert.Count(); i++)
            {
                wf.Vert[i] = ScalePoint(wf.Vert[i], aX, aY, aZ);
            }

            // Biến đổi tất cả các cạnh
            for (int j = 0; j < wf.Edge.Count(); j++)
            {
                wf.Edge[j].p_start = ScalePoint(wf.Edge[j].p_start, aX, aY, aZ);
                wf.Edge[j].p_end   = ScalePoint(wf.Edge[j].p_end, aX, aY, aZ);
            }

            // Biến đổi tất cả các đa giác
            for (int k = 0; k < wf.Polygon.Count(); k++)
            {
                for (int l = 0; l < wf.Polygon[k].aVertex.Count(); l++)
                {
                    wf.Polygon[k].aVertex[l] = ScalePoint(wf.Polygon[k].aVertex[l], aX, aY, aZ);
                }
            }
        }
Exemple #2
0
 private void TranslationWireframe(ref WIREFRAME wf, POINT3D oldCoord, POINT3D newCoord)
 {
     // Thực hiện phép tịnh tiến cho khối 3D
     // Biến đổi tất cả các đỉnh
     for (int i = 0; i < wf.Vert.Count(); i++)
     {
         wf.Vert[i] = TranslationPoint(wf.Vert[i], oldCoord, newCoord);
     }
     // Biến đổi tất cả các cạnh
     for (int j = 0; j < wf.Edge.Count(); j++)
     {
         wf.Edge[j].p_start = TranslationPoint(wf.Edge[j].p_start, oldCoord, newCoord);
         wf.Edge[j].p_end   = TranslationPoint(wf.Edge[j].p_end, oldCoord, newCoord);
     }
     // Biến đổi tất cả các đa giác
     for (int k = 0; k < wf.Polygon.Count(); k++)
     {
         for (int l = 0; l < wf.Polygon[k].aVertex.Count(); l++)
         {
             wf.Polygon[k].aVertex[l] = TranslationPoint(wf.Polygon[k].aVertex[l], oldCoord, newCoord);
         }
     }
 }
Exemple #3
0
 private void RotateWireframe(ref WIREFRAME wf, float alphaX, float alphaY, float alphaZ)
 {
     // Thực hiện phép xoay biến đổi khối 3D
     // Biến đổi tất cả các điểm
     for (int i = 0; i < wf.Vert.Count(); i++)
     {
         wf.Vert[i] = RotatePoint(wf.Vert[i], alphaX, alphaY, alphaZ);
     }
     // Biến đổi tất cả các cạnh
     for (int j = 0; j < wf.Edge.Count(); j++)
     {
         wf.Edge[j].p_start = RotatePoint(wf.Edge[j].p_start, alphaX, alphaY, alphaZ);
         wf.Edge[j].p_end   = RotatePoint(wf.Edge[j].p_end, alphaX, alphaY, alphaZ);
     }
     // Biến đổi tất cả các đa giác
     for (int k = 0; k < wf.Polygon.Count(); k++)
     {
         for (int l = 0; l < wf.Polygon[k].aVertex.Count(); l++)
         {
             wf.Polygon[k].aVertex[l] = RotatePoint(wf.Polygon[k].aVertex[l], alphaX, alphaY, alphaZ);
         }
     }
 }