<scene>.intersect

This command will intersect a line with the world

 

<scene>.intersect(
    lineBegin    
    lineEnd    
    all = False    
    ignoreBackFace = False    

)

 

lineBegin

[x,y,z] position of begin point of intersection line.


lineEnd

[x,y,z] position of end point of intersection line.


all = False

If True, causes intersect to return a list of intersect objects for all intersections, not just the first.


ignoreBackFace = False

If True, back facing polygons will be ignored during the intersection test.


Remarks

This command checks if the specified line intersects with any objects in the scene. It will return a viz.Intersect object containing info about the intersection results.

Return Value

The return value is a viz.Intersect object or a list of viz.Intersect objects if parameter all is true.

The following is a list of fields of the viz.Intersect object:

Attribute

valid

True if the line intersected, False if it didn't.

point

The point the line intersected with the object.

normal

The normal vector of the intersect point.

object

The geometry object the line intersected with.

name

The name of the subobject that the line intersected with.

Example

info = viz.Scene2.intersect([0,0,0],[0,0,4])
if info.valid:
    print 'Intersected with object id:', info.object.id
    print 'Intersected at location: ', info.point