Ejemplo n.º 1
0
        public static void DrawAABB(GeoAABB2 aabb, Color clr)
        {
            Vector2 min = aabb.mMin;
            Vector2 max = aabb.mMax;
            Vector2 p2  = new Vector2(max[0], min[1]);
            Vector2 p4  = new Vector2(min[0], max[1]);

            Debug.DrawLine(min, p2, clr);
            Debug.DrawLine(max, p2, clr);
            Debug.DrawLine(max, p4, clr);
            Debug.DrawLine(min, p4, clr);
        }
Ejemplo n.º 2
0
        public static GeoAABB2 GetAABB(List <Vector2> points)
        {
            GeoAABB2 aabb = new GeoAABB2();

            if (points.Count > 0)
            {
                aabb.mMin = points[0];
                aabb.mMax = points[0];
                for (int i = 1; i < points.Count; ++i)
                {
                    aabb.mMax = Vector2.Max(aabb.mMax, points[i]);
                    aabb.mMin = Vector2.Max(aabb.mMin, points[i]);
                }
            }
            return(aabb);
        }