There is some information but I couldn't figure it out: http://softsurfer.com/Archive/algori...gment-Triangle
How can I detect if a line intersects with a triangle ? And how can I detect the point of intersection in AS3 ?
There is some information but I couldn't figure it out: http://softsurfer.com/Archive/algori...gment-Triangle
How can I detect if a line intersects with a triangle ? And how can I detect the point of intersection in AS3 ?
That site looks like it gives a pretty thorough explanation of what needs to be done.
I assume you're trying to implement a function like this
What part is giving you trouble?Code:import flash.geom.Vector3D;
function intersectTriangleLineSegment(Vector3D V0, Vector3D V1, Vector3D V2, Vector3D P0, Vector3D P1) : Vector3D
{
var u = V1.subtract(V0);
var v = V2.subtract(V0);
var n = u.crossProduct(v);
// ....more stuff goes here
return null;
}
I solved my problem with an other technique. But your post may help others who google search this technique.