Original Post
🔒 Locked
Triangular Collision
Advertisement
Each triangle consists of three line segments, if two segments of different triangles intersect you know there''s a collision. You might want to handle special cases like two segments being coincident.
Another way is to check wether one of the vertices (let''s call it A) of a triangle lies within another triangle (consisting of segments a, b and c). A way to do this is to compute the number of intersections between {a,b,c} and a line AX from A to a point X outside the screen. If the resulting number is 1, A lies within the triangle, if not, it doesn''t. Special cases you might come across are one of the vertices of the triangle being element of AX or AX being (partially) coincident with a, b or c (this will happen if A is element of {a,b,c} or it might also happen if A is not within the triangle).
Hope that helped.
------------------------------------------------------------
"To a computer, chaos is just another kind of order."
Another way is to check wether one of the vertices (let''s call it A) of a triangle lies within another triangle (consisting of segments a, b and c). A way to do this is to compute the number of intersections between {a,b,c} and a line AX from A to a point X outside the screen. If the resulting number is 1, A lies within the triangle, if not, it doesn''t. Special cases you might come across are one of the vertices of the triangle being element of AX or AX being (partially) coincident with a, b or c (this will happen if A is element of {a,b,c} or it might also happen if A is not within the triangle).
Hope that helped.
------------------------------------------------------------
"To a computer, chaos is just another kind of order."
Almost forgot:
In my previous post I asume you''re talking about triangles in 2D. In 3D space the above won''t work and you''ll have to bother with intersecting planes and other nice stuff.
------------------------------------------------------------
"To a computer, chaos is just another kind of order."
In my previous post I asume you''re talking about triangles in 2D. In 3D space the above won''t work and you''ll have to bother with intersecting planes and other nice stuff.
------------------------------------------------------------
"To a computer, chaos is just another kind of order."
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement