Class BspNode
Represents a node in a BSP tree.
Inheritance
object
BspNode
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: InsaneScatterbrain.MapGraph
Syntax
public class BspNode
Constructors
BspNode()
Declaration
public BspNode()
BspNode(BspTree, BspNode, RectInt)
Creates a new BSP node.
Declaration
[Obsolete("Please use the pool manager to get a BspNode instance. This constructor will probably be removed in version 2.0. Alternatively, use the parameterless constructor and call the Set method.")]
public BspNode(BspTree bspTree, BspNode parent, RectInt bounds)
Parameters
Type | Name | Description |
---|---|---|
BspTree | bspTree | The BSP tree. |
BspNode | parent | The node's parent. |
UnityEngine.RectInt | bounds | The node's bounds. |
Properties
Bounds
Gets the bounds of this node.
Declaration
public RectInt Bounds { get; }
Property Value
Type | Description |
---|---|
UnityEngine.RectInt |
LeftChild
Gets the left child.
Declaration
public BspNode LeftChild { get; }
Property Value
Type | Description |
---|---|
BspNode |
Parent
Gets the parent node.
Declaration
public BspNode Parent { get; }
Property Value
Type | Description |
---|---|
BspNode |
RightChild
Gets the right child.
Declaration
public BspNode RightChild { get; }
Property Value
Type | Description |
---|---|
BspNode |
Sibling
Gets this node's sibling.
Declaration
public BspNode Sibling { get; }
Property Value
Type | Description |
---|---|
BspNode |
Methods
GetLeafClosestToPoint(Vector2)
Gets the leaf closest to this node, based on the given point.
Declaration
public BspNode GetLeafClosestToPoint(Vector2 point)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Vector2 | point | The point. |
Returns
Type | Description |
---|---|
BspNode | The closest leaf node. |
Reset()
Declaration
public void Reset()
Set(BspTree, BspNode, RectInt)
Declaration
public void Set(BspTree tree, BspNode parentNode, RectInt leafBounds)
Parameters
Type | Name | Description |
---|---|---|
BspTree | tree | |
BspNode | parentNode | |
UnityEngine.RectInt | leafBounds |
Split(BspNode, BspNode, float, bool)
Split the BSP node in two. Creating two new nodes.
Declaration
public void Split(BspNode leftChildNode, BspNode rightChildNode, float splitPoint = 0.5, bool splitVertical = false)
Parameters
Type | Name | Description |
---|---|---|
BspNode | leftChildNode | The node to assign left child data to. |
BspNode | rightChildNode | The node to assign right child data to. |
float | splitPoint | The split point between 0 and 1, where .5 is the center. |
bool | splitVertical | If true, the node is split vertically, else horizontally. |
Split(float, bool)
Split the BSP node in two. Creating two new nodes.
Declaration
[Obsolete("Will be removed in version 2.0. Please use the version passing the BSP nodes.")]
public void Split(float splitPoint = 0.5, bool splitVertical = false)
Parameters
Type | Name | Description |
---|---|---|
float | splitPoint | The split point between 0 and 1, where .5 is the center. |
bool | splitVertical | If true, the node is split vertically, else horizontally. |