s2js
    Preparing search index...

    Class CapBeta

    Cap 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 π/2 is a hemisphere, and a cap of radius π covers the entire sphere.

    The center is a point on the surface of the unit sphere. (Hence the need for it to be of unit length.)

    A cap can also be defined by its center point and height. The height is 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.

    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).

    h = 1 - Math.cos(r) = 2 * Math.sin^2(r/2) d^2 = 2 * h = a^2 + h^2

    The zero value of Cap is an invalid cap. Use emptyCap to get a valid empty cap.

    incomplete

    Implements

    Index

    Constructors

    • Beta

      Constructs a cap with the given center and surface area. Note that the area can also be interpreted as the solid angle subtended by the cap (because the sphere has unit radius). A negative area yields an empty cap; an area of 4*π or more yields a full cap.

      Parameters

      Returns Cap

    • Beta

      Constructs a cap where the angle is expressed as an ChordAngle. This constructor is more efficient than using an Angle.

      Parameters

      Returns Cap

    • Beta

      Constructs a cap with the given center and height. A negative height yields an empty cap; a height of 2 or more yields a full cap. The center should be unit length.

      Parameters

      Returns Cap

    Other

    center: s2.Point
    rad: number
    • Beta

      Increases the cap height if necessary to include the other cap. If this cap is empty, it is set to the other cap.

      Parameters

      Returns Cap

    • Beta

      Increases the cap if necessary to include the given point. If this cap is empty, then the center is set to the point with a zero height p must be unit-length.

      Parameters

      Returns Cap

    • Beta

      Reports whether this cap is equal to the other cap within the given tolerance.

      Parameters

      Returns boolean

    • Beta

      Computes a covering of the Cap. In general the covering consists of at most 4 cells except for very large caps, which may need up to 6 cells. The output is not sorted.

      Returns bigint[]

    • Beta

      Returns the true centroid of the cap multiplied by its surface area. The result lies on the ray from the origin through the cap's center, but it is not unit length. Note that if you just want the "surface centroid", i.e. the normalized result, then it is simpler to call CENTER_POINT.

      The reason for multiplying the result by the cap area is to make it easier to compute the centroid of more complicated shapes. The centroid of a union of disjoint regions can be computed simply by adding their centroid results. Caveat: for caps that contain a single point (i.e., zero radius), this method always returns the origin (0, 0, 0). This is because shapes with no area don't affect the centroid of a union whose total area is positive.

      Returns s2.Point

    • Beta

      Returns the complement of the interior of the cap. A cap and its complement have the same boundary but do not share any interior points. The complement operator is not a bijection because the complement of a singleton cap (containing a single point) is the same as the complement of an empty cap.

      Returns Cap

    • Beta

      Returns a new cap expanded by the given angle. If the cap is empty, it returns an empty cap.

      Parameters

      • distance: number

      Returns Cap

    • Beta

      Returns the height of the cap. This is the distance from the center point to the cutoff plane.

      Returns number

    • Beta

      Reports whether this cap's interior intersects the other cap.

      Parameters

      Returns boolean

    • Beta

      Returns the cap radius as an Angle. Note that the cap angle is stored internally as a ChordAngle, so this method requires a trigonometric operation and may yield a slightly different result than the value passed to Cap.fromCenterAngle.

      Returns number

    • Beta

      Converts an Angle into the height of the cap.

      Parameters

      • r: number

      Returns number