SolidKit3D.Math3D.LineTriangleIntersection

From Solid Graphics Wiki

Jump to: navigation, search
SolidKit3D.Math3D.LineTriangleIntersection
Namespace: SolidKit3D
Member of: Math3D class
Assembly: SolidKit.dll

The LineTriangleIntersection function calculates a line's intersection with a triangle.

public static int LineTriangleIntersection
         (
         ref Point start,
         ref Point end,
         ref Point vert0,
         ref Point vert1,
         ref Point vert2,
         float[] t
         );


Parameters

start x,y,z coordinates of line's first definition point.
end x,y,z coordinates of line's second definition point.
vert0 x,y,z coordinates of the first point defining the triangle.
vert1 x,y,z coordinates of the second point defining the triangle.
vert2 x,y,z coordinates of the third point defining the triangle.
t float array of at least length of 2. if line intersects the triangle then position of the intersection point will be stored in t[ 0 ]. If return value is 2 then position of two edge points where the line intersects the triangle will be stored in t[ 0 ] and t[ 1 ]. The point position(s) can be then translated to it's (their) coordinates using the Math3D.LinePositionToPoint function.

Return Value

The function returns 0 if the line and the triangle do not intersect, 1 if the line intersects the triangle in one point, 2 if the line lies in the triangle's plane and intersects it in more than one triangle's edge.

See Also


   


SolidKit Library Documentation

Personal tools