Packagecom.derschmale.wick3d.core.bsp
Classpublic class BspNode
SubclassesBspTree

A BspNode object can be either a branch or a leaf in a BSP tree. A branch is divided into two half-spaces: a positive and a negative one, each on the side of a dividing plane. Those half-spaces form new BSP nodes, either another branch or a leaf. That way, the whole space is subdivided into smaller recursive regions. A leaf is the end of a branch, containing triangles present in that region. It is not divided any further.



Public Properties
 PropertyDefined by
  negativeChild : BspNode
This node's child node on the negative side of the partition plane.
BspNode
  partitionPlane : Plane
The partition plane used to divide this node.
BspNode
  positiveChild : BspNode
This node's child node on the positive side of the partition plane.
BspNode
Public Methods
 MethodDefined by
  
BspNode(parent:BspNode = null)
Creates a new BspNode object.
BspNode
  
addTriangle(triangle:Triangle3D):void
Adds a triangle to the node.
BspNode
  
addTriangles(triangles:Array):void
Adds an array of triangles to the node.
BspNode
  
build():void
Builds the BSP tree from this node on.
BspNode
  
Return the leaf (most specific) node containing an object's origin point.
BspNode
  
render(camera:Camera3D, graphics:Graphics):void
Traverses the bsp-node with this node as a starting point and draws the triangles contained within.
BspNode
Property detail
negativeChildproperty
negativeChild:BspNode  [read-write]

This node's child node on the negative side of the partition plane.

Implementation
    public function get negativeChild():BspNode
    public function set negativeChild(value:BspNode):void
partitionPlaneproperty 
partitionPlane:Plane  [read-write]

The partition plane used to divide this node. This will be null if the node is a leaf.

Implementation
    public function get partitionPlane():Plane
    public function set partitionPlane(value:Plane):void

See also

positiveChildproperty 
positiveChild:BspNode  [read-write]

This node's child node on the positive side of the partition plane.

Implementation
    public function get positiveChild():BspNode
    public function set positiveChild(value:BspNode):void
Constructor detail
BspNode()constructor
public function BspNode(parent:BspNode = null)

Creates a new BspNode object.

Parameters
parent:BspNode (default = null) — The parent BspNode which contains the current node.
Method detail
addTriangle()method
public function addTriangle(triangle:Triangle3D):void

Adds a triangle to the node.

Parameters
triangle:Triangle3D — The triangle to add.

See also

addTriangles()method 
public function addTriangles(triangles:Array):void

Adds an array of triangles to the node.

Parameters
triangles:Array — The triangles to add.

See also

build()method 
public function build():void

Builds the BSP tree from this node on. It creates new child nodes if necessary, and invokes the function on the new children.

childNodeContaining()method 
public function childNodeContaining(object:SpatialObject3D):BspNode

Return the leaf (most specific) node containing an object's origin point.

Parameters
object:SpatialObject3D — The SpatialObject3D of which the position needs to be checked.

Returns
BspNode

See also

render()method 
public function render(camera:Camera3D, graphics:Graphics):void

Traverses the bsp-node with this node as a starting point and draws the triangles contained within.

Parameters
camera:Camera3D — The camera used to determine on which side of the dividing plane it is, defining the order in which the BSP tree is traversed.
 
graphics:Graphics — The target Graphics object to draw to.

See also