field.kit.math.geometry

Octree

class Octree extends AABB

Direct port of Karsten Schmidts PointOctree.java to Scala/ FieldKit

Implements a spatial subdivision tree to work efficiently with large numbers of 3D particles. This octree can only be used for particle type objects and does NOT support 3D mesh geometry as other forms of Octrees do.

Inherits

  1. AABB
  2. Vec3
  3. Product
  4. Equals
  5. Vec
  6. AnyRef
  7. Any

Value Members

  1. def apply(sphere: Sphere, result: ArrayBuffer[Vec]): ArrayBuffer[Vec]

    Selects all stored points within the given sphere volume

    Selects all stored points within the given sphere volume

  2. def apply(box: AABB, result: ArrayBuffer[Vec]): ArrayBuffer[Vec]

    Selects all stored points within the given axis-aligned bounding box

    Selects all stored points within the given axis-aligned bounding box.

    box

    AABB

    result

    the ArrayBuffer

    returns

    all points with the box volume

  3. def apply(p: Vec): Octree

    Finds the leaf node which spatially relates to the given point

    Finds the leaf node which spatially relates to the given point

    p

    point to check

    returns

    leaf node or null if point is outside the tree dimensions

  4. def canEqual(arg0: Any): Boolean

  5. var children: Array[Octree]

    Stores the child nodes of this node

    Stores the child nodes of this node

  6. def clear: Unit

    Clears all children and data of this node

    Clears all children and data of this node

  7. def clone(): Vec3

    This method creates and returns a copy of the receiver object

    This method creates and returns a copy of the receiver object.

    The default implementation of the clone method is platform dependent.

    definition classes: Vec3 ⇐ AnyRef
  8. def contains(p: Vec): Boolean

    definition classes: AABB
  9. val depth: Int

  10. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    The default implementations of this method is an equivalence relation:

    • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
    • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
    • It is transitive: for any instances x, y, and z of type AnyRef if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

    If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is often necessary to override hashCode to ensure that objects that are "equal" (o1.equals(o2) returns true) hash to the same Int (o1.hashCode.equals(o2.hashCode)).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    definition classes: Vec3 ⇐ Equals ⇐ AnyRef ⇐ Any
  11. def extent: Vec3

  12. def extent_=(v: Vec3): Unit

  13. val halfSize: Vec3

  14. def hashCode(): Int

    Returns a hash code value for the object

    Returns a hash code value for the object.

    The default hashing algorithm is platform dependent.

    Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

    definition classes: Vec3 ⇐ AnyRef ⇐ Any
  15. def insert(p: Vec): Boolean

    Adds a new point/particle to the tree structure

    Adds a new point/particle to the tree structure. All points are stored within leaf nodes only. The tree implementation is using lazy instantiation for all intermediate tree levels.

    p
    returns

    true, if point has been added successfully

  16. def intersects(center: Vec, radius: Float): Boolean

    definition classes: AABB
  17. def intersects(sphere: Sphere): Boolean

    definition classes: AABB
  18. def intersects(box: AABB): Boolean

    definition classes: AABB
  19. def leafForPoint(p: Vec): Octree

    Alias for apply(p:Vec)

    Alias for apply(p:Vec)

  20. var max: Vec3

  21. var min: Vec3

  22. var minSize: Float

    Alternative tree recursion limit, number of world units when cells are not subdivided any further

    Alternative tree recursion limit, number of world units when cells are not subdivided any further

  23. var numChildren: Int

    the number of child nodes (max

    the number of child nodes (max. 8)

  24. val offset: Vec3

  25. val parent: Octree

  26. def pointsWithinBox(box: AABB, result: ArrayBuffer[Vec]): ArrayBuffer[Vec]

    Alias for apply(box:AABB, result:ArrayBuffer[Vec])

    Alias for apply(box:AABB, result:ArrayBuffer[Vec])

  27. def pointsWithinSphere(sphere: Sphere, result: ArrayBuffer[Vec]): ArrayBuffer[Vec]

    Alias for apply(sphere:Sphere, result:ArrayBuffer[Vec])

    Alias for apply(sphere:Sphere, result:ArrayBuffer[Vec])

  28. def productArity: Int

  29. def productElement(arg0: Int): Any

  30. def productElements: Iterator[Any]

  31. def productIterator: Iterator[Any]

  32. def productPrefix: String

  33. def remove(p: Vec): Boolean

    Removes a point from the tree and (optionally) tries to release memory by reducing now empty sub-branches

    Removes a point from the tree and (optionally) tries to release memory by reducing now empty sub-branches.

    p

    point to delete

    returns

    true, if the point was found & removed

  34. val size: Vec3

  35. def toLabel: String

  36. def toString(): String

    Returns a string representation of the object

    Returns a string representation of the object.

    The default representation is platform dependent.

  37. def updateBounds: Unit

  38. var x: Float

  39. var y: Float

  40. var z: Float

Instance constructors

  1. new Octree(offset: Vec3, size: Float)

    Constructs a new Octree root node

    Constructs a new Octree root node

  2. new Octree(parent: Octree, offset: Vec3, halfSize: Vec3)

  3. new Octree(extent: Vec3)

  4. new Octree()

  5. new Octree(position: Vec3, _extent: Vec3)

  6. new Octree(x: Float, y: Float, z: Float)