Creates an empty S2Polyline that should be initialized by calling Init() or Decode().
Convenience constructors that call Init() with the given vertices.
Convenience constructors to disable the automatic validity checking controlled by the --s2debug flag. Example:
Wrapper class for indexing a polyline (see S2ShapeIndex). Once this object is inserted into an S2ShapeIndex it is owned by that index, and will be automatically deleted when no longer needed by the index. Note that this class does not take ownership of the polyline itself (see OwningShape below). You can also subtype this class to store additional data (see S2Shape for details).
Return true if two polylines have the same number of vertices, and corresponding vertex pairs are separated by no more than "max_error". (For testing purposes.)
/////////////////////////////////////////////////////////////////////
Always return false, because "containment" is not numerically well-defined except at the polyline vertices.
Decodes an S2Polyline encoded with Encode(). Returns true on success.
Appends a serialized representation of the S2Polyline to "encoder".
Returns true if this is *not* a valid polyline and sets "error" appropriately. Otherwise returns false and leaves "error" unchanged.
Return the true centroid of the polyline multiplied by the length of the polyline (see s2centroids.h for details on centroids). The result is not unit length, so you may want to normalize it.
Return the length of the polyline.
Like Interpolate(), but also return the index of the next polyline vertex after the interpolated point P. This allows the caller to easily construct a given suffix of the polyline by concatenating P with the polyline vertices starting at "next_vertex". Note that P is guaranteed to be different than vertex(*next_vertex), so this will never result in a duplicate vertex.
Initialize a polyline that connects the given vertices. Empty polylines are allowed. Adjacent vertices should not be identical or antipodal. All vertices should be unit length.
Convenience initialization function that accepts latitude-longitude coordinates rather than S2Points.
Return the point whose distance from vertex 0 along the polyline is the given fraction of the polyline's total length. Fractions less than zero or greater than one are clamped. The return value is unit length. This cost of this function is currently linear in the number of vertices. The polyline must not be empty.
Return true if this polyline intersects the given polyline. If the polylines share a vertex they are considered to be intersecting. When a polyline endpoint is the only intersection with the other polyline, the function may return true or false arbitrarily.
Returns true if the point given is on the right hand side of the polyline, using a naive definition of "right-hand-sideness" where the point is on the RHS of the polyline iff the point is on the RHS of the line segment in the polyline which it is closest to.
Return true if the given vertices form a valid polyline.
Return true if two polylines are exactly the same.
Given a point, returns a point on the polyline that is closest to the given point. See GetSuffix() for the meaning of "next_vertex", which is chosen here w.r.t. the projected point as opposed to the interpolated point in GetSuffix().
Reverse the order of the polyline vertices.
Allows overriding the automatic validity checks controlled by the --s2debug flag. If this flag is true, then polylines are automatically checked for validity as they are initialized. The main reason to disable this flag is if you intend to call IsValid() explicitly, like this:
Return a subsequence of vertex indices such that the polyline connecting these vertices is never further than "tolerance" from the original polyline. Provided the first and last vertices are distinct, they are always preserved; if they are not, the subsequence may contain only a single index.
The inverse operation of GetSuffix/Interpolate. Given a point on the polyline, 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 betwen 0 and 1 inclusive. See GetSuffix() for the meaning of "next_vertex".
Returns a deep copy of the region.
Returns a bounding spherical cap that contains the region. The bound may not be tight.
Returns a bounding latitude-longitude rectangle that contains the region. The bound may not be tight.
Returns a small collection of S2CellIds whose union covers the region. The cells are not sorted, may have redundancies (such as cells that contain other cells), and may cover much more area than necessary.
Returns true if the region completely contains the given cell, otherwise returns false.
If this method returns false, the region does not intersect the given cell. Otherwise, either region intersects the cell, or the intersection relationship could not be determined.
Returns true if and only if the given point is contained by the region. The point 'p' is generally required to be unit length, although some subtypes may relax this restriction.
An S2Polyline 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.