<node3d>.intersect

Perform an intersection on the current node and the line.

 

<node3d>.intersect(
    lineBegin    
    lineEnd    
    all = False    
    mode = viz.REL_PARENT    
    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.


mode = viz.REL_PARENT

Reference frame to perform the intersection test in. Can be one of the following values:

Mode

viz.ABS_PARENT
viz.REL_PARENT

Perform the intersection in the parents coordinate system.

viz.ABS_GLOBAL
viz.REL_GLOBAL

Perform the intersection in the global coordinate system.

viz.ABS_LOCAL
viz.REL_LOCAL

Perform the intersection in the node local coordinate system.


ignoreBackFace = False

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


Remarks

This command checks if the specified line intersects with the node. 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

floor = viz.add('tut_ground.wrl')
box = viz.add('box.wrl')
a = box.intersect([0,-1,0],[0,1,0])
a.object.color(viz.BLUE)


Sets the box blue.

See also

<viz>.pick
<viz>.intersect