# D3DXIntersectTri and D3DXPlaneIntersectLine

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

## 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 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?

Onnel

1. 1
2. 2
Rutin
19
3. 3
khawk
19
4. 4
5. 5
A4L
11

• 9
• 12
• 16
• 26
• 10
• ### Forum Statistics

• Total Topics
633771
• Total Posts
3013761
×