Esempio n. 1
0
 public static void DrawAABB(GeoRect2 rect, Color clr)
 {
     Debug.DrawLine(rect.mP1, rect.mP2, clr);
     Debug.DrawLine(rect.mP3, rect.mP2, clr);
     Debug.DrawLine(rect.mP1, rect.mP4, clr);
     Debug.DrawLine(rect.mP3, rect.mP4, clr);
 }
Esempio n. 2
0
        public static bool IsPointInRect(GeoRect2 rect, Vector2 p)
        {
            Vector2 pc = p - rect.mCenter;
            float   pj = Vector2.Dot(rect.mDir1, pc);

            if (pj > rect.mSize[0])
            {
                return(false);
            }
            pj = Vector2.Dot(rect.mDir2, pc);
            if (pj > rect.mSize[1])
            {
                return(false);
            }
            return(true);
        }