Uses of Class
com.google.common.geometry.S2Point
-
Uses of S2Point in com.google.common.geometry
Subclasses of S2Point in com.google.common.geometryModifier and TypeClassDescriptionstatic class
A point with a known containment relationship.Fields in com.google.common.geometry declared as S2PointModifier and TypeFieldDescriptionprivate S2Point
S2ClosestPointQuery.EdgeTarget.a
private S2Point
S2EdgeUtil.EdgeCrosser.a
private S2Point
S2EdgeUtil.RectBounder.a
The previous vertex in the chain.(package private) S2Point
S2Shape.MutableEdge.a
Endpoints of this edge last set by passing this instance toS2Shape.getEdge(int, MutableEdge)
.private S2Point
S2EdgeUtil.EdgeCrosser.aCrossB
private static final S2Point[]
S2Polyline.ARR_TEMPLATE
private S2Point
S2EdgeUtil.EdgeCrosser.aTangent
Outward-facing tangent at A.private final S2Point
S2Cap.axis
private S2Point
S2ClosestPointQuery.EdgeTarget.b
private S2Point
S2EdgeUtil.EdgeCrosser.b
(package private) S2Point
S2Shape.MutableEdge.b
private S2Point
S2EdgeUtil.EdgeCrosser.bTangent
Outward-facing tangent at B.private S2Point
S2EdgeUtil.EdgeCrosser.c
Previous vertex in the vertex chain.private final S2Point
S2ConvexHullQuery.OrderedCcwAround.center
private final S2Point
S2AreaCentroid.centroid
(package private) static final S2Point
S2Loop.EMPTY_VERTEX
The single vertex that defines a loop that contains no area.private final S2Point
S2Edge.end
private static final S2Point[][]
S2Projections.FACE_UVW_AXES
The U,V,W axes for each face.(package private) static final S2Point
S2Loop.FULL_VERTEX
The single vertex that defines a loop that contains the whole sphere.private S2Point
S2ShapeIndex.InteriorTracker.lastEnd
The last exit vertex.private S2Point
S2EdgeUtil.XYZPruner.lastVertex
private S2Point
S2ShapeIndex.InteriorTracker.newFocus
The new focus point.private S2Point
S2ShapeIndex.InteriorTracker.oldFocus
The prior focus point.private static final S2Point
S2.ORIGIN
static final S2Point
S2Point.ORIGIN
Origin of the coordinate system, [0,0,0].private static final S2Point[]
S2.ORTHO_BASES
private static final S2Point
S2LatLngRectBase.ORTHO_LNG
private final S2Point
ParametrizedS2Point.point
private final S2Point
S2ClosestPointQuery.PointTarget.point
private final S2Point
S2PointIndex.Entry.point
private final S2Point
S2PointRegion.point
private final S2Point
S2Edge.start
private final S2Point
S2ContainsVertexQuery.target
private final S2Point
S2ShapeIndex.FaceEdge.va
The corresponding S2Points, cached here to avoid repeated calls toS2Shape.getEdge(int, com.google.common.geometry.S2Shape.MutableEdge)
.private final S2Point
S2ShapeIndex.FaceEdge.vb
private final S2Point[]
S2Loop.vertices
private final S2Point[]
S2Polyline.vertices
private final S2Point[]
S2ShapeAspect.ChainAspect.Multi.Array.vertices
private final S2Point[]
S2ShapeAspect.ChainAspect.Simple.Array.vertices
private S2Point
S2EdgeUtil.CloserResult.vmin
static final S2Point
S2Point.X_NEG
Opposite direction of the x-axis.static final S2Point
S2Point.X_POS
Direction of the x-axis.static final S2Point
S2Point.Y_NEG
Opposite direction of the y-axis.static final S2Point
S2Point.Y_POS
Direction of the y-axis.static final S2Point
S2Point.Z_NEG
Opposite direction of the z-axis.static final S2Point
S2Point.Z_POS
Direction of the z-axis.Fields in com.google.common.geometry with type parameters of type S2PointModifier and TypeFieldDescriptionS2LaxPolygonShape.Coder.coder
S2LaxPolylineShape.Coder.coder
S2PolygonBuilder.edges
The current set of edges, grouped by origin.S2PolygonBuilder.edges
The current set of edges, grouped by origin.S2ContainsVertexQuery.incoming
S2ShapeMeasures.LoopOrderComparator.loop
S2ContainsVertexQuery.outgoing
S2ConvexHullQuery.points
S2PolygonBuilder.startingVertices
Unique collection of the starting (first) vertex of all edges, in the order they are added toedges
.private final S2ShapeMeasures.IntFunction
<S2Point> S2ShapeMeasures.LoopOrderComparator.vertex
S2LaxPolygonShape.MultiList.vertices
S2LaxPolygonShape.SimpleList.vertices
S2LaxPolylineShape.SimpleList.vertices
Methods in com.google.common.geometry that return S2PointModifier and TypeMethodDescriptionReturns add(this,p).static final S2Point
Returns the component-wise addition of 'p1' and 'p2'.S2Cap.axis()
S2Point.Builder.build()
Returns a newS2Point
copied from the current state of this builder.S2ClosestPointQuery.EdgeTarget.center()
S2ClosestPointQuery.PointTarget.center()
S2ClosestPointQuery.Target.center()
Returns the approximate center of the target.S2Iterator.center()
Returns the center of the cell (used as a reference point for shape interiors.)static S2Point
S2ShapeIndexMeasures.centroid
(S2ShapeIndex shapeIndex) Returns the centroid of all shapes whose dimension is maximal within shapeIndex, multiplied by the measure of those shapes.static S2Point
Returns the centroid of shape multiplied by the measure of shape.private static S2Point
S2Predicates.circumcenter
(S2Point a, S2Point b, S2Point c, double[] error) If triangle ABC has positive sign, returns its circumcenter.(package private) static S2Point
S2EdgeUtil.closestAcceptableEndpoint
(S2Point a0, S2Point a1, S2Point aNorm, S2Point b0, S2Point b1, S2Point bNorm, S2Point x) Finds the closest acceptable endpoint to a given point.private static S2Point
S2Predicates.closestVertex
(S2Point x, S2Point a, S2Point b, double[] dx2) Returns "a" or "b", whichever is closer to "x".(package private) static S2Point
S2EdgeUtil.correctIntersectionSign
(S2Point a0, S2Point a1, S2Point b0, S2Point b1, S2Point intersectionResult) Returns intersection result with sign corrected (if necessary).Returns crossProd(this,p).static final S2Point
Returns the R3 vector cross product of 'p1' and 'p2'.(package private) static S2Point
S2Point.decode
(LittleEndianInput is) Returns a new S2Point decoded from the given little endian input stream.static S2Point
S2Point.decode
(InputStream is) Returns a new S2Point decoded from the given input stream.S2Point.div
(double scale) Returns div(this,scale).static final S2Point
Returns the component-wise division of 'p' by 'm'.abstract S2Point
S2EdgeIndex.edgeFrom
(int index) Returns the starting vertex of the edge at offsetindex
.S2Polygon.S2LoopSequenceIndex.edgeFrom
(int index) abstract S2Point
S2EdgeIndex.edgeTo
(int index) Returns the ending vertex of the edge at offsetindex
.S2Polygon.S2LoopSequenceIndex.edgeTo
(int index) S2Point.fabs()
Returns fabs(this).static final S2Point
Returns the component-wise absolute point from 'p'.private static S2Point
S2PointCompression.facePiQiToXyz
(int face, int pi, int qi, int level) S2Projections.faceSiTiToXyz
(int face, long si, long ti) Convert (face, si, ti) coordinates to a direction vector (not necessarily unit length.)static S2Point
S2Projections.faceUvToXyz
(int face, double u, double v) Convert (face, u, v) coordinates to a direction vector (not necessarily unit length).static S2Point
S2Projections.faceUvToXyz
(int face, R2Vector uv) Convert (face, u, v) coordinates to a direction vector (not necessarily unit length).static S2Point
S2Projections.faceXyzToUvw
(int face, S2Point p) Returns the given point P transformed to the (u,v,w) coordinate frame of the given face (where the w-axis represents the face normal).(package private) static S2Point
Converts 'p' from the basis given in 'frame'.private static S2Point
S2LatLngRectBase.getBisectorIntersection
(R1Interval lat, double lng) Return the intersection of longitude 0 with the bisector of an edge on longitude 'lng' and spanning latitude range 'lat'.S2Cell.getCenter()
Return the direction vector corresponding to the center in (s,t)-space of the given cell.S2PaddedCell.getCenter()
Returns the center of this cell.S2Cell.getCenterRaw()
S2AreaCentroid.getCentroid()
final S2Point
S2LatLngRectBase.getCentroid()
S2Loop.getCentroid()
Returns the true centroid of the loop multiplied by the area of the loop, or null if this loop is empty, full, or invalid.S2Polygon.getCentroid()
Returns the true centroid of the polygon, weighted by the area of the polygon (see s2.h for details on centroids).S2Edge.getChainVertex
(int chainId, int edgeOffset) S2Loop.getChainVertex
(int chainId, int edgeOffset) S2Point.Shape.getChainVertex
(int chainId, int edgeOffset) S2Polygon.Shape.getChainVertex
(int chainId, int edgeOffset) S2Polyline.getChainVertex
(int chainId, int edgeOffset) S2Shape.getChainVertex
(int chainId, int edgeOffset) Returns the start point of the edge that would be returned byS2Shape.getChainEdge(int, int, com.google.common.geometry.S2Shape.MutableEdge)
, or the endpoint of the last edge ifedgeOffset==getChainLength(chainId)
.default S2Point
S2ShapeAspect.EdgeAspect.Closed.getChainVertex
(int chainId, int edgeOffset) S2ShapeAspect.EdgeAspect.getChainVertex
(int chainId, int edgeOffset) Returns the start point of the edge that would be returned byS2Shape.getChainEdge(int, int, com.google.common.geometry.S2Shape.MutableEdge)
, or the endpoint of the last edge ifedgeOffset==getChainLength(chainId)
.default S2Point
S2ShapeAspect.EdgeAspect.Open.getChainVertex
(int chainId, int edgeOffset) S2ShapeUtil.S2EdgeVectorShape.getChainVertex
(int chainId, int edgeOffset) static S2Point
S2EdgeUtil.getClosestPoint
(S2Point x, S2Point a, S2Point b) Returns the point on edge AB closest to X.static S2Point
S2EdgeUtil.getClosestPoint
(S2Point x, S2Point a, S2Point b, S2Point aCrossB) AsS2EdgeUtil.getClosestPoint(S2Point, S2Point, S2Point)
, but faster if the cross product between a and b has already been computed.Matrix3x3.getCol
(int col) Return the vector of the given column.S2Cell.getEdge
(int k) AsS2Cell.getEdgeRaw(int)
, except the point is normalized to unit length.S2Cell.getEdgeRaw
(int k) Returns the inward-facing normal of the great circle passing through the edge from vertex k to vertex k+1 (mod 4).S2Edge.getEnd()
S2Shape.MutableEdge.getEnd()
Returns the trailing point of the last edge retrieved viaS2Shape.getEdge(int, MutableEdge)
, or null if no edge has been retrieved.S2PaddedCell.getEntryVertex()
Returns the vertex where the S2 space-filling curve enters this cell.S2PaddedCell.getExitVertex()
Returns the vertex where the S2 space-filling curve exits this cell.static S2Point
S2EdgeUtil.getIntersection
(S2Point a0, S2Point a1, S2Point b0, S2Point b1) Given two edges AB and CD such that robustCrossing() is true, return their intersection point.(package private) static S2Point
S2EdgeUtil.getIntersection
(S2Point a0, S2Point a1, S2Point b0, S2Point b1, S2EdgeUtil.ResultError resultError) Helper forS2EdgeUtil.getIntersection(com.google.common.geometry.S2Point,com.google.common.geometry.S2Point,com.google.common.geometry.S2Point,com.google.common.geometry.S2Point)
with provided result error parameter for testing and benchmarking purposes.(package private) static S2Point
S2EdgeUtil.getIntersectionApprox
(S2Point a0, S2Point a1, S2Point b0, S2Point b1, S2EdgeUtil.ResultError resultError) Returns the approximate intersection point of the edges (a0,a1) and (b0,b1), and writes to resultError a bound on its error.private static S2Point
S2EdgeUtil.getIntersectionApproxSorted
(S2Point a0, S2Point a1, S2Point b0, S2Point b1, S2EdgeUtil.ResultError resultError) Returns the approximate intersection point of the edges (a0,a1) and (b0,b1), and writes to resultError a bound on its error.(package private) static S2Point
S2EdgeUtil.getIntersectionExact
(S2Point a0, S2Point a1, S2Point b0, S2Point b1) Compute the intersection point of (a0, a1) and (b0, b1) using exact arithmetic.static S2Point
S2Projections.getNorm
(int face) Returns the unit-length normal for the given face.ParametrizedS2Point.getPoint()
private S2Point
S2Cell.getPoint
(int i, int j) S2PointRegion.getPoint()
S2Edge.getStart()
S2Shape.MutableEdge.getStart()
Returns the leading point of the last edge retrieved viaS2Shape.getEdge(int, MutableEdge)
, or null if no edge has been retrieved.static S2Point
S2Projections.getUAxis
(int face) Returns the u-axis for the given face.static S2Point
S2Projections.getUNorm
(int face, double u) Returns the right-handed normal (not necessarily unit length) for an edge in the direction of the positive v-axis at the given u-value on the given face.(package private) static S2Point
S2Projections.getUVWAxis
(int face, int axis) Returns the given axis of the given face (u=0, v=1, w=2).static S2Point
S2Projections.getVAxis
(int face) Returns the v-axis for the given face.S2Cell.getVertex
(int k) AsS2Cell.getVertexRaw(int)
, except the point is normalized to unit length.S2Cell.getVertexRaw
(int k) Returns the kth vertex of the cell (k = 0,1,2,3).S2EdgeUtil.CloserResult.getVmin()
static S2Point
S2Projections.getVNorm
(int face, double v) Returns the right-handed normal (not necessarily unit length) for an edge in the direction of the positive u-axis at the given v-value on the given face.static S2Point
S2EdgeUtil.interpolate
(double t, S2Point a, S2Point b) Return the point X along the line segment AB whose distance from A is the given fraction "t" of the distance AB.S2Polyline.interpolate
(double fraction) Return the point whose distance from vertex 0 along the polyline is the given fraction of the polyline's total length.static S2Point
S2EdgeUtil.interpolateAtDistance
(S1Angle ax, S2Point a, S2Point b) LikeS2EdgeUtil.interpolate(double, com.google.common.geometry.S2Point, com.google.common.geometry.S2Point)
, except that the parameter "ax" represents the desired distance from A to the result X rather than a fraction between 0 and 1.static S2Point
S2EdgeUtil.interpolateAtDistance
(S1Angle ax, S2Point a, S2Point b, S1Angle ab) A slightly more efficient version ofS2EdgeUtil.interpolateAtDistance(com.google.common.geometry.S1Angle, com.google.common.geometry.S2Point, com.google.common.geometry.S2Point, com.google.common.geometry.S1Angle)
that can be used when the distance AB is already known.(package private) static S2Point
S2ShapeMeasures.loopCentroid
(S2Shape shape, int chainId) Returns the true centroid of the loop multiplied by the area of the loop.static S2Point
As above, but do not CHECK-fail on invalid input.static S2Point
S2TextFormat.makePointOrDie
(String str) Returns an S2Point corresponding to the given a latitude-longitude coordinate in degrees.static final S2Point
Returns sub(this,p).S2Point.mul
(double scale) Returns mul(this,scale).static final S2Point
Returns the component-wise multiplication of 'p' with 'm'.private static S2Point
Returns (a-b).crossProd(a+b), which eliminates almost all of the error due to "x" and "y" being not quite unit length.S2Point.neg()
Returns neg(this).static final S2Point
Returns the component-wise negation of 'p', i.e.S2Point.normalize()
Returns normalize(this).static final S2Point
Returns a copy of 'p' rescaled to be unit-length.S2Loop.orientedVertex
(int i) Like vertex(), but this method returns vertices in reverse order if the loop represents a polygon hole.static S2Point
S2.origin()
Return a unique "origin" on the sphere for operations that need a fixed reference point.static S2Point
Returns a unit-length vector that is orthogonal toa
.final S2Point
S2Point.ortho()
return a vector orthogonal to this onestatic S2Point
S2.planarCentroid
(S2Point a, S2Point b, S2Point c) Return the centroid of the planar triangle ABC.S2PointIndex.Entry.point()
(package private) static S2Point
S2ShapeMeasures.polylineCentroid
(S2Shape shape, int chainId) Returns the true centroid of the polyline multiplied by the length of the polyline.Returns a point on the polygon that is closest to point P.Returns the point on the polyline closest toqueryPoint
.S2Polyline.projectToEdge
(S2Point point, int index) Given a point p and the index of the start point of an edge of this polyline, returns the point on that edge that is closest to p.static S2Point
S2.robustCrossProd
(S2Point a, S2Point b) Return a vector "c" that is orthogonal to the given unit-length vectors "a" and "b".(package private) static S2Point
Returns a normalized copyp
after rotating it by the rotation matrixr
.Rotates this point around an arbitrary axis.private S2Point
S2PolygonBuilder.snapPointToLevel
(S2Point p, int level) Returns a new point, snapped to the center of the cell containing the given point at the specified level.private static S2Point
S2Polyline.snapPointToLevel
(S2Point p, int level) Returns a new point, snapped to the center of the cell containing the given point at the specified level.Returns sub(this,p).static final S2Point
Returns the component-wise subtraction of 'p1' and 'p2'.private static S2Point[]
Returns an array of the given vertices.(package private) static S2Point
Converts 'p' to the basis given in 'frame'.S2CellId.toPoint()
S2LatLng.toPoint()
Convert an S2LatLng to the equivalent unit-length vector (S2Point).S2CellId.toPointRaw()
Return the direction vector corresponding to the center of the given cell.(package private) S2Point
BigPoint.toS2Point()
Returns an S2Point by rounding 'this' to double precision.static S2Point
S2.trueCentroid
(S2Point a, S2Point b) Returns the true centroid of the spherical geodesic edge AB multiplied by the length of the edge AB.static S2Point
S2.trueCentroid
(S2Point a, S2Point b, S2Point c) Returns the true centroid of the spherical triangle ABC multiplied by the signed area of spherical triangle ABC.S2ShapeUtil.CentroidMeasure.value()
Returns the centroid.S2LaxPolygonShape.MultiList.vertex
(int vertexId) S2LaxPolygonShape.SimpleList.vertex
(int vertexId) S2LaxPolylineShape.SimpleList.vertex
(int vertexId) S2Loop.vertex
(int i) For convenience, we make two entire copies of the vertex list available: vertex(n..2*n-1) is mapped to vertex(0..n-1), where n == numVertices().S2Polyline.vertex
(int k) S2ShapeAspect.ChainAspect.Multi.Array.vertex
(int index) S2ShapeAspect.ChainAspect.Multi.Packed.vertex
(int index) S2ShapeAspect.ChainAspect.Multi.Snapped.vertex
(int index) S2ShapeAspect.ChainAspect.Simple.Array.vertex
(int index) private static S2Point
S2ShapeAspect.ChainAspect.Simple.Packed.vertex
(double[] coordinates, int index) S2ShapeAspect.ChainAspect.Simple.Packed.vertex
(int index) S2ShapeAspect.ChainAspect.Simple.Snapped.vertex
(int index) S2ShapeAspect.VertexAspect.vertex
(int vertexId) Returns a vertex of this shape, from 0 (inclusive) toS2ShapeAspect.VertexAspect.numVertices()
(exclusive).Methods in com.google.common.geometry that return types with arguments of type S2PointModifier and TypeMethodDescriptionS2PolygonBuilder.buildMergeMap
(S1Angle snapDistance) Clusters vertices that are separated by at mostS2PolygonBuilder.Options.getMergeDistance()
and returns a map of each one to a single representative vertex for all the vertices in the cluster.S2PolygonBuilder.buildMergeMap
(S1Angle snapDistance) Clusters vertices that are separated by at mostS2PolygonBuilder.Options.getMergeDistance()
and returns a map of each one to a single representative vertex for all the vertices in the cluster.S2Shape.chain
(int chain) Returns a view of the vertices in the given chain.S2Shape.chains()
Returns a view of thechains
in this shape.S2PointVectorCoder.decode
(PrimitiveArrays.Bytes data, PrimitiveArrays.Cursor cursor) S2PointVectorCoder.decodeCompact
(PrimitiveArrays.Bytes data, PrimitiveArrays.Cursor cursor) S2PointVectorCoder.decodeFast
(PrimitiveArrays.Bytes data, PrimitiveArrays.Cursor cursor) S2PointCompression.decodePointsCompressed
(int numVertices, int level, LittleEndianInput decoder) S2PointCompression.decodePointsCompressed
(int numVertices, int level, InputStream input) Decode a list of points that were encoded usingS2PointCompression.encodePointsCompressed(java.util.List<com.google.common.geometry.S2Point>, int, java.io.OutputStream)
.S2ConvexHullQuery.getMonotoneChain
(List<S2Point> points) S2Loop.makeRegularVertices
(S2Point center, S1Angle radius, int numVertices) AsS2Loop.makeRegularLoop(S2Point, S1Angle, int)
, but returns vertices as a list.S2FractalBuilder.makeVertices
(Matrix3x3 frame, S1Angle nominalRadius) AsS2FractalBuilder.makeLoop(Matrix3x3, S1Angle)
except it returns the vertices instead of loop.S2Loop.orientedVertices()
Returns the vertices oriented such that left is on the inside.S2TextFormat.parsePoints
(String str) As above, but does not CHECK-fail on invalid input.S2TextFormat.parsePointsOrDie
(String str) Parses a string in the same format as parseLatLngs, and return the corresponding List of S2Point values.S2ShapeMeasures.pruneDegeneracies
(List<S2Point> input) Returns a new loop obtained by removing all degeneracies from "input".S2Loop.vertices()
Returns an unmodifiable view of the vertices of this polyline.S2Polyline.vertices()
Returns an unmodifiable view of the vertices of this polyline.S2ShapeAspect.VertexAspect.vertices()
Returns the vertices in this shape.Methods in com.google.common.geometry with parameters of type S2PointModifier and TypeMethodDescriptionvoid
void
void
void
Returns add(this,p).static final S2Point
Returns the component-wise addition of 'p1' and 'p2'.Adds point.void
AsS2PointIndex.add(Entry)
, but more convenient.void
Adds an edge to the vector.boolean
Adds the given edge to the polygon builder and returns true if the edge was actually added to the edge graph.void
S2EdgeUtil.XYZPruner.addEdgeToBounds
(S2Point from, S2Point to) Accumulate a bounding rectangle from provided edges.void
S2ContainsVertexQuery.addIncoming
(S2Point v) Adds an edge from 'v' incoming to 'target'.private void
S2Polygon.EdgeClipper.addIntersection
(S2Point a0, S2Point a1, S2Point b0, S2Point b1, S2Shape bShape, int crossing, List<ParametrizedS2Point> intersections) Given two edges A and B such that robustCrossing(A, B) >= 0, determines if they intersect and adds any intersection point tointersections
.void
S2ContainsVertexQuery.addOutgoing
(S2Point v) Adds an edge outgoing from 'target' to 'v'.Increase the cap radius if necessary to include the given point.void
Adds a point to the input geometry.void
This method is called to add each vertex to the chain.private void
Internal implementation of addPoint that takes both the point and latLng representation, by whichever path provided them, and expands the bounds accordingly.Returns a new rectangle that includes this rectangle and the given point, expanding this rectangle to include the point by the minimum amount possible.(package private) boolean
Compare two vectors, return true if all their components are within a difference of margin.static double
Return the angle at the vertex B in the triangle ABC.final double
Return the angle between two vectors in radiansprivate static void
S2TextFormat.appendVertex
(S2Point p, StringBuilder out) static boolean
S2.approxEquals
(S2Point a, S2Point b) static boolean
S2.approxEquals
(S2Point a, S2Point b, double maxError) Return true if two points are within the given distance of each other (mainly useful for testing).static double
Returns the area of triangle ABC.private S2Loop
S2PolygonBuilder.assembleLoop
(S2Point v0, S2Point v1, List<S2Edge> unusedEdges) We start at the given edge and assemble a loop taking left turns whenever possible.private static BigPoint
Returns a BigDecimal-based representation of 'p'.final boolean
S2LatLngRectBase.boundaryIntersects
(S2Point v0, S2Point v1) Returns true if the boundary of this rectangle intersects the given geodesic edge (v0, v1).(package private) boolean
S2Loop.bruteForceContains
(S2Point p) private static boolean
Deprecated.Temporary bridge for refactoringprivate static double
S2Cell.chordDist2
(S2Point uvw, double u, double v) Returns the squared chord distance fromuvw
to positionuv
.private static S2Point
S2Predicates.circumcenter
(S2Point a, S2Point b, S2Point c, double[] error) If triangle ABC has positive sign, returns its circumcenter.(package private) static int
S2EdgeUtil.clipDestination
(S2Point a, S2Point b, S2Point nScaled, S2Point aTangent, S2Point bTangent, double uvScale, R2Vector uv) This helper function does two things.void
S2EdgeIndex.clipEdge
(S2Point a0, S2Point a1, boolean addSharedEdges, Collection<ParametrizedS2Point> intersections) Adds points where the edge index intersects the edge[a0, a1]
tointersections
.void
S2Polygon.EdgeClipper.clipEdge
(S2Point a0, S2Point a1, List<ParametrizedS2Point> intersections) Finds all points where the polygon B intersects the edge (a0, a1), and add the corresponding parameter values (in the range [0,1]) tointersections
.static boolean
S2EdgeUtil.clipToFace
(S2Point a, S2Point b, int face, R2Vector aUv, R2Vector bUv) Given an edge AB and a face, return the (u,v) coordinates for the portion of AB that intersects that face.static boolean
S2EdgeUtil.clipToPaddedFace
(S2Point aXyz, S2Point bXyz, int face, double padding, R2Vector aUv, R2Vector bUv) AsS2EdgeUtil.clipToFace(S2Point, S2Point, int, R2Vector, R2Vector)
, but rather than clipping to the square [-1,1]x[-1,1] in (u,v) space, this method clips to [-R,R]x[-R,R] where R=(1+padding).(package private) static S2Point
S2EdgeUtil.closestAcceptableEndpoint
(S2Point a0, S2Point a1, S2Point aNorm, S2Point b0, S2Point b1, S2Point bNorm, S2Point x) Finds the closest acceptable endpoint to a given point.private static S2Point
S2Predicates.closestVertex
(S2Point x, S2Point a, S2Point b, double[] dx2) Returns "a" or "b", whichever is closer to "x".int
(package private) static int
S2Predicates.compareDistance
(S2Point x, S2Point y, double r2) Returns -1, 0, or +1 according to whether the distance XY is less than, equal to, or greater than the squared chord distance "r2" respectively.static int
S2Predicates.compareDistances
(S2Point x, S2Point a, S2Point b) Returns -1, 0, or +1 according to whether AX invalid input: '<' BX, A == B, or AX > BX respectively.(package private) static int
S2Predicates.compareEdgeDirections
(S2Point a, S2Point b, S2Point c, S2Point d) Returns -1, 0, or +1 according to whether the normal of edge AB has negative, zero, or positive dot product with the normal of edge CD.static int
S2Predicates.compareEdgeDistance
(S2Point x, S2Point a, S2Point b, double r2) Returns -1, 0, or +1 according to whether the distance from the point X to the edge AB is less than, equal to, or greater than the squared chord distance "r2" respectively.private static boolean
S2EdgeUtil.compareEdges
(S2Point a0, S2Point a1, S2Point b0, S2Point b1) Returns true if (a0,a1) is less than (b0,b1) with respect to a total ordering on edges that is invariant under edge reversals.int
private static S2CellId
S2EdgeIndex.containingCell
(S2Point pa, S2Point pb) Returns the smallest cell containing both points, or Sentinel if they are not all on the same face.private static S2CellId
S2EdgeIndex.containingCell
(S2Point pa, S2Point pb, S2Point pc, S2Point pd) Returns the smallest cell containing all four points, orS2CellId.sentinel()
if they are not all on the same face.boolean
boolean
boolean
The point 'p' does not need to be normalized.boolean
Returns true if any shape in the given iterator containsp
under the specifiedS2ContainsPointQuery.S2VertexModel
.final boolean
The point 'p' does not need to be normalized.private boolean
S2Loop.contains
(S2Iterator<S2ShapeIndex.Cell> it, S2Point p) Given an iterator that is already positioned at the S2ShapeIndexCell containingp
, returns contains(p).boolean
Returns true if the point is contained by the loop.boolean
boolean
private boolean
S2Polygon.contains
(S2Iterator<S2ShapeIndex.Cell> it, S2Point p) Given an iterator that is already positioned at the S2ShapeIndex.Cell containingp
, returncontains(p)
.boolean
The pointp
does not need to be normalized.boolean
boolean
Returns true if and only if the given point is contained by the region.boolean
Returns true if all the regions fully contain the point.boolean
Only returns true if one of the regions contains the point.boolean
Returns true if the given point is contained by any two-dimensional shape (i.e., polygon).static boolean
S2ShapeUtil.containsBruteForce
(S2Shape shape, S2Point point) Returns true if the given shape contains the given point.(package private) static S2Point
S2EdgeUtil.correctIntersectionSign
(S2Point a0, S2Point a1, S2Point b0, S2Point b1, S2Point intersectionResult) Returns intersection result with sign corrected (if necessary).private static double
S2Predicates.cosDistance
(S2Point x, S2Point y) Returns cos(XY).static S2Shape.ReferencePoint
Creates a referenced point at position 'p', with known containment 'contained'.static <Data> S2PointIndex.Entry
<Data> S2PointIndex.createEntry
(S2Point point, Data data) Convenience method to create an index entry from the given point and data value.Returns crossProd(this,p).static final S2Point
Returns the R3 vector cross product of 'p1' and 'p2'.final double
S2Point.crossProdNorm
(S2Point va) Returns the norm of the cross product,S2Point.crossProd(this, va).norm()
.private static final double
Returns the squared distance froma
tob
.static final S2Point
Returns the component-wise division of 'p' by 'm'.(package private) BigDecimal
Returns the vector dot product of 'this' with 'that'.final double
Returns the vector dot product of 'this' with 'that'.void
Moves the focus to the given point.static int
Returns sign(P, Q, Z) where Z is the circumcenter of triangle ABC.private static boolean
S2EdgeIndex.edgeIntersectsCellBoundary
(S2Point a, S2Point b, S2Cell cell) Returns true if the edge and the cell (including boundary) intersect.boolean
S2EdgeUtil.EdgeCrosser.edgeOrVertexCrossing
(S2Point d) This method is equivalent to theS2EdgeUtil.EdgeCrosser.edgeOrVertexCrossing(com.google.common.geometry.S2Point)
method defined below.boolean
S2EdgeUtil.EdgeCrosser.edgeOrVertexCrossing
(S2Point c, S2Point d) AsS2EdgeUtil.EdgeCrosser.edgeOrVertexCrossing(S2Point)
, but restarts atc
if that is not the previous endpoint.static boolean
S2EdgeUtil.edgeOrVertexCrossing
(S2Point a, S2Point b, S2Point c, S2Point d) A convenience function that calls robustCrossing() to handle cases where all four vertices are distinct, and VertexCrossing() to handle cases where two or more vertices are the same.boolean
S2Point.equalsPoint
(S2Point that) Returns true if this point is equal tothat
.private void
static int
CallsS2Predicates.CompareDistance.exact(BigPoint, BigPoint, BigDecimal)
with its more precise types.static int
Returns a BigDecimal-based test result, which is slow but handle all input.static int
Returns a BigDecimal-based test result.static int
Returns a BigDecimal-based test result, which is exact but very slow.static int
S2Predicates.EdgeCircumcenterSign.exact
(S2Point p, S2Point q, S2Point a, S2Point b, S2Point c, int abc) Returns a BigDecimal-based test result.static int
Computes the determinant using exact arithmetic and/or symbolic permutations.static S2Predicates.Excluded
(package private) static int
S2Predicates.CompareEdgeDistance.exactLineEndpoints
(S2Point x, S2Point a, S2Point b, double r2) Returns a BigDecimal-based test result assuming the projection of X is onto A or B.static int
Returns the sign of the determinant using more expensive techniques.static final S2Point
Returns the component-wise absolute point from 'p'.static R2Vector
S2Projections.faceXyzToUv
(int face, S2Point p) If the dot product of p with the given face normal is positive, set the corresponding u and v values (which may lie outside the range [-1,1]) and return true.static S2Point
S2Projections.faceXyzToUvw
(int face, S2Point p) Returns the given point P transformed to the (u,v,w) coordinate frame of the given face (where the w-axis represents the face normal).protected void
S2EdgeIndex.findCandidateCrossings
(S2Point a, S2Point b, List<Integer> candidateCrossings) Appends to "candidateCrossings" all edge references which may cross the given edge.S2ClosestPointQuery.findClosestPoint
(S2Point target) Convenience method that returns the closest point to the given target point, or null if no points satisfy theS2ClosestPointQuery.getMaxDistance()
andS2ClosestPointQuery.getRegion()
criteria.S2ClosestPointQuery.findClosestPoints
(S2Point target) Returns the closest points totarget
that satisfy theS2ClosestPointQuery.getMaxDistance()
,S2ClosestPointQuery.getMaxPoints()
, andS2ClosestPointQuery.getRegion()
criteria, ordered by increasing distance.void
S2ClosestPointQuery.findClosestPoints
(List<S2ClosestPointQuery.Result<T>> results, S2Point target) AsS2ClosestPointQuery.findClosestPoints(S2Point)
, but sorts the results and adds them at the end of the given list.S2ClosestPointQuery.findClosestPointsToEdge
(S2Point a, S2Point b) Returns the closest points to the given edge AB.void
S2ClosestPointQuery.findClosestPointsToEdge
(List<S2ClosestPointQuery.Result<T>> results, S2Point a, S2Point b) AsS2ClosestPointQuery.findClosestPointsToEdge(S2Point, S2Point)
, but adds results to the given list.(package private) int
S2Loop.findVertex
(S2Point p) Return the index of a vertex at point "p", or -1 if not found.static S2Cap
S2Cap.fromAxisAngle
(S2Point axis, S1Angle angle) Create a cap given its axis and the cap opening angle, i.e.static S2Cap
S2Cap.fromAxisArea
(S2Point axis, double area) Create a cap given its axis and its area in steradians.static S2Cap
S2Cap.fromAxisChord
(S2Point center, S1ChordAngle radius) Creates a cap where the radius is expressed as an S1ChordAngle.static S2Cap
S2Cap.fromAxisHeight
(S2Point axis, double height) Create a cap given its axis and the cap height, i.e.static Matrix3x3
Constructs a matrix from a series of column vectors.static S2LatLngRect
Returns a latitude-longitude rectangle that contains the edge from "a" to "b".(package private) static S2Point
Converts 'p' from the basis given in 'frame'.static S2CellId
Return the leaf cell containing the given point (a direction vector, not necessarily unit length).S2Cell.getBoundaryDistance
(S2Point target) Returns the distance from the cell boundary to the given point.void
S2EdgeIndex.DataEdgeIterator.getCandidates
(S2Point a, S2Point b) Initializes the iterator to iterate over a set of candidates that may cross the edge (a,b).S2EdgeQuery.getCandidates
(S2Point a, S2Point b) Given a query edge AB, returns a map from the indexed shapes to a superset of the edges for each shape that intersect AB.S2EdgeQuery.getCandidates
(S2Point a, S2Point b, S2Shape shape) Given a query edge AB and a shapeshape
, returns a superset of the edges ofshape
that intersect AB.(package private) boolean
S2EdgeQuery.getCells
(S2Point a, R2Vector aVector, S2Point b, R2Vector bVector, S2PaddedCell root, List<S2ShapeIndex.Cell> cells) Adds all cells tocells
that might intersect the query edge froma
tob
and the cellroot
.private void
Sets cells to the set of index cells intersected by an edge AB.boolean
S2EdgeQuery.getCells
(S2Point a, S2Point b, S2PaddedCell root, List<S2ShapeIndex.Cell> cells) Convenience method for callingS2EdgeQuery.getCells(S2Point, R2Vector, S2Point, R2Vector, S2PaddedCell, List)
.static S2Point
S2EdgeUtil.getClosestPoint
(S2Point x, S2Point a, S2Point b) Returns the point on edge AB closest to X.static S2Point
S2EdgeUtil.getClosestPoint
(S2Point x, S2Point a, S2Point b, S2Point aCrossB) AsS2EdgeUtil.getClosestPoint(S2Point, S2Point, S2Point)
, but faster if the cross product between a and b has already been computed.S2ContainsPointQuery.getContainingShapes
(S2Point p) A convenience function that returns all the shapes that containp
.private int
S2EdgeIndex.getCovering
(S2Point a, S2Point b, boolean thickenEdge, ArrayList<S2CellId> edgeCovering) Computes a cell covering of an edge.S2EdgeQuery.getCrossings
(S2Point a, S2Point b) Returns edges for each shape that either crosses AB or shares a vertex with AB.S2EdgeQuery.getCrossings
(S2Point a, S2Point b, S2Shape shape) Returns edges from a given shape that either cross AB or share a vertex with AB.S2Cell.getDistance
(S2Point targetXyz) Returns the distance from the given point to the cell.static S1ChordAngle
S2EdgeUtil.getDistance
(S2Point p, S2Edge e) Gets the distance fromp
toe
.static S1Angle
S2EdgeUtil.getDistance
(S2Point x, S2Point a, S2Point b) Return the minimum distance from X to any point on the edge AB.static S1Angle
S2EdgeUtil.getDistance
(S2Point x, S2Point a, S2Point b, S2Point aCrossB) A slightly more efficient version of getDistance() where the cross product of the two endpoints has been precomputed.S2Loop.getDistance
(S2Point p) Returns the shortest distance from a point P to this loop, given as the angle formed between P, the origin and the nearest point on the loop to P.double
S2Point.getDistance
(S2Point that) Returns the distance in 3D coordinates from this to that.S2Polygon.getDistance
(S2Point p) Returns the shortest distance from a point P to this polygon, given as the angle formed between P, the origin, and the nearest point on the polygon to P.double
S2Point.getDistance2
(S2Point that) Returns the square of the distance in 3D coordinates from this to that.static double
S2EdgeUtil.getDistanceFraction
(S2Point x, S2Point a0, S2Point a1) Given a point X and an edge AB, return the distance ratio AX / (AX + BX).private double
S2Cell.getDistanceInternal
(S2Point targetXyz, boolean toInterior) Returns the chord distance to targetXyz, with interior distance 0 iff toInterior is true.static double
S2EdgeUtil.getDistanceRadians
(S2Point x, S2Point a, S2Point b, S2Point aCrossB) A more efficient version of getDistance() where the cross product of the endpoints has been precomputed and the result is returned as a direct radian measure rather than wrapping it in an S1Angle.S2Cell.getDistanceToEdge
(S2Point a, S2Point b) Returns the minimum distance from the cell to the given edge AB, or zero if the edge intersects the cell interior.(package private) static final int
S2ShapeIndex.getEdgeMaxLevel
(S2Point va, S2Point vb, double cellSizeToLongEdgeRatio) Returns the first level for which the given edge will be considered "long", i.e.(package private) static void
S2EdgeUtil.getEdgePairClosestPoints
(S2Point a0, S2Point a1, S2Point b0, S2Point b1, S2Point[] result) Updates theresults
with points that achieve the minimum distance between edges a0a1 and b0b1, wherea
is a point on a0a1 andb
is a point on b0b1.static S1ChordAngle
S2EdgeUtil.getEdgePairDistance
(S2Point a0, S2Point a1, S2Point b0, S2Point b1) Gets distance between edges with no minimum distance.static S1ChordAngle
S2EdgeUtil.getEdgePairMaxDistance
(S2Point a0, S2Point a1, S2Point b0, S2Point b1, S1ChordAngle maxDist) LikeS2EdgeUtil.updateMaxDistance(com.google.common.geometry.S2Point, com.google.common.geometry.S2Point, com.google.common.geometry.S2Point, com.google.common.geometry.S1ChordAngle)
, but computes the maximum distance between the given pair of edges.static S1ChordAngle
S2EdgeUtil.getEdgePairMinDistance
(S2Point a0, S2Point a1, S2Point b0, S2Point b1, S1ChordAngle minDist) LikeS2EdgeUtil.updateMinDistance(com.google.common.geometry.S2Point, com.google.common.geometry.S2Edge, com.google.common.geometry.S1ChordAngle)
, but computes the minimum distance between the given pair of edges.private void
S2EdgeIndex.getEdgesInChildrenCells
(S2Point a, S2Point b, List<S2CellId> cover, Set<Integer> candidateCrossings) Appends to candidateCrossings the edges that are fully contained in an S2 covering of edge.(package private) static int
S2EdgeUtil.getExitAxis
(S2Point n) Given cube face F and a directed line L (represented by its CCW normal N in the (u,v,w) coordinates of F), compute the axis of the cube face edge where L exits the face: return 0 if L exits through the u=-1 or u=+1 edge, and 1 if L exits through the v=-1 or v=+1 edge.(package private) static void
S2EdgeUtil.getExitPoint
(S2Point n, int axis, R2Vector result) Given a cube face F, a directed line L (represented by its CCW normal N in the (u,v,w) coordinates of F), and result ofS2EdgeUtil.getExitAxis(S2Point)
, setresult
to the (u,v) coordinates of the point where L exits the cube face.(package private) static int
S2EdgeUtil.getFaceSegments
(S2Point a, S2Point b, S2EdgeUtil.FaceSegment[] segments) Subdivide the given edge AB at every point where it crosses the boundary between two S2 cube faces, returning the number of FaceSegments entries used (all entries must be prefilled).static Matrix3x3
Returns a right-handed coordinate frame (three orthonormal vectors) based on a single point, which will become the third axis.private static S1Angle
S2LatLngRectBase.getInteriorMaxDistance
(R1Interval aLat, S2Point b) Return max distance from a point b to the segment spanning latitude range aLat on longitude 0, if the max occurs in the interior of aLat.static S2Point
S2EdgeUtil.getIntersection
(S2Point a0, S2Point a1, S2Point b0, S2Point b1) Given two edges AB and CD such that robustCrossing() is true, return their intersection point.(package private) static S2Point
S2EdgeUtil.getIntersection
(S2Point a0, S2Point a1, S2Point b0, S2Point b1, S2EdgeUtil.ResultError resultError) Helper forS2EdgeUtil.getIntersection(com.google.common.geometry.S2Point,com.google.common.geometry.S2Point,com.google.common.geometry.S2Point,com.google.common.geometry.S2Point)
with provided result error parameter for testing and benchmarking purposes.(package private) static S2Point
S2EdgeUtil.getIntersectionApprox
(S2Point a0, S2Point a1, S2Point b0, S2Point b1, S2EdgeUtil.ResultError resultError) Returns the approximate intersection point of the edges (a0,a1) and (b0,b1), and writes to resultError a bound on its error.private static S2Point
S2EdgeUtil.getIntersectionApproxSorted
(S2Point a0, S2Point a1, S2Point b0, S2Point b1, S2EdgeUtil.ResultError resultError) Returns the approximate intersection point of the edges (a0,a1) and (b0,b1), and writes to resultError a bound on its error.(package private) static S2Point
S2EdgeUtil.getIntersectionExact
(S2Point a0, S2Point a1, S2Point b0, S2Point b1) Compute the intersection point of (a0, a1) and (b0, b1) using exact arithmetic.S2Cell.getMaxDistance
(S2Point target) Returns the maximum distance from the cell (including its interior) to the given point.S2Cell.getMaxDistance
(S2Point a, S2Point b) Returns the maximum distance from the cell (including its interior) to the given edge AB.S2ClosestPointQuery.EdgeTarget.getMinDistance
(S2Point x, S1ChordAngle minDist) S2ClosestPointQuery.PointTarget.getMinDistance
(S2Point x, S1ChordAngle minDist) S2ClosestPointQuery.Target.getMinDistance
(S2Point point, S1ChordAngle distance) Returns the smaller ofdistance
and a new distance from target topoint
.int
S2Polyline.getNearestEdgeIndex
(S2Point point) Given a point, returns the index of the start point of the (first) edge on the polyline that is closest to the given point.(package private) static int
S2EdgeUtil.getNextFace
(int face, R2Vector exit, int axis, S2Point n, int targetFace) Return the next face that should be visited by getFaceSegments, given that we have just visited "face" and we are following the line AB (represented by its normal N in the (u,v,w) coordinates of that face).(package private) static double
S2EdgeUtil.getProjection
(S2Point x, S2Point aNormal, double aNormalLen, S2Point a0, S2Point a1, S2EdgeUtil.ResultError resultError) Returns 2x the dot product of x and aNormal, and writes to resultError a bound on the error given that aNormal was calculated usingS2.robustCrossProd(com.google.common.geometry.S2Point, com.google.common.geometry.S2Point)
.private static Boolean
S2ShapeUtil.getReferencePointAtVertex
(S2Shape shape, S2Point vtest) Returns null if 'vtest' is balanced (see definition above), otherwise 'vtest' is unbalanced and the return value indicates whether it is contained by 'shape'.static void
S2RegionCoverer.getSimpleCovering
(S2Region region, S2Point start, int level, ArrayList<S2CellId> output) Given a connected region and a starting point, return a set of cells at the given level that cover the region.private static S2Loop
S2ConvexHullQuery.getSingleEdgeLoop
(S2Point a, S2Point b) Construct a loop consisting of the two vertices and their midpoint.private static S2Loop
S2ConvexHullQuery.getSinglePointLoop
(S2Point p) Constructs a 3-vertex polygon consisting of "p" and two nearby vertices.static S2Predicates.Excluded
S2Predicates.getVoronoiSiteExclusion
(S2Point a, S2Point b, S2Point p, S2Point q, double r2) This is a specialized method that is used to compute the intersection of an edge PQ with the Voronoi diagram of a set of points, where each Voronoi region is intersected with a disc of fixed radius "r".static S2EdgeUtil.WedgeRelation
Returns the relation from wedge A to B.static double
S2.girardArea
(S2Point a, S2Point b, S2Point c) Returns the area of the triangle computed using Girard's formula.boolean
Returns true if the given directed edge [v0 -> v1] is present in the directed edge graph.void
boolean
S2Cap.interiorContains
(S2Point p) Return true if and only if the given point is contained in the interior of the region (i.e.final boolean
S2LatLngRectBase.interiorContains
(S2Point p) Returns true if and only if the given point is contained in the interior of the region (i.e.static S2Point
S2EdgeUtil.interpolate
(double t, S2Point a, S2Point b) Return the point X along the line segment AB whose distance from A is the given fraction "t" of the distance AB.static S2Point
S2EdgeUtil.interpolateAtDistance
(S1Angle ax, S2Point a, S2Point b) LikeS2EdgeUtil.interpolate(double, com.google.common.geometry.S2Point, com.google.common.geometry.S2Point)
, except that the parameter "ax" represents the desired distance from A to the result X rather than a fraction between 0 and 1.static S2Point
S2EdgeUtil.interpolateAtDistance
(S1Angle ax, S2Point a, S2Point b, S1Angle ab) A slightly more efficient version ofS2EdgeUtil.interpolateAtDistance(com.google.common.geometry.S1Angle, com.google.common.geometry.S2Point, com.google.common.geometry.S2Point, com.google.common.geometry.S1Angle)
that can be used when the distance AB is already known.boolean
S2Cap.intersects
(S2Cell cell, S2Point[] vertices) Return true if the cap intersects 'cell', given that the cap vertices have already been checked.boolean
S2EdgeUtil.LongitudePruner.intersects
(S2Point v1) Returns true if the edge (v0, v1) intersects the given longitude interval, and then saves 'v1' to be used as the next 'v0'.boolean
S2EdgeUtil.XYZPruner.intersects
(S2Point v1) Returns true if the edge going from the last point to this point passes through the pruner bounding box, otherwise returns false.(package private) static boolean
S2EdgeUtil.intersectsFace
(S2Point n) Returns true if a given directed line L intersects the cube face F.static final boolean
S2LatLngRectBase.intersectsLatEdge
(S2Point a, S2Point b, double lat, S1Interval lng) Returns true if the edge AB intersects the given edge of constant latitude.static final boolean
S2LatLngRectBase.intersectsLngEdge
(S2Point a, S2Point b, R1Interval lat, double lng) Returns true if the edge AB intersects the given edge of constant longitude.(package private) static boolean
S2EdgeUtil.intersectsOppositeEdges
(S2Point n) Given a directed line L intersecting a cube face F, return true if L intersects two opposite edges of F (including the case where L passes exactly through a corner vertex of F).boolean
S2Shape.MutableEdge.isEndpoint
(S2Point point) Returns true iff 'point' is either endpoint of this edge.static boolean
S2.isUnitLength
(S2Point p) Return true if the given point is approximately unit length (this is mainly useful for assertions).static S1Angle
static final boolean
S2EdgeUtil.lenientCrossing
(S2Point a, S2Point b, S2Point c, S2Point d) Returns true if ab possibly crosses cd, by clipping tiny angles to zero.private boolean
boolean
(package private) int
S2Projections.levelIfCenter
(S2Projections.FaceSiTi fst, S2Point p) If p is exactly a cell center, returns the level of the cell, -1 otherwise.boolean
Positions the iterator at the index cell containing "target" and returns true, or if no such cell exists in the index, the iterator is positioned arbitrarily and this method returns false.static S1Angle
static S2Loop
S2Loop.makeRegularLoop
(S2Point center, S1Angle radius, int numVertices) Create a circle of points with a given center, radius, and number of vertices.S2Loop.makeRegularVertices
(S2Point center, S1Angle radius, int numVertices) AsS2Loop.makeRegularLoop(S2Point, S1Angle, int)
, but returns vertices as a list.static final S2Point
Returns sub(this,p).(package private) static int
S2EdgeUtil.moveOriginToValidFace
(int face, S2Point a, S2Point ab, R2Vector aUv) Given a line segment AB whose origin A has been projected onto a given cube face, determine whether it is necessary to project A onto a different face instead.void
Moves the focus to the given point.static final S2Point
Returns the component-wise multiplication of 'p' with 'm'.private static S2Point
Returns (a-b).crossProd(a+b), which eliminates almost all of the error due to "x" and "y" being not quite unit length.static final S2Point
Returns the component-wise negation of 'p', i.e.static final S2Point
Returns a copy of 'p' rescaled to be unit-length.static boolean
S2Predicates.orderedCCW
(S2Point a, S2Point b, S2Point c, S2Point o) Return true if the edges OA, OB, and OC are encountered in that order while sweeping CCW around the point O.static S2Point
Returns a unit-length vector that is orthogonal toa
.static S2Point
S2.planarCentroid
(S2Point a, S2Point b, S2Point c) Return the centroid of the planar triangle ABC.Returns a point on the polygon that is closest to point P.Returns the point on the polyline closest toqueryPoint
.S2Polyline.projectToEdge
(S2Point point, int index) Given a point p and the index of the start point of an edge of this polyline, returns the point on that edge that is closest to p.boolean
AsS2PointIndex.remove(Entry)
, but more convenient.void
S2EdgeUtil.CloserResult.replaceIfCloser
(S2Point x, S2Point y) void
Call this method when your chain 'jumps' to a new place.int
S2EdgeUtil.EdgeCrosser.robustCrossing
(S2Point d) This method is equivalent to calling theS2EdgeUtil.EdgeCrosser.robustCrossing(com.google.common.geometry.S2Point)
function (defined below) on the edges AB and CD.int
S2EdgeUtil.EdgeCrosser.robustCrossing
(S2Point c, S2Point d) AsS2EdgeUtil.EdgeCrosser.robustCrossing(S2Point)
, but restarts atc
if that is not the previous endpoint.static int
S2EdgeUtil.robustCrossing
(S2Point a, S2Point b, S2Point c, S2Point d) Like SimpleCrossing, except that points that lie exactly on a line are arbitrarily classified as being on one side or the other (according to the rules of sign).private int
S2EdgeUtil.EdgeCrosser.robustCrossingInternal
(S2Point d) Compute the actual result, and then save the current vertex D as the next vertex C, and save the orientation of the next triangle ACB (which is opposite to the current triangle BDA).private int
S2EdgeUtil.EdgeCrosser.robustCrossingInternal2
(S2Point d) static S2Point
S2.robustCrossProd
(S2Point a, S2Point b) Return a vector "c" that is orthogonal to the given unit-length vectors "a" and "b".(package private) static S2Point
Returns a normalized copyp
after rotating it by the rotation matrixr
.Rotates this point around an arbitrary axis.static final double
S2Point.scalarTripleProduct
(S2Point a, S2Point b, S2Point c) Returns the scalar triple product,a.dotProd(b.crossProd(c))
.void
Called by implementations ofS2Shape.getEdge(int, MutableEdge)
to update the endpoints of this mutable edge to the given values.void
S2EdgeUtil.XYZPruner.setFirstIntersectPoint
(S2Point v0) boolean
S2ContainsPointQuery.S2VertexModel.shapeContains
(S2Point cellCenter, S2ShapeIndex.S2ClippedShape clipped, S2Point p) Returns true if the clipped portion of a shape 'clipped' from a cell with center 'cellCenter' contains the point 'p' according to this vertex model.boolean
S2ContainsPointQuery.shapeContains
(S2Shape shape, S2Point p) Returns true if the given shape containsp
under the specifiedS2ContainsPointQuery.S2VertexModel
.static int
Returns the sign of the determinant of the matrix constructed from the three column vectorsa
,b
, andc
.private static int
Helper that checks the sign of ABC, using a precomputed cross product for AxB.static int
Returns +1 if the points A, B, C are counterclockwise, -1 if the points are clockwise, and 0 if any two points are the same.static int
Returns the sign of the turn ABC.static double
S2.signedArea
(S2Point a, S2Point b, S2Point c) Like area(), but returns a positive value for counterclockwise triangles and a negative value otherwise.static boolean
S2.simpleCrossing
(S2Point a, S2Point b, S2Point c, S2Point d) Return true if edge AB crosses CD at a point that is interior to both edges.static boolean
S2EdgeUtil.simpleCrossing
(S2Point a, S2Point b, S2Point c, S2Point d) Return true if edge AB crosses CD at a point that is interior to both edges.private static double
S2Predicates.sin2Distance
(S2Point x, S2Point y) Returns sin^2(XY), where XY=x.angle(y).static S2Point.Shape
private S2Point
S2PolygonBuilder.snapPointToLevel
(S2Point p, int level) Returns a new point, snapped to the center of the cell containing the given point at the specified level.private static S2Point
S2Polyline.snapPointToLevel
(S2Point p, int level) Returns a new point, snapped to the center of the cell containing the given point at the specified level.static int
Given that the exact test returned 0, returns a Simulation of Simplicity symbolic perturbation-based test result to select a consistent non-zero result.static int
Given the exact test resulted in 0, returns a Simulation of Simplicity-based test result, that can only result in zero if P == Q, A == B, B == C, or C == A (the result will be nonzero if these pairs are exactly proportional to each other but not equal.)static int
Compute the determinant in a numerically stable way.Returns sub(this,p).static final S2Point
Returns the component-wise subtraction of 'p1' and 'p2'.boolean
Returns true if the next edge should be received, or false to terminate early.int
Given two edge chains, this function returns +1 if the region to the left of A contains the region to the left of B, and 0 otherwise.int
Given two edge chains (see WedgeRelation above), this function returns +1 if A contains B, 0 if B contains A or the two wedges do not intersect, and -1 if the edge chains A and B cross each other (i.e.int
S2EdgeUtil.WedgeContainsOrIntersects.test
(S2Point a0, S2Point ab1, S2Point a2, S2Point b0, S2Point b2) Given two edge chains (see WedgeRelation above), this function returns +1 if A contains B, 0 if A and B are disjoint, and -1 if A intersects but does not contain B.int
Given two edge chains (see WedgeRelation above), this function returns -1 if the region to the left of A intersects the region to the left of B, and 0 otherwise.int
A wedge processor's test method accepts two edge chains A=(a0,a1,a2) and B=(b0,b1,b2) where a1==b1, and returns either -1, 0, or 1 to indicate the relationship between the region to the left of A and the region to the left of B.void
Tests whether the given edge of the given shape may cross the line segment between the old and new focus locations (seeS2ShapeIndex.InteriorTracker.drawTo(S2Point)
), and if there is a crossing the shape's containment of the focus is toggled.(package private) static S2Point
Converts 'p' to the basis given in 'frame'.static String
Convert an S2Point to the S2TextFormat string representation documented above.(package private) static int
Returns the sign of the determinant of the column matrix ABC, given the precomputed cross product AB.static int
Returns a test result based on firstS2Predicates.CompareDistance.triageCos(com.google.common.geometry.S2Point, com.google.common.geometry.S2Point, double)
and thenS2Predicates.CompareDistance.triageSin2(com.google.common.geometry.S2Point, com.google.common.geometry.S2Point, double)
, so it is fast for any input where exact arithmetic isn't needed.static int
Returns a cosine-based test result.static int
Returns -1, 0, or +1 according to whether the distance from the point X to the edge AB is less than, equal to, or greater than "r2" respectively, and may return 0 if the relation is indeterminate.static int
S2Predicates.EdgeCircumcenterSign.triage
(S2Point p, S2Point q, S2Point a, S2Point b, S2Point c, int abc) Returns a double-based test result.static int
This version of Sign returns +1 if the points are definitely CCW, -1 if they are definitely CW, and 0 if two points are identical or the result is uncertain.static S2Predicates.Excluded
A site exclusion test using double arithmetic.static int
Returns a cosine-based test result.static int
Returns a cosine-based test result.(package private) static int
S2Predicates.CompareEdgeDistance.triageLineCos2
(S2Point x, double r2, S2Point n, double n1, double n2) Like triageLineSin2, but this method computes the squared cosines of the distances involved.(package private) static int
S2Predicates.CompareEdgeDistance.triageLineEndpoints
(S2Point x, S2Point a, S2Point b, double r2) Returns the min test result from XA and XB, assuming the projection is A or B.(package private) static int
S2Predicates.CompareEdgeDistance.triageLineInterior
(S2Point x, S2Point a, S2Point b, double r2, S2Point n, double n1, double n2) Returns the min test result from XA and XB, assuming the projection is between A and B.(package private) static int
S2Predicates.CompareEdgeDistance.triageLineSin2
(S2Point x, S2Point a, S2Point b, double r2, S2Point n, double n1, double n2) Returns -1, 0, or +1 according to whether the distance from "x" to the great circle through (a, b) is less than, equal to, or greater than the given squared chord length "r2".static int
S2Predicates.CompareDistance.triageSin2
(S2Point x, S2Point y, double r2) Returns a sine-based test result, which has very good accuracy for small angles, although it only handles angles below 90 degrees.static int
S2Predicates.CompareDistances.triageSin2
(S2Point x, S2Point a, S2Point b) Returns the test result using a more accurate sine strategy, which only allows angles either both below -90 or both above +90 degrees.static S2Point
S2.trueCentroid
(S2Point a, S2Point b) Returns the true centroid of the spherical geodesic edge AB multiplied by the length of the edge AB.static S2Point
S2.trueCentroid
(S2Point a, S2Point b, S2Point c) Returns the true centroid of the spherical triangle ABC multiplied by the signed area of spherical triangle ABC.static double
Returns the exterior angle at the vertex B in the triangle ABC.private boolean
S2Cell.uEdgeIsClosest
(S2Point p, boolean vEnd) Given a pointp
and either the lower or upper edge of theS2Cell
(specified by settingvEnd
to false or true respectively), returns true ifp
is closer to the interior of that edge than it is to either endpoint.double
S2Polyline.uninterpolate
(S2Point queryPoint) Projects the query point to the nearest part of the polyline, and returns the fraction of the polyline's total length traveled along the polyline from vertex 0 to the projected point.static S1ChordAngle
S2EdgeUtil.updateMaxDistance
(S2Point x, S2Point a, S2Point b, S1ChordAngle maxDistance) Returns the maximum of the distance fromx
to any point on edge AB and the givenmaxDistance
.static S1ChordAngle
S2EdgeUtil.updateMinDistance
(S2Point p, S2Edge e, S1ChordAngle minDistance) Gets the minimum of the distance froma
toe
andminDistance
.static S1ChordAngle
S2EdgeUtil.updateMinDistance
(S2Point x, S2Point a, S2Point b, S1ChordAngle minDistance) Return the minimum of the distance fromx
to any point on edge ab and the givenminDistance
.static R2Vector
S2Projections.validFaceXyzToUv
(int face, S2Point p) Given a *valid* face for the given point p (meaning that dot product of p with the face normal is positive), return the corresponding u and v values (which may lie outside the range [-1,1]).(package private) static void
S2Projections.validFaceXyzToUv
(int face, S2Point p, R2Vector result) AsS2Projections.validFaceXyzToUv(int, S2Point)
, exceptresult
is updated, instead of a being returned in a new instance.private boolean
S2Cell.vEdgeIsClosest
(S2Point p, boolean uEnd) Given a pointp
and either the left or right edge of theS2Cell
(specified by settinguEnd
to false or true respectively), returns true ifp
is closer to the interior of that edge than it is to either endpoint.private double
S2Cell.vertexChordDist2
(S2Point uvw, S2Cell.DoubleBinaryOperator reducer) static boolean
S2EdgeUtil.vertexCrossing
(S2Point a, S2Point b, S2Point c, S2Point d) Given two edges AB and CD where at least two vertices are identical (i.e.(package private) boolean
S2ContainsPointQuery.visitContainingShapes
(S2Point p, S2ContainsPointQuery.ShapeVisitor visitor) Visits each shape that containsp
under the specifiedS2ContainsPointQuery.S2VertexModel
exactly once, and returns true, or terminates early and returns false if any invocation ofinvalid reference
ShapeVisitor#apply(S2Shape)
(package private) boolean
S2ContainsPointQuery.visitIncidentEdges
(S2Point p, S2ContainsPointQuery.EdgeVisitor visitor, S2Shape.MutableEdge tmp) Visits each edge in the index that is incident top
exactly once, and returns true, or terminates early and returns false ifvisitor
returns false.(package private) static boolean
S2Loop.wedgeContainsSemiwedge
(S2Point a0, S2Point ab1, S2Point a2, S2Point b2, boolean bReversed) Returns true if the wedge (a0, ab1, a2) contains the edge (ab1, b2), where [a0, ab1, a2] are a subset of the vertices of loop A, and [ab1, ab2, b2] are a subset of the vertices of loop B.boolean
S2Loop.CompareBoundaryRelation.wedgesCross
(S2Point a0, S2Point ab1, S2Point a2, S2Point b0, S2Point b2) boolean
boolean
boolean
Given a vertexab1
that is shared between the two loops, returns true if the two associated wedges (a0, ab1, b2) and (b0, ab1, b2) are equivalent to an edge crossing.static int
Returns the face containing the given direction vector (for points on the boundary between faces, the result is arbitrary but repeatable.)(package private) S2Projections.FaceSiTi
S2Projections.xyzToFaceSiTi
(S2Point p) Convert a direction vector (not necessarily unit length) to (face, si, ti) coordinates.final double
Returns the 'u' coordinate of the [u, v] point projected onto a cube face from the given [x, y, z] position.final double
Returns the 'v' coordinate of the [u, v] point projected onto a cube face from the given [x, y, z] position.Method parameters in com.google.common.geometry with type arguments of type S2PointModifier and TypeMethodDescriptionprivate static void
S2TextFormat.appendVertices
(Iterable<S2Point> points, StringBuilder out) (package private) static S2ShapeMeasures.LoopOrder
S2ShapeMeasures.canonicalLoopOrder
(List<S2Point> loop) Returns an index "first" and a direction "dir" such that the vertex sequence (first, first + dir, ..., first + (n - 1) * dir) does not change when the loop vertex order is rotated or reversed.private static int
S2PointVectorCoder.chooseBestLevel
(List<S2Point> points, List<S2PointVectorCoder.CellPoint> cellPoints) Returns theS2CellId
level for which the greatest number of the given points can be represented as the center of anS2CellId
, or -1 if there is no S2CellId that would result in significant space savings.private static int
Returns the count of vertices equal to vertices[start].static S2LaxPolygonShape
Creates a polygon from the given loops, defensively copying any loop's Iterable except anImmutableList
, to ensure the polygon is deeply immutable.static S2LaxPolylineShape
Creates a new lax polyline from the given vertices.static S2LaxPolylineShape
S2LaxPolylineShape.createMulti
(Iterable<? extends Iterable<S2Point>> lines) Creates a new lax multipolyline with the given lines.static S2LaxPolylineShape
S2LaxPolylineShape.createMultiPacked
(Iterable<? extends Iterable<S2Point>> lines) AsS2LaxPolylineShape.create(com.google.common.geometry.S2Polyline)
, but with coordinates packed into a double[].static S2LaxPolygonShape
S2LaxPolygonShape.createPacked
(Iterable<? extends Iterable<S2Point>> loops) AsS2LaxPolygonShape.create(com.google.common.geometry.S2Polygon)
, but packs coordinates into a double[] array.static S2LaxPolylineShape
S2LaxPolylineShape.createPacked
(Iterable<S2Point> vertices) AsS2LaxPolylineShape.create(com.google.common.geometry.S2Polyline)
, but with coordinates packed into a double[].void
S2PointVectorCoder.encode
(List<S2Point> values, OutputStream output) private static void
S2PointVectorCoder.encodeCompact
(List<S2Point> values, OutputStream output) Encodes a vector ofS2Point
s, optimizing for space.private static void
S2PointVectorCoder.encodeFast
(List<S2Point> values, OutputStream output) (package private) static void
S2PointCompression.encodePointsCompressed
(List<S2Point> points, int level, LittleEndianOutput encoder) static void
S2PointCompression.encodePointsCompressed
(List<S2Point> points, int level, OutputStream output) Encode a list of points into an efficient, lossless binary representation, which can be decoded by callingS2PointCompression.decodePointsCompressed(int, int, java.io.InputStream)
.private void
private static void
S2ShapeMeasures.forEachChainEdge
(S2Shape shape, int chainId, S2ShapeMeasures.BiConsumer<S2Point, S2Point> edgeConsumer) Passes each edge (a, b) in the chain of shape at index chainId to edgeConsumer.private static void
S2ShapeMeasures.forEachChainEdge
(S2Shape shape, int chainId, S2ShapeMeasures.BiConsumer<S2Point, S2Point> edgeConsumer) Passes each edge (a, b) in the chain of shape at index chainId to edgeConsumer.static Matrix3x3
Constructs a matrix from a series of column vectors.static S2Point.Shape
S2ConvexHullQuery.getMonotoneChain
(List<S2Point> points) private void
S2Polygon.initToSimplifiedInternal
(S2Polygon a, S1Angle tolerance, boolean snapToCellCenters, com.google.common.base.Predicate<S2Point> vertexFilter) Simplifies the polygon.static boolean
Static version of isValid(), to be used only when an S2Loop instance is not available, but validity of the points must be checked.boolean
Return true if the given vertices form a valid polyline.(package private) static double
Same asS2ShapeMeasures.loopArea(S2Shape, int)
, but takes a loop as a list of vertices.private void
S2PolygonBuilder.moveVertices
(Map<S2Point, S2Point> mergeMap) Moves a set of vertices from old to new positions.private void
S2PolygonBuilder.moveVertices
(Map<S2Point, S2Point> mergeMap) Moves a set of vertices from old to new positions.static S2Loop
S2Loop.newLoopWithTrustedDetails
(List<S2Point> vertices, boolean originInside, S2LatLngRect bound) Fast/unsafe loop initialization.S2ShapeMeasures.pruneDegeneracies
(List<S2Point> input) Returns a new loop obtained by removing all degeneracies from "input".private void
S2PolygonBuilder.rejectLoop
(List<S2Point> v, int n, List<S2Edge> unusedEdges) Marks all edges of the given loop as unused.static String
S2TextFormat.s2PointsToString
(List<S2Point> points) Convert a list of S2Points to the S2TextFormat string representation documented above.private static double
S2ShapeMeasures.signedLoopArea
(List<S2Point> loop) Same asS2ShapeMeasures.signedLoopArea(S2Shape, int)
, but takes a loop as a list of vertices.Returns a simplified loop, which may be self-intersecting, or null if the entire loop was within the tolerance.private static S2Point[]
Returns an array of the given vertices.private static double[]
(package private) static double
S2ShapeMeasures.turningAngle
(List<S2Point> loop) Returns the geodesic curvature of the loop, defined as the sum of the turn angles at each vertex (seeS2.turnAngle(S2Point, S2Point, S2Point)
).static void
S2ShapeUtil.visitSurfaceIntegral
(List<S2Point> vertices, S2ShapeUtil.TriangleConsumer consumer) Visits the surface integral of the vertices, that is, a collection of oriented triangles, possibly overlapping.Constructors in com.google.common.geometry with parameters of type S2PointModifierConstructorDescription(package private)
Creates a point of BigDecimal coordinates from a point of double coordinates.CloserResult
(double dmin2, S2Point vmin) (package private)
CrossingFilter
(S2Shape shape, S2EdgeQuery.Edges edges, S2Point a0, S2Point a1) EdgeCrosser
(S2Point a, S2Point b) Convenience constructor that calls init() with the given fixed edge AB.EdgeCrosser
(S2Point a, S2Point b, S2Point c) AB is the given fixed edge, and C is the first vertex of the vertex chain.EdgeTarget
(S2Point a, S2Point b) private
private
FaceEdge
(int shapeId, int edgeId, S2Point va, S2Point vb, R2Vector a, R2Vector b, double cellSizeToLongEdgeRatio) LongitudePruner
(S1Interval interval, S2Point v0) 'interval' is the longitude interval to be tested against, and 'v0' is the first vertex of edge chain.(package private)
OrderedCcwAround
(S2Point center) ParametrizedS2Point
(double time, S2Point point) PointTarget
(S2Point point) private
Return the angle between two points, which is also equal to the distance between these points on the unit sphere.S1ChordAngle
(S2Point x, S2Point y) Constructs the S1ChordAngle corresponding to the distance between the two given points.S2AreaCentroid
(double area, S2Point centroid) private
S2Cap
(S2Point axis, S1ChordAngle radius) S2ContainsVertexQuery
(S2Point target) Creates a contains vertex query to determine containment of 'target'.S2EdgeVectorShape
(S2Point a, S2Point b) Convenience constructor for creating a vector of length 1.Convert a point (not necessarily normalized) to an S2LatLng.S2PointRegion
(S2Point point) private
S2Polyline
(S2Point[] vertices) Constructor parameters in com.google.common.geometry with type arguments of type S2PointModifierConstructorDescription(package private)
(package private)
private
private
(package private)
LoopOrderComparator
(List<S2Point> loop) (package private)
MultiArray
(Iterable<? extends Iterable<S2Point>> loops) private
MultiArray
(Iterable<? extends Iterable<S2Point>> chains) private
MultiList
(List<S2Point> vertices, PrimitiveArrays.Longs cumulativeEdges) (package private)
MultiPacked
(Iterable<? extends Iterable<S2Point>> loops) (package private)
MultiPacked
(Iterable<? extends Iterable<S2Point>> chains) Initializes a loop with the given vertices.private
S2Loop
(List<S2Point> vertices, boolean originInside, S2LatLngRect bound) S2Polyline
(List<S2Point> vertices) Create a polyline that connects the given vertices.(package private)
SimpleArray
(Iterable<S2Point> vertices) private
SimpleArray
(Iterable<S2Point> vertices) private
SimpleList
(List<S2Point> vertices) private
SimpleList
(List<S2Point> vertices) (package private)
SimplePacked
(Iterable<S2Point> vertices) private
SimplePacked
(Iterable<S2Point> vertices)