Am I a moron or is this correct?

K.I.L.E.R

Retarded moron
Veteran
I interpolated the vertices and used the normals as averages and got a center normal.
I used this averaged normal as the final normal to do intersections.
Oh I'm also intersecting a triangle and it works the same way as a sphere/plane/quadric.

You get equation to ray and put it into function of specified plane and solve for alpha.
So what is hard about this?
 
I interpolated the vertices and used the normals as averages and got a center normal. I used this averaged normal as the final normal to do intersections.
Assuming that the normals at each vertex are reasonably correct, then this should work all right. Though it is subject to some potential inaccuracies based on the mesh. A weighted sum of 1/3 * (each vertex position) should be the centroid, and hopefully, 1/3 * (each vertex normal) should be reasonably close to the surface normal. The "smoother" your mesh, the better if that's what you use. The more general method involves getting two edge vectors (vector from one vertex to both of the other two vertices). Take the cross product of these two and normalize and there's your surface normal.

This is dependent on winding order, though, so if you're not consistent with the winding order of your vertices, you may sometimes get the negative normal rather than the normal.

Oh I'm also intersecting a triangle and it works the same way as a sphere/plane/quadric.
Ummm... works the same way as a sphere/plane/quadric for what?

You get equation to ray and put it into function of specified plane and solve for alpha.
So what is hard about this?
Ummm... nothing hard per se. As long as you're just trying to solve for the intersection between the plane that the triangle is in and the ray. That ray-plane intersection alone won't tell you whether the point is inside the triangle.
 
It's not correct.
In some cases it might be an OK approximation, in many cases it's definitely not. The correct version is (as ShootMyMonkey says) the cross product of two edge vectors.
 
I've taken the cross product of: A-B, A-C, B-C and averaged them.

Return null if the ray is behind the plane or is orthogonal to the normal. Seems to work very well during visual testing.

That ray-plane intersection alone won't tell you whether the point is inside the triangle.
 
Am I to take from the inclusion of the extra quote that you're also interested in seeing whether the point of intersection with the plane is also inside the triangle?
 
Back
Top