Module s2::point[][src]

Structs

Point

Point represents a point on the unit sphere as a normalized 3D vector. Fields should be treated as read-only. Use one of the factory methods for creation.

Constants

ORIGIN

Functions

from_frame
ordered_ccw

ordered_ccw returns true if the edges OA, OB, and OC are encountered in that order while sweeping CCW around the point O.

planar_centroid

planar_centroid returns the centroid of the planar triangle ABC, which is not normalized. It can be normalized to unit length to obtain the "surface centroid" of the corresponding spherical triangle, i.e. the intersection of the three medians. However, note that for large spherical triangles the surface centroid may be nowhere near the intuitive "center" (see example in TrueCentroid comments).

point_area

point_area returns the area on the unit sphere for the triangle defined by the given points.

regular_points

regular_points generates a slice of points shaped as a regular polygon with the numVertices vertices, all located on a circle of the specified angular radius around the center. The radius is the actual distance from center to each vertex. TODO: private?

to_frame
true_centroid

true_centroid returns the true centroid of the spherical triangle ABC multiplied by the signed area of spherical triangle ABC. The result is not normalized. The reasons for multiplying by the signed area are (1) this is the quantity that needs to be summed to compute the centroid of a union or difference of triangles, and (2) it's actually easier to calculate this way. All points must have unit length.