class Sphere : public feasst::Shape

A sphere is given by a center point and a radius.

Public Functions

double nearest_distance(const Position &point) const

Return the distance from the point to the nearest point on the surface. The distance is negative if the point is inside of the shape and positive if it is outside.

double surface_area() const

Return the surface area (if implemented).

double volume() const

Return the volume (if implemented).

void surface_mesh(const int num, std::vector<Position> *points) const

Generate approximately equi-distance points on the surface using golden spiral methodology.

http://www.softimageblog.com/archives/115 https://en.wikipedia.org/wiki/Tammes_problem

param num:

The number of points.


  • radius: Set the radius of the sphere (default: 1).

  • center: set the unique key for the center positions. Thus, arguments of “key[i]” are expected to follow. The “[i]” is to be substituted for integer dimensions 0, 1, 2, … The “[i]” are also expected to be in order, starting from 0. If center arg is not used, a three dimensional origin is assumed.