public static void DrawAABB(GeoRect3 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); }
public static bool IsPointInRect(GeoRect3 rect, Vector3 p) { Vector3 pc = p - rect.mP1; float pj = Vector3.Dot(rect.mDir1, pc); if (pj < 0 || pj > rect.mSize[0]) { return(false); } pj = Vector3.Dot(rect.mDir2, pc); if (pj < 0 || pj > rect.mSize[1]) { return(false); } return(true); }