Sphere& Sphere::setFrom( std::vector<glm::vec3>& points ) { Box3 box; box.setFrom( points ); this->center = box.center(); float max_radius = 0.0; for( glm::vec3 point: points ) max_radius = std::max( max_radius, glm::distance( this->center, point )); this->radius = max_radius; return *this; }