Constructs a new ClosestEdgeQuery for the given ShapeIndex. Options may be specified here or changed at any time using the options property.
REQUIRES: "index" must persist for the lifetime of this object. REQUIRES: reInit() must be called if "index" is modified.
Returns the closest edge to the target. If no edge satisfies the search criteria, then the result object's isEmptyResult() will return true.
Note that if options.includeInteriors is true, isInteriorResult() should be called to check whether the result represents an interior point (in which case edgeID == -1).
Optionalfilter: ShapeFilterReturns the closest edges to the given target that satisfy the current options. This method may be called multiple times.
Note that if options.includeInteriors is true, the result vector may include some entries with edgeID == -1. This indicates that the target intersects the indexed polygon with the given shapeID. Such results may be identified by calling isInteriorResult().
Optionalfilter: ShapeFilterReturns the minimum distance to the target. If the index or target is empty, returns Infinity.
Use isDistanceLess() if you only want to compare the distance against a threshold value, since it is often much faster.
Optionalfilter: ShapeFilterReturns the endpoints of the given result edge. REQUIRES: !isInteriorResult(result)
Like isDistanceLessOrEqual(), except that "limit" is increased by the maximum error in the distance calculation. This ensures that this function returns true whenever the true, exact distance is less than or equal to "limit".
For example, suppose that we want to test whether two geometries might intersect each other after they are snapped together using S2Builder (using the IdentitySnapFunction with a given "snap_radius"). Since S2Builder uses exact distance predicates (s2predicates.h), we need to measure the distance between the two geometries conservatively. If the distance is definitely greater than "snap_radius", then the geometries are guaranteed to not intersect after snapping.
Optionalfilter: ShapeFilterReturns true if the distance to "target" is less than "limit".
This method is usually much faster than getDistance(), since it is much less work to determine whether the minimum distance is above or below a threshold than it is to calculate the actual minimum distance.
Optionalfilter: ShapeFilterLike isDistanceLess(), but also returns true if the distance to "target" is exactly equal to "limit".
Optionalfilter: ShapeFilterReturns the point on given result edge that is closest to "point".
Reinitializes the query. This method must be called whenever the underlying S2ShapeIndex is modified.
Calls a callback with the closest edges to the given target that satisfy the given options. Edges are reported in order of increasing distance.
Updating the state that the ShapeFilter accesses while visiting is allowed and can be used to disable reporting of results on the fly.
Optionalfilter: ShapeFilterCalls a callback with the closest edge of each shape to the given target that satisfies the given options. Shapes are reported in order of increasing distance.
Optionalfilter: ShapeFilter
S2ClosestEdgeQuery is a helper class for searching within an S2ShapeIndex to find the closest edge(s) to a given point, edge, S2Cell, or geometry collection.