Reputation: 5384
How would I go about getting the intersections of a "vertical" line which only has x, y coordinates that is parallel with the z-axis and a triangle of points v0, v1, v2?
Thanks in advance
Upvotes: 1
Views: 503
Reputation: 4191
There is a paper, describing a method to solve this problem using barycentric coordinates: Moller, Trumbore - Fast, Minimum Storage Ray/Triangle Intersection. They also have implementation in C.
Also, this algorithm is a foundation of almost all ray-tracing algorithms, so I think you can find its good implementation in the computer graphics area.
Upvotes: 0
Reputation: 98328
Since the Z is constant along your line, you can ignore the Z value of your points. Thus your problem is equivalent to check if the point (x,y) (the line) is inside the triangle v0,v1,v2, taking only their (x,y) values.
Checking if a point is inside a triangle should be quite easy...
Upvotes: 4