Esempio n. 1
0
        public Vertex CreateVertex()
        {
            Vertex v = OwnerMesh.CreateVertex();

            AddVertex(v);
            return(v);
        }
Esempio n. 2
0
        public Edge Split(double split_param)
        {
            //calculate position of new vertex
            Point3D p0     = Vertices[0].Pos;
            Point3D p1     = Vertices[1].Pos;
            Point3D splitp = p0 + (p1 - p0) * split_param;

            //create the new vertex and set it up
            Vertex first_vertex = Vertices[0];
            Vertex last_vertex  = Vertices[1];
            Vertex new_vertex   = OwnerMesh.CreateVertex();

            new_vertex.Pos = splitp;                        //it's at the split point

            //create new edge
            Edge new_edge = OwnerMesh.CreateEdge();

            //link new vert/edge into owning faces
            foreach (Face f in OwnerFaces)
            {
                f.AddVertex(new_vertex);
                f.InsertEdge(new_edge, this);
            }

            //fix up the new edges
            SetVertex(0, first_vertex);
            SetVertex(1, new_vertex);
            new_edge.SetVertex(0, new_vertex);
            new_edge.SetVertex(1, last_vertex);

            return(new_edge);
        }