예제 #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        ///     Returns a <see cref="T:System.String" /> that represents the current <see cref="T:System.Object" />.
        /// </summary>
        /// <remarks>	Darrellp, 2/21/2011. </remarks>
        /// <returns>
        ///     A <see cref="T:System.String" /> that represents the current <see cref="T:System.Object" />.
        /// </returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        public override string ToString()
        {
            var strStart = VtxStart?.ToString() ?? "Inf";
            var strEnd   = VtxEnd?.ToString() ?? "Inf";

            return(strStart + " - " + strEnd);
        }
예제 #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        ///     Determine if a point is to the left of this edge when facing from the start vertex to the end
        ///     vertex.
        /// </summary>
        /// <remarks>	Darrellp, 2/18/2011. </remarks>
        /// <param name="pt">	Point to check out. </param>
        /// <returns>	true if it succeeds, false if it fails. </returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        public bool FLeftOf(Vector pt)
        {
            // We should never have a start vertex at infinity
            //
            // Fortune.ProcessRay(), which creates the vertices at infinity, specifically makes sure that
            // this never happens (except with edges at infinity which are really placeholders for the
            // winged edge structure and have no position at all.  They aren't processed here (and if they
            // were, it would be a problem).  While this is a touch Fortune specific, there's no reason not to
            // insist on it in the general case.

            // If the end vtx is at infinity, convert it to a real point
            var pt1 = VtxStart.Pt;
            var pt2 = VtxEnd.FAtInfinity ? VtxEnd.ConvertToReal(pt1, 10) : VtxEnd.Pt;

            // Do the geometry on pt1 and pt2
            return(Geometry2D.FLeft(pt1, pt2, pt));
        }
예제 #3
0
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>	Ensure that this edge connects to the passed in edge. </summary>
 /// <remarks>	Darrellp, 2/18/2011. </remarks>
 /// <param name="edge">	Edge to check. </param>
 /// <returns>	True if this edge connects to the passed in edge, else false. </returns>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 internal bool FConnectsToEdge(WeEdge edge)
 {
     // Has to be adjacent to either our start or our end vertex
     return(VtxEnd.FValidateEdgeIsAdjacent(edge) || VtxStart.FValidateEdgeIsAdjacent(edge));
 }
예제 #4
0
        /// <summary>
        ///     Validate the edge information
        /// </summary>
        /// <returns></returns>
        internal bool Validate()
        {
            // RQS- All variables should be set
            if (VtxEnd == null)
            {
                return(Failure());
            }

            if (VtxStart == null)
            {
                return(Failure());
            }

            if (EdgeCCWPredecessor == null)
            {
                return(Failure());
            }

            if (EdgeCCWSuccessor == null)
            {
                return(Failure());
            }

            if (EdgeCWPredecessor == null)
            {
                return(Failure());
            }

            if (EdgeCWSuccessor == null)
            {
                return(Failure());
            }

            if (PolyLeft == null)
            {
                return(Failure());
            }

            if (PolyRight == null)
            {
                return(Failure());
            }
            // -RQS

            // RQS- Check adjacencies
            //
            // Make sure that we and all our CW/CCW successor/predecessor edges
            // are marked as adjacent in our start/end vertices
            if (!VtxEnd.FValidateEdgeIsAdjacent(this))
            {
                return(Failure());
            }

            if (!VtxStart.FValidateEdgeIsAdjacent(EdgeCCWPredecessor))
            {
                return(Failure());
            }

            if (!VtxEnd.FValidateEdgeIsAdjacent(EdgeCCWSuccessor))
            {
                return(Failure());
            }

            if (!VtxStart.FValidateEdgeIsAdjacent(EdgeCWPredecessor))
            {
                return(Failure());
            }

            if (!VtxEnd.FValidateEdgeIsAdjacent(EdgeCWSuccessor))
            {
                return(Failure());
            }

            if (!VtxStart.FValidateEdgeIsAdjacent(this))
            {
                return(Failure());
            }
            // -RQS

            // RQS- Check adjacency of all listed edges to the proper polygons
            if (!PolyLeft.FValidateEdgeIsAdjacent(this))
            {
                return(Failure());
            }

            if (!PolyRight.FValidateEdgeIsAdjacent(this))
            {
                return(Failure());
            }

            if (!PolyLeft.FValidateEdgeIsAdjacent(EdgeCWSuccessor))
            {
                return(Failure());
            }

            if (!PolyLeft.FValidateEdgeIsAdjacent(EdgeCCWPredecessor))
            {
                return(Failure());
            }

            if (!PolyRight.FValidateEdgeIsAdjacent(EdgeCCWSuccessor))
            {
                return(Failure());
            }

            if (!PolyRight.FValidateEdgeIsAdjacent(EdgeCWPredecessor))
            {
                return(Failure());
            }
            // -RQS

            return(true);
        }