Sign in to follow this  

D3DXIntersectTri and D3DXPlaneIntersectLine

Recommended Posts

I seem to be getting different results for the two methods D3DXIntersectTri and D3DXPlaneIntersectLine. The mistake is surely on my side, but I'm hoping someone can point out the error in my logic. Here are the calls which return different values.
			BOOL met = D3DXIntersectTri(

			if (met) {
				D3DXPLANE   planeGround;
				D3DXPlaneFromPoints( &planeGround, 
									&v2 );

				D3DXPlaneIntersectLine(intersection,	&planeGround, origRay, endRay);

The x and z values which I get for intersection do not fall within the three points used to define the triangle. All help is appreciated, as I'm banging my head on what is surely just a dumb mistake! Onnel

Share this post

Link to post
Share on other sites
Would anyone be willing to try the code I wrote? It should be more or less copy-and-pastable to any D3D project.

I am wondering why D3DXIntersectTri (with 3 points) and D3DXPlaneIntersectLine (with a plane made from the same 3 points) methods seem to deliver different results with the following input:

origRay = {x=-13.256511 y=871.54504 z=-50.360813 }
endRay = {x=530.47266 y=-820.00000 z=1099.1875 }

v0 = {x=32.000000 y=790.50000 z=56.000000 }
v1 = {x=40.000000 y=790.50000 z=56.000000 }
v2 = {x=40.000000 y=790.50000 z=64.000000 }

intersection = {x=12.794559 y=790.50000 z=4.7161674 }

These results make no sense to me as, the D3DXPlaneIntersectLine call should only be made if the intersection point is with in the triangle v0,v1,v2, which it is clearly not.

Can anyone help me make sense of these results?


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