Exemple #1
0
        public override void FlipWithPlane(Vector3d p0, Vector3d normal)
        {
            VertexList vl = PointList;

            for (int i = 0; i < vl.Count; i++)
            {
                CadVertex v = vl[i];

                Vector3d cp = CadMath.CrossPlane(v.vector, p0, normal);

                CadVertex d = v - cp;

                v = cp - d;

                vl[i] = v;
            }

            Vector3dList nl = mHeModel.NormalStore;

            for (int i = 0; i < nl.Count; i++)
            {
                Vector3d v = nl[i];

                Vector3d cp = CadMath.CrossPlane(v, Vector3d.Zero, normal);

                Vector3d d = v - cp;

                v = cp - d;

                nl[i] = v;
            }
        }
Exemple #2
0
 public void DrawExtSnapPoints(Vector3dList pointList, DrawPen pen)
 {
     pointList.ForEach(v =>
     {
         DrawHighlightPoint(v, pen);
     });
 }
Exemple #3
0
        public static List <MpVector3d_v1002> Vector3dListToMp(Vector3dList v)
        {
            List <MpVector3d_v1002> ret = new List <MpVector3d_v1002>();

            for (int i = 0; i < v.Count; i++)
            {
                ret.Add(MpVector3d_v1002.Create(v[i]));
            }

            return(ret);
        }
Exemple #4
0
        public static Vector3dList Vector3dListFromMp(List <MpVector3d_v1002> list)
        {
            Vector3dList ret = new Vector3dList(list.Count);

            for (int i = 0; i < list.Count; i++)
            {
                ret.Add(list[i].Restore());
            }

            return(ret);
        }
Exemple #5
0
        public void DrawExtSnapPoints(Vector3dList pointList, DrawPen pen)
        {
            GL.Disable(EnableCap.Lighting);
            GL.Disable(EnableCap.Light0);

            Start2D();

            GL.LineWidth(DrawingConst.HighlightPointLineWidth);
            GL.Color4(pen.Color4());

            pointList.ForEach(v =>
            {
                DrawCross2D(DC.WorldPointToDevPoint(v), DrawingConst.HighlightPointLineLength);
            });

            GL.LineWidth(1);

            End2D();
        }
Exemple #6
0
        public void RecreateNormals()
        {
            Vector3dList newNormalStore = new Vector3dList(VertexStore.Count);

            int i;

            for (i = 0; i < FaceStore.Count; i++)
            {
                HeFace face = FaceStore[i];

                HalfEdge head = FaceStore[i].Head;
                HalfEdge c    = head;

                Vector3d n = CadMath.Normal(
                    VertexStore[c.Vertex].vector,
                    VertexStore[c.Next.Vertex].vector,
                    VertexStore[c.Next.Next.Vertex].vector
                    );

                face.Normal = newNormalStore.Add(n);

                for (; ;)
                {
                    c.Normal = newNormalStore.Add(n);

                    c = c.Next;

                    if (c == head)
                    {
                        break;
                    }
                }
            }

            NormalStore = newNormalStore;
        }
Exemple #7
0
 public HeModel()
 {
     VertexStore = new VertexList(8);
     FaceStore   = new FlexArray <HeFace>(6);
     NormalStore = new Vector3dList(8);
 }