-
-
Notifications
You must be signed in to change notification settings - Fork 18
rectangle_in_rectangle_all
Vašek edited this page Feb 10, 2019
·
5 revisions
Returns a list of all the positions where the given rectangles intersect
rectangle_in_rectangle_all(r1, r2)
Argument | Description |
---|---|
RotatedRectangle r1 |
The first rectangle |
RotatedRectangle r2 |
The other rectangle |
Returns: list <Vector2>
This function returns a list of all positions - in Vector2
format - where the given rectangles intersect.
List<Vector2> list = new List<Vector2>();
Vector2 p1r1 = new Vector2(0, 0);
Vector2 p2r1 = new Vector2(0, 16);
Vector2 p3r1 = new Vector2(16, 16);
Vector2 p4r1 = new Vector2(16, 0);
RotatedRectangle r1 = new RotatedRectangle(p1r1, p2r1, p3r1, p4r1);
Vector2 p1r2 = new Vector2(8, 8);
Vector2 p2r2 = new Vector2(8, 24);
Vector2 p3r2 = new Vector2(24, 24);
Vector2 p4r2 = new Vector2(24, 8);
RotatedRectangle r2 = new RotatedRectangle(p1r2, p2r2, p3r2, p4r2);
list = rectangle_in_rectangle_all(r1, r2);
This function will save positions: 8, 16 and 16, 8 to list
.
Back to Raycasting