getTrianglesInAABB method

List<int> getTrianglesInAABB(
  1. AABB aabb,
  2. List<int> result
)

Get triangles in a local AABB from the trimesh. @param result An array of integers, referencing the queried triangles.

Implementation

List<int> getTrianglesInAABB(AABB aabb, List<int> result){
  AABB unscaledAABB = aabb.clone();

  // Scale it to local
  final scale = this.scale;
  final isx = scale.x;
  final isy = scale.y;
  final isz = scale.z;
  final l = unscaledAABB.lowerBound;
  final u = unscaledAABB.upperBound;
  l.x /= isx;
  l.y /= isy;
  l.z /= isz;
  u.x /= isx;
  u.y /= isy;
  u.z /= isz;

  return tree.aabbQuery(unscaledAABB, result);
}