Class S2EdgeUtil.RectBounder
java.lang.Object
com.google.common.geometry.S2EdgeUtil.RectBounder
- Enclosing class:
S2EdgeUtil
This class computes a bounding rectangle that contains all edges defined by a vertex chain v0,
v1, v2, ... All vertices must be unit length. Note that the bounding rectangle of an edge can
be larger than the bounding rectangle of its endpoints, e.g. consider an edge that passes
through the north pole.
The bounds are calculated conservatively to account for numerical errors when S2Points are converted to S2LatLngs. For example, this class guarantees that if L is a closed edge chain (a loop) such that the interior of the loop does not contain either pole, and P is any point such that L contains P, then the RectBounder of all edges in L will contain S2LatLng(P).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is called to add each vertex to the chain.voidThis method is called to add each vertex to the chain.getBound()Returns the bounding rectangle of the edge chain that connects the vertices defined so far.
-
Constructor Details
-
RectBounder
public RectBounder()
-
-
Method Details
-
addPoint
This method is called to add each vertex to the chain. This method is much faster thanaddPoint(S2Point), since converting S2LatLng to an S2Point is much faster than the other way around.. -
addPoint
This method is called to add each vertex to the chain. Prefer callingaddPoint(S2LatLng)if you have that type available. The point must be unit length. -
getBound
Returns the bounding rectangle of the edge chain that connects the vertices defined so far. This bound satisfies the guarantee made above, i.e. if the edge chain defines a loop, then the bound contains the S2LatLng coordinates of all S2Points contained by the loop.
-