Intersect
Intersect(vec1, vec2, vec3, ray, orig, clip)
Note:
Returns None if the ray
doesn't intersect the triangle.
Returns the intersection between a ray and a triangle, if possible,
return None otherwise.
Return Type: Vector
vec1
Type: 3D
Vector (1st corner of the triangle)
vec2
Type: 3D
Vector (2nd corner of the triangle)
vec3
Type: 3D
Vector (3rd corner of the triangle)
ray
Type: 3D
Vector
The orientation of the ray. The length of the ray is not used
orig
Type:
3D Vector
The origin of the ray.
clip
Type:
integer
0 = don't restrict the intersection to the area of the
triangle
(Use the
infinite plane defined by the triangle.)
1 = restrict to intersection with triangle area
Sample
Code
# import Mathutils
import Mathutils
# create 1st vector for 1st corner
vec1 = Mathutils.Vector( 0.0, 0.0, 0.0)
# create 2nd vector for 2nd corner
vec2 = Mathutils.Vector (6.0, 0.0, 0.0)
# create 3rd vector for 3rd corner
vec3 = Mathutils.Vector( 0.0, 0.0, 6.0)
# create ray vector
ray = Mathutils.Vector( 0.0, 1.0, 0.0)
# create origin vector
orig = Mathutils.Vector(2.0, -2.0, 2.0)
# get intersection for an infinite plane
vecIntersect = Mathutils.Intersect(vec1, vec2, vec3, ray, orig, 0)
|