Triangle - Rectangle Intersection in 2D
Posted
by
Kevin Boyd
on Game Development
See other posts from Game Development
or by Kevin Boyd
Published on 2011-02-09T13:44:20Z
Indexed on
2011/02/09
15:34 UTC
Read the original article
Hit count: 553
I had previously asked this for 3D but now I changed my strategy and would like to do the intersection in 2D.
The Rectangle is axis aligned and will always be in a fixed position, and has a constant shape and size, basically I want to clip the red areas of the triangles that extend outside the bounds of the rectangle The triangles could be in any position, shape or size, I my code I have a loop where I check the triangles one by one however I am still clueless about the math.
I have identified 5 cases of triangle rectangle intersection as shown here.
How do I find the intersection points of the triangle and the rectangle?
© Game Development or respective owner