Home
last modified time | relevance | path

Searched refs:S2CellId (Results 1 – 15 of 15) sorted by relevance

/external/s2-geometry-library-java/tests/com/google/common/geometry/
DS2CellIdTest.java32 private S2CellId getCellId(double latDegrees, double lngDegrees) { in getCellId()
33 S2CellId id = S2CellId.fromLatLng(S2LatLng.fromDegrees(latDegrees, lngDegrees)); in getCellId()
41 S2CellId id = new S2CellId(); in testBasic()
46 id = S2CellId.fromFacePosLevel(3, 0x12345678, S2CellId.MAX_LEVEL - 4); in testBasic()
50 assertEquals(id.level(), S2CellId.MAX_LEVEL - 4); in testBasic()
71 assertEquals(id.childBegin(S2CellId.MAX_LEVEL), id.rangeMin()); in testBasic()
72 assertEquals(id.childEnd(S2CellId.MAX_LEVEL), id.rangeMax().next()); in testBasic()
75 assertEquals(S2CellId.begin(0).prevWrap(), S2CellId.end(0).prev()); in testBasic()
77 assertEquals(S2CellId.begin(S2CellId.MAX_LEVEL).prevWrap(), in testBasic()
78 S2CellId.fromFacePosLevel(5, ~0L >>> S2CellId.FACE_BITS, S2CellId.MAX_LEVEL)); in testBasic()
[all …]
DS2CellUnionTest.java33 ArrayList<S2CellId> ids = Lists.newArrayList(); in testBasic()
37 S2CellId face1Id = S2CellId.fromFacePosLevel(1, 0, 0); in testBasic()
44 S2CellId face2Id = S2CellId.fromFacePosLevel(2, 0, 0); in testBasic()
61 Set<S2CellId> randomCells = new HashSet<S2CellId>(); in testContainsCellUnion()
63 randomCells.add(getRandomCellId(S2CellId.MAX_LEVEL)); in testContainsCellUnion()
70 while (!randomCells.add(getRandomCellId(S2CellId.MAX_LEVEL))) { in testContainsCellUnion()
80 Set<S2CellId> parents = new HashSet<S2CellId>(); in testContainsCellUnion()
81 for (S2CellId cellId : union) { in testContainsCellUnion()
92 private void addCells(S2CellId id, boolean selected, List<S2CellId> input, in addCells()
93 ArrayList<S2CellId> expected) { in addCells()
[all …]
DS2RegionCovererTest.java33 S2CellId id = getRandomCellId(); in testRandomCells()
42 S2RegionCoverer coverer, S2Region region, ArrayList<S2CellId> covering, boolean interior) { in checkCovering()
45 HashMap<S2CellId, Integer> minLevelCells = new HashMap<S2CellId, Integer>(); in checkCovering()
51 S2CellId key = covering.get(i).parent(coverer.minLevel()); in checkCovering()
73 checkCovering(region, cellUnion, true, new S2CellId()); in checkCovering()
80 final int kMaxLevel = S2CellId.MAX_LEVEL; in testRandomCaps()
92 ArrayList<S2CellId> covering = new ArrayList<S2CellId>(); in testRandomCaps()
93 ArrayList<S2CellId> interior = new ArrayList<S2CellId>(); in testRandomCaps()
103 ArrayList<S2CellId> covering2 = new ArrayList<S2CellId>(); in testRandomCaps()
113 ArrayList<S2CellId> denormalized = new ArrayList<S2CellId>(); in testRandomCaps()
[all …]
DGeometryTestCase.java71 public S2CellId getRandomCellId(int level) {
72 int face = random(S2CellId.NUM_FACES);
73 long pos = rand.nextLong() & ((1L << (2 * S2CellId.MAX_LEVEL)) - 1);
74 return S2CellId.fromFacePosLevel(face, pos, level);
77 public S2CellId getRandomCellId() {
78 return getRandomCellId(random(S2CellId.MAX_LEVEL + 1));
107 void checkCovering(S2Region region, S2CellUnion covering, boolean checkTight, S2CellId id) {
110 checkCovering(region, covering, checkTight, S2CellId.fromFacePosLevel(face, 0, 0));
127 S2CellId end = id.childEnd();
128 for (S2CellId child = id.childBegin(); !child.equals(end); child = child.next()) {
DS2LoopTest.java212 for (S2CellId id = S2CellId.begin(level); !id.equals(S2CellId.end(level)); id = id.next()) { in testContains()
234 private S2CellId advance(S2CellId id, int n) { in advance()
241 private S2Loop makeCellLoop(S2CellId begin, S2CellId end) { in makeCellLoop()
247 for (S2CellId id = begin; !id.equals(end); id = id.next()) { in makeCellLoop()
397 S2CellId begin = new S2CellId(num | 1); in suppressedTestLoopRelations2()
401 begin = begin.parent((int) Math.round(rand.nextDouble() * S2CellId.MAX_LEVEL)); in suppressedTestLoopRelations2()
402 S2CellId aBegin = advance(begin, skewed(6)); in suppressedTestLoopRelations2()
403 S2CellId aEnd = advance(aBegin, skewed(6) + 1); in suppressedTestLoopRelations2()
404 S2CellId bBegin = advance(begin, skewed(6)); in suppressedTestLoopRelations2()
405 S2CellId bEnd = advance(bBegin, skewed(6) + 1); in suppressedTestLoopRelations2()
DS2CellTest.java31 S2CellId id = S2CellId.fromFacePosLevel(face, 0, 0); in testFaces()
104 S2CellId.MAX_LEVEL + 1);
107 for (int i = 0; i < S2CellId.MAX_LEVEL + 1; ++i) {
174 S2CellId childId = cell.id().childBegin(); in testSubdivide()
365 for (int i = 0; i <= S2CellId.MAX_LEVEL; ++i) { in testSubdivide()
384 for (int i = 0; i <= S2CellId.MAX_LEVEL; ++i) { in testSubdivide()
435 S2CellId id = cell.id().childBegin(); in expandChildren2()
DS2CapTest.java192 S2CellId first = cornerCell.id().prev().prev().prev(); in testCells()
193 S2CellId last = cornerCell.id().next().next().next().next(); in testCells()
194 for (S2CellId id = first; id.lessThan(last); id = id.next()) { in testCells()
DS2Test.java276 for (int level = -2; level <= S2CellId.MAX_LEVEL + 3; ++level) {
278 if (level >= S2CellId.MAX_LEVEL + 3) {
283 int expectedLevel = Math.max(0, Math.min(S2CellId.MAX_LEVEL, level));
/external/s2-geometry-library-java/src/com/google/common/geometry/
DS2CellUnion.java33 public strictfp class S2CellUnion implements S2Region, Iterable<S2CellId> {
36 private ArrayList<S2CellId> cellIds = new ArrayList<S2CellId>();
41 public void initFromCellIds(ArrayList<S2CellId> cellIds) { in initFromCellIds()
57 public void initSwap(ArrayList<S2CellId> cellIds) { in initSwap()
62 public void initRawCellIds(ArrayList<S2CellId> cellIds) { in initRawCellIds()
68 this.cellIds = new ArrayList<S2CellId>(size); in initRawIds()
70 this.cellIds.add(new S2CellId(id)); in initRawIds()
81 public void initRawSwap(ArrayList<S2CellId> cellIds) { in initRawSwap()
82 this.cellIds = new ArrayList<S2CellId>(cellIds); in initRawSwap()
91 public S2CellId cellId(int i) { in cellId()
[all …]
DS2CellId.java51 public final strictfp class S2CellId implements Comparable<S2CellId> { class
112 public S2CellId(long id) { in S2CellId() method in S2CellId
116 public S2CellId() { in S2CellId() method in S2CellId
121 public static S2CellId none() { in none()
122 return new S2CellId(); in none()
129 public static S2CellId sentinel() { in sentinel()
130 return new S2CellId(MAX_UNSIGNED); // -1 in sentinel()
140 public static S2CellId fromFacePosLevel(int face, long pos, int level) { in fromFacePosLevel()
141 return new S2CellId((((long) face) << POS_BITS) + (pos | 1)).parent(level); in fromFacePosLevel()
148 public static S2CellId fromPoint(S2Point p) { in fromPoint()
[all …]
DS2EdgeIndex.java75 minimumS2LevelUsed = S2CellId.MAX_LEVEL; in reset()
112 ArrayList<S2CellId> cover = Lists.newArrayList(); in computeIndex()
115 for (S2CellId cellId : cover) { in computeIndex()
234 ArrayList<S2CellId> cover = Lists.newArrayList(); in findCandidateCrossings()
256 private static S2CellId containingCell(S2Point pa, S2Point pb, S2Point pc, S2Point pd) { in containingCell()
257 S2CellId a = S2CellId.fromPoint(pa); in containingCell()
258 S2CellId b = S2CellId.fromPoint(pb); in containingCell()
259 S2CellId c = S2CellId.fromPoint(pc); in containingCell()
260 S2CellId d = S2CellId.fromPoint(pd); in containingCell()
263 return S2CellId.sentinel(); in containingCell()
[all …]
DS2RegionCoverer.java95 ArrayList<S2CellId> result;
141 maxLevel = S2CellId.MAX_LEVEL; in S2RegionCoverer()
145 result = new ArrayList<S2CellId>(); in S2RegionCoverer()
170 this.minLevel = Math.max(0, Math.min(S2CellId.MAX_LEVEL, minLevel)); in setMinLevel()
178 this.maxLevel = Math.max(0, Math.min(S2CellId.MAX_LEVEL, maxLevel)); in setMaxLevel()
251 public void getCovering(S2Region region, ArrayList<S2CellId> covering) { in getCovering()
271 public void getInteriorCovering(S2Region region, ArrayList<S2CellId> interior) { in getInteriorCovering()
317 S2Region region, S2Point start, int level, ArrayList<S2CellId> output) { in getSimpleCovering()
318 floodFill(region, S2CellId.fromPoint(start).parent(level), output); in getSimpleCovering()
448 Math.min(maxLevel(), S2CellId.MAX_LEVEL - 1)); in getInitialCandidates()
[all …]
DS2Cell.java28 private static final int MAX_CELL_SIZE = 1 << S2CellId.MAX_LEVEL;
33 S2CellId cellId;
46 public S2Cell(S2CellId id) { in S2Cell()
52 return new S2Cell(S2CellId.fromFacePosLevel(face, pos, level)); in fromFacePosLevel()
57 init(S2CellId.fromPoint(p)); in S2Cell()
61 init(S2CellId.fromLatLng(ll)); in S2Cell()
65 public S2CellId id() { in id()
82 return level == S2CellId.MAX_LEVEL; in isLeaf()
142 S2CellId id = cellId.childBegin(); in subdivide()
185 int cellSize = 1 << (S2CellId.MAX_LEVEL - level); in getCenterUV()
[all …]
DS2PolygonBuilder.java591 for (Map.Entry<S2CellId, MarkedS2Point> entry : index.entries()) { in mergeVertices()
629 private class PointIndex extends ForwardingMultimap<S2CellId, MarkedS2Point> {
632 private final Multimap<S2CellId, MarkedS2Point> delegate = HashMultimap.create();
644 Math.min(S2Projections.MIN_WIDTH.getMaxLevel(2 * searchRadius), S2CellId.MAX_LEVEL - 1); in PointIndex()
648 protected Multimap<S2CellId, MarkedS2Point> delegate() { in delegate()
654 S2CellId id = S2CellId.fromPoint(p).parent(level); in add()
672 List<S2CellId> neighbors = Lists.newArrayList(); in query()
673 S2CellId.fromPoint(center).getVertexNeighbors(level, neighbors); in query()
674 for (S2CellId id : neighbors) { in query()
DS2.java186 return S2CellId.MAX_LEVEL; in getMinLevel()
193 Math.min(S2CellId.MAX_LEVEL, -((exponent - 1) >> (dim - 1)))); in getMinLevel()
208 return S2CellId.MAX_LEVEL; in getMaxLevel()
215 Math.min(S2CellId.MAX_LEVEL, ((exponent - 1) >> (dim - 1)))); in getMaxLevel()