Esempio n. 1
0
        public bool Intersects(BoundingPolygon polygon)
        {
            bool result;

            Intersects(ref polygon, out result);
            return(result);
        }
Esempio n. 2
0
        // Duplicates with BoundingRectangle.
        public void Contains(ref BoundingPolygon polygon, out Containment result)
        {
            Contract.Requires(polygon != null);
            Contract.Requires(polygon.Vertices != null);

            var vertices = polygon.Vertices;

            result = Containment.Unknown;
            for (var index = 0; index < vertices.Length && result != Containment.Intersects; ++index)
            {
                Containment con;
                Contains(ref vertices[index], out con);
                result |= con;
            }

            if (result == Containment.Disjoint)
            {
                bool test;
                polygon.Intersects(ref this, out test);
                if (test)
                {
                    result = Containment.Intersects;
                }
            }
        }
Esempio n. 3
0
        public bool Intersects(BoundingPolygon polygon)
        {
            bool result;

            polygon.Intersects(ref this, out result);
            return(result);
        }
Esempio n. 4
0
        public Containment Contains(BoundingPolygon polygon)
        {
            Containment result;

            Contains(ref polygon, out result);
            return(result);
        }
Esempio n. 5
0
        public void Intersects(ref BoundingPolygon polygon, out float result)
        {
            Contract.Requires(polygon != null);
            Contract.Requires(polygon.Vertices != null);

            polygon.Intersects(ref this, out result);
        }
Esempio n. 6
0
        public void Intersects(ref BoundingPolygon polygon, out bool result)
        {
            Contract.Requires(polygon != null);
            Contract.Requires(polygon.Vertices != null);
            Contract.Requires(polygon.Vertices.Length > 2);

            var vertices = polygon.Vertices;

            CheckVerticesForIntersection(vertices, out result);
        }
Esempio n. 7
0
        public Containment Contains(BoundingPolygon polygon)
        {
            Contract.Requires(polygon != null);
            Contract.Requires(polygon.Vertices != null);

            Containment result;

            Contains(ref polygon, out result);
            return(result);
        }
Esempio n. 8
0
        public float Intersects(BoundingPolygon polygon)
        {
            Contract.Requires(polygon != null);
            Contract.Requires(polygon.Vertices != null);

            float result;

            polygon.Intersects(ref this, out result);
            return(result);
        }
Esempio n. 9
0
        public bool Intersects(BoundingPolygon polygon)
        {
            Contract.Requires(polygon != null);
            Contract.Requires(polygon.Vertices != null);
            Contract.Requires(polygon.Vertices.Length > 1);

            bool result;

            polygon.Intersects(ref this, out result);
            return(result);
        }
Esempio n. 10
0
        public static void FromVectors(Vector2[] vertices, out BoundingCircle result)
        {
            Contract.Requires(vertices != null);
            Contract.Requires(vertices.Length > 2);

            BoundingPolygon.GetCentroid(vertices, out result.Center);
            result.Radius = -1;
            for (var index = 0; index < vertices.Length; ++index)
            {
                float distSq;
                Vectors2.DistanceSq(ref result.Center, ref vertices[index], out distSq);
                if (result.Radius == -1 || (distSq < result.Radius))
                {
                    result.Radius = distSq;
                }
            }

            result.Radius = (float)Math.Sqrt(result.Radius);
        }
Esempio n. 11
0
        public void Intersects(ref BoundingPolygon polygon, out bool result)
        {
            Contract.Requires(polygon != null);

            polygon.Intersects(ref this, out result);
        }