s2js
    Preparing search index...

    Class Polyline

    Represents a sequence of zero or more vertices connected by straight edges (geodesics). Edges of length 0 and 180 degrees are not allowed, i.e. adjacent vertices should not be identical or antipodal.

    Implements

    Index

    Constructors

    Other

    points: s2.Point[]
    • Reports whether two polylines have the same number of vertices, and corresponding vertex pairs are separated by no more the provided margin.

      Parameters

      Returns boolean

    • Returns the true centroid of the polyline multiplied by the length of the polyline. The result is not unit length, so you may wish to normalize it.

      Scaling by the Polyline length makes it easy to compute the centroid of several Polylines (by simply adding up their centroids).

      Returns s2.Point

    • Returns the i-th edge Chain in the Shape.

      Parameters

      • _chainID: number

      Returns Chain

    • Returns the j-th edge of the i-th edge Chain.

      Parameters

      • _chainID: number
      • offset: number

      Returns Edge

    • Returns a pair (i, j) such that edgeID is the j-th edge

      Parameters

      • edgeID: number

      Returns ChainPosition

    • Reports whether this Polyline contains the given Cell. Always returns false because "containment" is not numerically well-defined except at the Polyline vertices.

      Parameters

      Returns boolean

    • Returns the dimension of the geometry represented by this Polyline.

      Returns number

    • Returns endpoints for the given edge index.

      Parameters

      • i: number

      Returns Edge

    • Returns the point whose distance from vertex 0 along the polyline is the given fraction of the polyline's total length, and the index of the next vertex after the interpolated point P. Fractions less than zero or greater than one are clamped. The return value is unit length. The cost of this function is currently linear in the number of vertices.

      This method allows the caller to easily construct a given suffix of the polyline by concatenating P with the polyline vertices starting at that next vertex. Note that P is guaranteed to be different than the point at the next vertex, so this will never result in a duplicate vertex.

      The polyline must not be empty. Note that if fraction >= 1.0, then the next vertex will be set to len(p) (indicating that no vertices from the polyline need to be appended). The value of the next vertex is always between 1 and len(p).

      This method can also be used to construct a prefix of the polyline, by taking the polyline vertices up to next vertex-1 and appending the returned point P if it is different from the last vertex (since in this case there is no guarantee of distinctness).

      Parameters

      • fraction: number

      Returns [s2.Point, number]

    • Reports whether this shape contains all points on the sphere.

      Returns boolean

    • Reports whether the point given is on the right hand side of the polyline, using a naive definition of "right-hand-sideness".

      Parameters

      Returns boolean

    • Reports the number of contiguous edge chains in this Polyline.

      Returns number

    • We do not support implementations of this interface outside this package.

      Returns void

    • Returns the default reference point with negative containment because Polylines are not closed.

      Returns ReferencePoint

    • Returns a subsequence of vertex indices such that the polyline connecting these vertices is never further than the given tolerance from the original polyline.

      Parameters

      • tolerance: number

      Returns number[]

    • Returns a value that can be used to identify the type of an encoded Shape.

      Returns number

    • The inverse operation of interpolate. Given a point on the polyline, it returns the ratio of the distance to the point from the beginning of the polyline over the length of the polyline. The return value is always between 0 and 1 inclusive.

      The polyline should not be empty. If it has fewer than 2 vertices, the return value is zero.

      Parameters

      Returns number

    • Reports the maximal end index such that the line segment between the start index and this one such that the line segment between these two vertices passes within the given tolerance of all interior vertices, in order.

      Parameters

      • p: Polyline
      • tolerance: number
      • index: number

      Returns number