getCapsuleTriangles method

List<Triangle> getCapsuleTriangles(
  1. Capsule capsule,
  2. List<Triangle> triangles
)

Implementation

List<Triangle> getCapsuleTriangles(Capsule capsule, List<Triangle> triangles){
  for (int i = 0; i < subTrees.length; i ++ ) {
    Octree subTree = subTrees[i];
    if(!capsule.intersectsBox(subTree.box)) continue;
    if(subTree.triangles.isNotEmpty){
      for(int j = 0; j < subTree.triangles.length; j ++ ) {
        if(!triangles.contains(subTree.triangles[j])){
          triangles.add( subTree.triangles[ j ] );
        }
      }
    }
    else {
      subTree.getCapsuleTriangles( capsule, triangles );
    }
  }

  return triangles;
}