Example #1
0
        public void ApplyTransform(Scene3D s)
        {
            TransformedFaces.Clear();
            MyAABB = new AABB();

            Matrix TrfM = TransformToMatrix();

            Figure3D ParrentF = s.Figs.Find(f => f.ID == this.ParrentID);
            Matrix   ParrentM = ParrentF != null?ParrentF.GetTrasnformRecursive(s, 0) : null;

            foreach (Plane3D F in Faces)
            {
                Plane3D newF = new Plane3D(F);
                for (int i = 0; i < 3; ++i)
                {
                    if (ParrentF != null)
                    {
                        newF.Vertex[i] = newF.Vertex[i].MultMatrix(ParrentM);
                    }
                    newF.Vertex[i] = newF.Vertex[i].MultMatrix(TrfM);
                    MyAABB.Extend(newF.Vertex[i]);
                }
                newF.ID = ID;
                newF.CalcNormal();
                TransformedFaces.Add(newF);
            }
        }
Example #2
0
        public Matrix GetTrasnformRecursive(Scene3D s, int Call = 0)
        {
            if (Call > 10)
            {
                return(new Matrix(Matrix.Identity(4)));
            }

            Figure3D ParrentF = s.Figs.Find(f => f.ID == this.ParrentID);

            if (ParrentF == null)
            {
                return(TransformToMatrix());
            }
            else
            {
                return(TransformToMatrix() * ParrentF.GetTrasnformRecursive(s, Call + 1));
            }
        }