Sign in to follow this  
Mariusz Pilipczuk

Line intersecting a face

Recommended Posts

Hello.

I am creating a game and I am currently working on collision detection. My problem is the following:

If I have a 2D face (in 3D space) with num_vertices vertices, and an array of vertices named "vertices", how would I check if a line crosses through this face?

All help appreciated. Edited by Madd

Share this post


Link to post
Share on other sites
Hmm, good question. This is the easiest to do with triangles, I think.
I done a little raytracing a long while ago, and this question came up when I was trying to build a little engine. I've forgot the specifics of the implementation, but don't worry, there is plenty of information out there. For example [url="http://www.softsurfer.com/Archive/algorithm_0105/algorithm_0105.htm"]here[/url] and [url="http://www.siggraph.org/education/materials/HyperGraph/raytrace/raypolygon_intersection.htm"]here[/url].

If you want to do this for arbitrary polygons you may want to triangulate them first, but again, I forgot the specifics, so I'll leave it up to you to do some research. A little linear algebra skills may come in handy if you want to understand what's going on (or even try to find a way yourself).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this