fromPoints method

BoundingSphere fromPoints(
  1. List<Vector3> points
)

Computes a bounding sphere that encloses the given set of points.

Implementation

BoundingSphere fromPoints(List<Vector3> points ) {
	// Using an AABB is a simple way to compute a bounding sphere for a given set
	// of points. However, there are other more complex algorithms that produce a
	// more tight bounding sphere. For now, this approach is a good start.
	aabb.fromPoints( points );

	aabb.getCenter( center );
	radius = center.distanceTo( aabb.max );

	return this;
}