updateBoundingSphereRadius method

  1. @override
void updateBoundingSphereRadius()
override

Will update the .boundingSphereRadius property

Implementation

@override
void updateBoundingSphereRadius() {
  // Assume points are distributed with local (0,0,0) as center
  double max2 = 0;
  final vertices = this.vertices;
  final v = Vec3();
  for (int i = 0; i < vertices.length/ 3; i++) {
    getVertex(i, v);
    double norm2 = v.lengthSquared();
    if (norm2 > max2) {
      max2 = norm2;
    }
  }
  boundingSphereRadius = math.sqrt(max2);
}