Example usage for com.google.common.geometry S2Point S2Point

List of usage examples for com.google.common.geometry S2Point S2Point

Introduction

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

Prototype

public S2Point(double x, double y, double z) 

Source Link

Usage

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

/** Return a random unit-length vector. */
public S2Point randomPoint() {
    return S2Point.normalize(
            new S2Point(2 * rand.nextDouble() - 1, 2 * rand.nextDouble() - 1, 2 * rand.nextDouble() - 1));
}

From source file:org.esa.beam.occci.S2IEoProduct.java

static S2Polygon createS2Polygon(double[] poygonData) {
    List<S2Point> vertices = new ArrayList<S2Point>(poygonData.length / 3);
    for (int i = 0; i < poygonData.length;) {
        double x = poygonData[i++];
        double y = poygonData[i++];
        double z = poygonData[i++];
        S2Point s2Point = new S2Point(x, y, z);
        vertices.add(s2Point);//from ww w . j  a  v a2  s .com
    }
    return new S2Polygon(new S2Loop(vertices));
}

From source file:org.esa.beam.occci.S2IEoProduct.java

private static S2Polygon createS2Polygon(String loopPoints) {
    StringTokenizer stPoints = new StringTokenizer(loopPoints, ";");
    List<S2Point> vertices = new ArrayList<S2Point>();
    while (stPoints.hasMoreTokens()) {
        String point = stPoints.nextToken();
        String substring = point.substring(1, point.length() - 1);
        StringTokenizer stXYZ = new StringTokenizer(substring, ",");
        S2Point s2Point = new S2Point(Double.parseDouble(stXYZ.nextToken()),
                Double.parseDouble(stXYZ.nextToken()), Double.parseDouble(stXYZ.nextToken()));
        vertices.add(s2Point);//from   w w  w.j  ava  2 s . co m
    }
    S2Loop s2Loop = new S2Loop(vertices);
    return new S2Polygon(s2Loop);
}