Example #1
0
        internal bool MoveVertex(Vertex v, Point p)
        {
            Vertex vertex = clone.Vertices.GetVertexAt(Vertices.GetIndex(v));

            vertex.Move(p.X, p.Y);
            vertex.EnforceConstraints(vertex, vertex.Prev);

            if (!CheckClonePositions())
            {
                return(false);
            }
            if (!CheckCloneConstraints(vertex))
            {
                return(false);
            }

            v.Move(p.X, p.Y);
            v.EnforceConstraints(v, v.Prev);
            return(true);
        }
Example #2
0
        public void AddSideConstraint(Vertex v, Vertex.SideConstraint sideConstraint)
        {
            Vertex vertex = clone.Vertices.GetVertexAt(Vertices.GetIndex(v));

            if (!vertex.AddSideConstraint(sideConstraint))
            {
                return;
            }
            vertex.EnforceConstraints(vertex, vertex.Prev);

            if (!CheckClonePositions())
            {
                return;
            }
            if (!CheckCloneConstraints(vertex))
            {
                return;
            }

            v.AddSideConstraint(sideConstraint);
            v.EnforceConstraints(v, v.Prev);
        }
Example #3
0
        public void AddAngleConstraint(Vertex v, double angle, Vertex.VertexConstraint vertexConstraint)
        {
            Vertex vertex = clone.Vertices.GetVertexAt(Vertices.GetIndex(v));

            if (!vertex.AddAngleConstraint(angle))
            {
                return;
            }
            vertex.EnforceConstraints(vertex, vertex.Prev);

            if (!CheckClonePositions())
            {
                return;
            }
            if (!CheckCloneConstraints(vertex))
            {
                return;
            }

            v.Angle = angle;
            v.AddAngleConstraint(angle);
            v.EnforceConstraints(v, v.Prev);
        }