Exemplo n.º 1
0
        public List <EdgeIntersectionResult> CalculateMultipleIntersection(NavigationEdge edge, int maximum)
        {
            List <EdgeIntersectionResult> result = new List <EdgeIntersectionResult>();

            foreach (var poly in this)
            {
                if (poly.GetBoundingIntersection(edge))
                {
                    foreach (var constrainedEdge in poly.ConstraintedEdges)
                    {
                        var r = edge.CalculateIntersection(constrainedEdge);
                        if (r.SegmentsIntersect)
                        {
                            result.Add(r);
                        }

                        if (result.Count > maximum)
                        {
                            return(result);
                        }
                    }
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        public bool GetBoundingIntersection(NavigationEdge edge)
        {
            if (GetBoundingDistance(edge.A) == 0)
            {
                return(true);
            }

            if (GetBoundingDistance(edge.B) == 0)
            {
                return(true);
            }

            var bounding      = this.GetBounding();
            var otherBounding = new NavigationEdge(new DeterministicVector2(bounding.A.X, bounding.B.Y), new DeterministicVector2(bounding.B.X, bounding.A.Y));

            if (edge.CalculateIntersection(new NavigationEdge(bounding.A, otherBounding.B)).SegmentsIntersect)
            {
                return(true);
            }

            if (edge.CalculateIntersection(new NavigationEdge(otherBounding.B, bounding.B)).SegmentsIntersect)
            {
                return(true);
            }

            if (edge.CalculateIntersection(new NavigationEdge(bounding.B, otherBounding.A)).SegmentsIntersect)
            {
                return(true);
            }

            if (edge.CalculateIntersection(new NavigationEdge(otherBounding.A, bounding.A)).SegmentsIntersect)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        public EdgeIntersectionResult CalculateAnyIntersection(NavigationEdge edge)
        {
            foreach (var poly in this)
            {
                foreach (var constrainedEdge in poly.ConstraintedEdges)
                {
                    var result = edge.CalculateIntersection(constrainedEdge);
                    if (result.SegmentsIntersect)
                    {
                        return(result);
                    }
                }
            }

            return(new EdgeIntersectionResult());
        }