Package com.google.common.geometry
Class S2PolygonBuilder.Options.Builder
- java.lang.Object
-
- com.google.common.geometry.S2PolygonBuilder.Options.Builder
-
- Enclosing class:
- S2PolygonBuilder.Options
public static class S2PolygonBuilder.Options.Builder extends Object
Builder class forS2PolygonBuilder.Options.
-
-
Constructor Summary
Constructors Constructor Description Builder()Constructs a new builder with default values, which is equivalent toS2PolygonBuilder.Options.DIRECTED_XOR.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description S2PolygonBuilder.Optionsbuild()Builds and returns a new (immutable) instance ofS2PolygonBuilder.Options.S2PolygonBuilder.Options.BuildersetEdgeSpliceFraction(double edgeSpliceFraction)Sets the threshold radius at which vertex are spliced into an edge.S2PolygonBuilder.Options.BuildersetMergeDistance(S1Angle mergeDistance)Sets the threshold angle at which to merge vertex pairs.S2PolygonBuilder.Options.BuildersetRobustnessRadius(S1Angle robustnessRadius)SetsmergeDistancecomputed from robustness radius and edge splice fraction.S2PolygonBuilder.Options.BuildersetSnapToCellCenters(boolean snapToCellCenters)Sets whether a polygon will snap its vertices to the centers of s2 cells at the smallest level number such that no vertex will move by more than the robustness radius.S2PolygonBuilder.Options.BuildersetUndirectedEdges(boolean undirectedEdges)Sets whether edges are undirected.S2PolygonBuilder.Options.BuildersetValidate(boolean validate)Sets whetherS2Loop.isValid()is called for all loops.S2PolygonBuilder.Options.BuildersetXorEdges(boolean xorEdges)Sets whether duplicated edges will be collapsed.
-
-
-
Constructor Detail
-
Builder
public Builder()
Constructs a new builder with default values, which is equivalent toS2PolygonBuilder.Options.DIRECTED_XOR.
-
-
Method Detail
-
build
public S2PolygonBuilder.Options build()
Builds and returns a new (immutable) instance ofS2PolygonBuilder.Options.
-
setUndirectedEdges
public S2PolygonBuilder.Options.Builder setUndirectedEdges(boolean undirectedEdges)
Sets whether edges are undirected. SeeS2PolygonBuilder.Options.getUndirectedEdges().Default: false
-
setXorEdges
public S2PolygonBuilder.Options.Builder setXorEdges(boolean xorEdges)
Sets whether duplicated edges will be collapsed. SeeS2PolygonBuilder.Options.getXorEdges().Default: true
-
setValidate
public S2PolygonBuilder.Options.Builder setValidate(boolean validate)
Sets whetherS2Loop.isValid()is called for all loops. SeeS2PolygonBuilder.Options.getValidate().Default: false
-
setMergeDistance
public S2PolygonBuilder.Options.Builder setMergeDistance(S1Angle mergeDistance)
Sets the threshold angle at which to merge vertex pairs. SeeS2PolygonBuilder.Options.getMergeDistance().Default value: 0.
-
setSnapToCellCenters
public S2PolygonBuilder.Options.Builder setSnapToCellCenters(boolean snapToCellCenters)
Sets whether a polygon will snap its vertices to the centers of s2 cells at the smallest level number such that no vertex will move by more than the robustness radius. If the robustness radius is smaller than half the leaf cell diameter, no snapping will occur. SeeS2PolygonBuilder.Options.getSnapToCellCenters().Default value: false
-
setEdgeSpliceFraction
public S2PolygonBuilder.Options.Builder setEdgeSpliceFraction(double edgeSpliceFraction)
Sets the threshold radius at which vertex are spliced into an edge. SeeS2PolygonBuilder.Options.getEdgeSpliceFraction(). Must be at leastsqrt(3) / 2.Default value: 0.866
-
setRobustnessRadius
public S2PolygonBuilder.Options.Builder setRobustnessRadius(S1Angle robustnessRadius)
SetsmergeDistancecomputed from robustness radius and edge splice fraction. TheedgeSpliceFractioncannot be zero to have a robustness guarantee.See
S2PolygonBuilder.Options.getRobustnessRadius(). To guarantee that a polygon remains valid when its vertices are moved by an angle of up to epsilon, you needmergeDistance * edgeSpliceFraction >= 2 * epsilon, as the edge and the vertex can each move by epsilon upon snapping.If your grid has maximum diameter
d, callsetRobustnessRadius(d/2).
-
-