Example usage for com.google.common.geometry S2CellId NUM_FACES

List of usage examples for com.google.common.geometry S2CellId NUM_FACES

Introduction

In this page you can find the example usage for com.google.common.geometry S2CellId NUM_FACES.

Prototype

int NUM_FACES

To view the source code for com.google.common.geometry S2CellId NUM_FACES.

Click Source Link

Usage

From source file:org.geosde.cassandra.GeometryTestCase.java

/**
 * Return a random cell id at the given level or at a randomly chosen level.
 * The distribution is uniform over the space of cell ids, but only
 * approximately uniform over the surface of the sphere.
 *//* ww w  .  j ava  2 s .  c  o m*/
public S2CellId getRandomCellId(int level) {
    int face = random(S2CellId.NUM_FACES);
    long pos = rand.nextLong() & ((1L << (2 * S2CellId.MAX_LEVEL)) - 1);
    return S2CellId.fromFacePosLevel(face, pos, level);
}