getSideNormals method

List<Vec3> getSideNormals(
  1. List<Vec3> sixTargetVectors, [
  2. Quaternion? quat
])

Get the box 6 side normals @param sixTargetVectors An array of 6 vectors, to store the resulting side normals in. @param quat Orientation to apply to the normal vectors. If not provided, the vectors will be in respect to the local frame.

Implementation

List<Vec3> getSideNormals(List<Vec3> sixTargetVectors, [Quaternion? quat ]){
  final List<Vec3> sides = sixTargetVectors;
  final Vec3 ex = halfExtents;
  sides[0].set(ex.x, 0, 0);
  sides[1].set(0, ex.y, 0);
  sides[2].set(0, 0, ex.z);
  sides[3].set(-ex.x, 0, 0);
  sides[4].set(0, -ex.y, 0);
  sides[5].set(0, 0, -ex.z);

  if (quat != null) {
    for (int i = 0; i != sides.length; i++) {
      quat.vmult(sides[i], sides[i]);
    }
  }
  return sides;
}