Example #1
0
 /// <summary>
 /// Determines if a gEdge is inside the gPolygon by comparing
 /// it's start, end and mid vertices.
 /// Note: Prone to error if polygon has edges intersecting the edge not at mid vertex?
 /// </summary>
 /// <param name="edge"></param>
 /// <returns></returns>
 public bool ContainsEdge(Edge edge)
 {
     // TODO: Check if edge intersects polygon in vertices different than start/end.
     return(this.ContainsVertex(edge.StartVertex) &&
            this.ContainsVertex(edge.EndVertex) &&
            this.ContainsVertex(Vertex.MidVertex(edge.StartVertex, edge.EndVertex)));
 }
Example #2
0
        //Vector-plane intersection https://math.stackexchange.com/questions/100439/determine-where-a-vector-will-intersect-a-plane

        #region Public Methods

        /// <summary>
        /// Returns the mid point between two points.
        /// </summary>
        /// <param name="point1"></param>
        /// <param name="point2"></param>
        /// <returns></returns>
        public static Point MidPoint(Point point1, Point point2)
        {
            Vertex midVertex = Vertex.MidVertex(ToVertex(point1), ToVertex(point2));

            return(ToPoint(midVertex));
        }