Jump to content
  • Advertisement
Sign in to follow this  
onnel

D3DXIntersectTri and D3DXPlaneIntersectLine

This topic is 4732 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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(
				&v0,
				&v1,
				&v2,
				origRay,
				endRay,
				&u,
				&v,
				&dist
			);

			if (met) {
				D3DXPLANE   planeGround;
				D3DXPlaneFromPoints( &planeGround, 
									&v0,
									&v1,
									&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
Advertisement
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?

Onnel

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!