Package org.geoserver.w3ds.types

Examples of org.geoserver.w3ds.types.Vector3


public void addGeometry(Geometry geometry) {
    if (requestFormat == Format.OCTET_STREAM) {
        List<Vector3> vertexList = filterCoordinates(geometry.getCoordinates());
        for (int i = 0; i < vertexList.size(); i++) {
            Vector3 vertex = vertexList.get(i);
            if (!vertices.contains(vertex)) {
                vertices.add(vertex);
            }
        }
    } else {
View Full Code Here


private void lineFromCoordinates(Coordinate[] coordinates) {
    int len = coordinates.length;
    for (int i = 0; i < len; i++) {
        if (coordinates[i].z == Double.NaN) {
            vertices.add(new Vector3(coordinates[i].x, 0.0, coordinates[i].y));
        } else {
            vertices.add(new Vector3(coordinates[i].x, coordinates[i].z, coordinates[i].y));
        }
    }
    // Create new group for each line
    if (nodeList == null) {
        nodeList = new ArrayList<XML3DNode>();
View Full Code Here

    } else {
        firstIndex = vertices.size();
    }

    for (int i = 0; i < vertexList.size(); i++) {
        Vector3 vertex = vertexList.get(i);
        String vertexString = vertex.toString();

        if (counter > 2) {
            indices.add(prevIndex);
            counter = 1;
        }
View Full Code Here

private List<Double> createNormalsArray() {
    List<Double> vertexNormals = new ArrayList<Double>();

    for (int i = 0; i < vertices.size(); i++) {
        Vector3 normal = Vector3.Normalize(vertices.get(i).getNormal());

        vertexNormals.add(normal.x);
        vertexNormals.add(normal.y);
        vertexNormals.add(normal.z);
    }
View Full Code Here

        }
        if (coordinates[i].y < bbox[1] - offset || coordinates[i].y > bbox[3] + offset) {
            continue;
        }
       
        Vector3 vertex = new Vector3(coordinates[i].x, coordinates[i].z, coordinates[i].y);
        if (filtered.contains(vertex)) {
            continue;
        }
        filtered.add(vertex);
    }
View Full Code Here

    }
    return filtered;
}

private Vector3 computeTriangleNormal(Vector3 v0, Vector3 v1, Vector3 v2) {
    Vector3 normal = Vector3.Cross(v2.Minus(v0), v1.Minus(v0));

    return normal;
}
View Full Code Here

    return normal;
}

private List<Double> computeVertexNormals() {
    Vector3 v0 = null;
    Vector3 v1 = null;
    Vector3 v2 = null;

    int len = indices.size();
    for (int i = 0; i < len; i += 3) {
        v0 = vertices.get(indices.get(i));
        v1 = vertices.get(indices.get(i + 1));
        v2 = vertices.get(indices.get(i + 2));

        Vector3 normal = computeTriangleNormal(v0, v1, v2);

        v0.addNormal(normal);
        v1.addNormal(normal);
        v2.addNormal(normal);
    }
View Full Code Here

private List<List<Vector3> > getVertexGrid() {
    // At the moment this works only for points that form uniform grid
    List<List<Vector3> > vertexGrid = new ArrayList<List<Vector3> >();

    for (int i = 0; i < vertices.size(); i++) {
        Vector3 vertex = vertices.get(i);
       
        // Find correct row for vertex and add it there.
        boolean found = false;
        for (int j = 0; j < vertexGrid.size(); j++) {
            // Add first vertex to empty row
            if (vertexGrid.get(j).size() == 0) {
                vertexGrid.get(j).add(vertex);
                found = true;
                break;
            }
            Vector3 temp =vertexGrid.get(j).get(0);
            if (temp.z - 0.01 < vertex.z && temp.z + 0.01 > vertex.z) {
                vertexGrid.get(j).add(vertex);
                found = true;
                break;
            }
View Full Code Here

        // Get row for sorting
        List<Vector3> row = vertexGrid.get(i);
       
        // Sort vertices in that row
        for (int j = 0; j < row.size(); j++) {
            Vector3 vertex = row.get(j);
            int k = j - 1;
            while (k >= 0 && row.get(k).x < vertex.x) {
                row.set(k+1, row.get(k));
                k = k-1;
            }
View Full Code Here

TOP

Related Classes of org.geoserver.w3ds.types.Vector3

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.