Class: MedianCutBVHStrategy

Grape2D. MedianCutBVHStrategy

new MedianCutBVHStrategy()

The median cut algorithm splits the set in two equal parts, along the selected axis. It creates a more balanced tree. However unbalanced trees perform better.
Source:

Methods

solve()

This heuristic does the follow:
  1. Compute the bounding box of the set of AABB center points
  2. Choose the plane that splits the box in half along the longest axis
  3. Objects at the left of the axis will be places at the left side, the others at the right side.
  4. If the bounding box has width and height of 0 then a flag is set to indicate that the objects should stay at the same leaf. Heuristic described by Gino van den Bergen (gino@dtecta.com), from his GDC conference titled "Physics for Game Programmers: Spatial Data Structures".
Source: