Package com.sk89q.worldedit.regions.polyhedron

Examples of com.sk89q.worldedit.regions.polyhedron.Triangle


        case 3:
            // Generate minimal mesh to start from
            final Vector[] v = vertices.toArray(new Vector[vertices.size()]);

            triangles.add((new Triangle(v[0], v[1], v[2])));
            triangles.add((new Triangle(v[0], v[2], v[1])));
            return true;
        }

        // Look for triangles that face the vertex and remove them
        final Set<Edge> borderEdges = new LinkedHashSet<Edge>();
        for (Iterator<Triangle> it = triangles.iterator(); it.hasNext(); ) {
            final Triangle triangle = it.next();

            // If the triangle can't be seen, it's not relevant
            if (!triangle.above(vertex)) {
                continue;
            }

            // Remove the triangle from the mesh
            it.remove();

            // ...and remember its edges
            for (int i = 0; i < 3; ++i) {
                final Edge edge = triangle.getEdge(i);
                if (borderEdges.remove(edge)) {
                    continue;
                }

                borderEdges.add(edge);
View Full Code Here


    public void shift(Vector change) throws RegionOperationException {
        shiftCollection(vertices, change);
        shiftCollection(vertexBacklog, change);

        for (int i = 0; i < triangles.size(); ++i) {
            final Triangle triangle = triangles.get(i);

            final Vector v0 = change.add(triangle.getVertex(0));
            final Vector v1 = change.add(triangle.getVertex(1));
            final Vector v2 = change.add(triangle.getVertex(2));

            triangles.set(i, new Triangle(v0, v1, v2));
        }

        minimumPoint = change.add(minimumPoint);
        maximumPoint = change.add(maximumPoint);
        centerAccum = change.multiply(vertices.size()).add(centerAccum);
View Full Code Here

TOP

Related Classes of com.sk89q.worldedit.regions.polyhedron.Triangle

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.