s2js
    Preparing search index...

    Class ClosestEdgeQuery

    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.

    Index

    Constructors

    Properties

    Methods

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

      Parameters

      Returns boolean

    • Returns 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.

      Parameters

      Returns boolean