// ---------------------------------------------------------------------- // Returns true if a collision exists in the given node array. static bool DoesCollide(iCS_EditorObject[] nodes) { var len = nodes.Length; Rect[] rs = new Rect[len]; for (int i = 0; i < len; ++i) { rs[i] = nodes[i].AnimatedRect; } for (int i = 0; i < len - 1; ++i) { var r1 = AddMargins(rs[i]); for (int j = i + 1; j < len; ++j) { if (Math3D.DoesCollide(r1, rs[j])) { return(true); } } } return(false); }
// ---------------------------------------------------------------------- // Returns true if the given rectangle collides with the node. public static bool DoesCollideWithMargins(Rect r1, Rect r2) { return(Math3D.DoesCollide(AddMargins(r1), r2)); }