S2Cap represents a disc-shaped region defined by a center and radius.
Technically this shape is called a "spherical cap" (rather than disc)
because it is not planar; the cap represents a portion of the sphere that
has been cut off by a plane. The boundary of the cap is the circle defined
by the intersection of the sphere and the plane. For containment purposes,
the cap is a closed set, i.e. it contains its boundary.
For the most part, you can use a spherical cap wherever you would use a
disc in planar geometry. The radius of the cap is measured along the
surface of the sphere (rather than the straight-line distance through the
interior). Thus a cap of radius Pi/2 is a hemisphere, and a cap of radius
Pi covers the entire sphere.
A cap can also be defined by its center point and height. The height is
simply the distance from the center point to the cutoff plane. There is
also support for empty and full caps, which contain no points and all
points respectively.
This class is intended to be copied by value as desired. It uses the
default copy constructor and assignment operator, however it is not a
"plain old datatype" (POD) because it has virtual functions.
Here are some useful relationships between the cap height (h), the cap
radius (r), the maximum chord length from the cap's center (d), and the
radius of cap's base (a).
S2Cap represents a disc-shaped region defined by a center and radius. Technically this shape is called a "spherical cap" (rather than disc) because it is not planar; the cap represents a portion of the sphere that has been cut off by a plane. The boundary of the cap is the circle defined by the intersection of the sphere and the plane. For containment purposes, the cap is a closed set, i.e. it contains its boundary.
For the most part, you can use a spherical cap wherever you would use a disc in planar geometry. The radius of the cap is measured along the surface of the sphere (rather than the straight-line distance through the interior). Thus a cap of radius Pi/2 is a hemisphere, and a cap of radius Pi covers the entire sphere.
A cap can also be defined by its center point and height. The height is simply the distance from the center point to the cutoff plane. There is also support for empty and full caps, which contain no points and all points respectively.
This class is intended to be copied by value as desired. It uses the default copy constructor and assignment operator, however it is not a "plain old datatype" (POD) because it has virtual functions.
Here are some useful relationships between the cap height (h), the cap radius (r), the maximum chord length from the cap's center (d), and the radius of cap's base (a).
d^2 = 2 * h = a^2 + h^2