Search in sources :

Example 1 with Horizon

use of net.imagej.ops.geom.geom3d.mesh.Horizon in project imagej-ops by imagej.

the class DefaultConvexHull3D method computeHorizon.

/**
 * Computes the horizon of vTop. The horizon is the merged facet of all facets
 * which are in front of the point vTop.
 *
 * @param frontFacet a face which is in front of vTop
 * @param vTop a point outside of the convex hull
 * @return facet containing all facets which are in front of vTop
 */
private Horizon computeHorizon(final double epsilon, final Set<Vertex> vertices, final List<TriangularFacet> facets, final List<TriangularFacet> facetsWithPointInFront, final TriangularFacet frontFacet, final Vertex vTop) {
    // Points which are in front have to be reassigned after all new facets
    // are constructed.
    vertices.addAll(frontFacet.getVerticesInFront());
    // frontFacet is not a result facet. Remove it from result list.
    facets.remove(frontFacet);
    Horizon h = new Horizon(frontFacet);
    TriangularFacet merge = nextFacetToMerge(epsilon, h, vTop);
    while (merge != null) {
        // This points have to be reassigned as well.
        vertices.addAll(merge.getVerticesInFront());
        // This face has some points in front and therefore is not a result
        // face.
        facets.remove(merge);
        // After this step this facet is merged with another facet.
        facetsWithPointInFront.remove(merge);
        if (h.containsAll(merge.getVertices())) {
            updateNeighbors(frontFacet, merge);
            h.complexMerge(merge);
        } else {
            updateNeighbors(frontFacet, merge);
            h.simpleMerge(merge);
        }
        merge = nextFacetToMerge(epsilon, h, vTop);
    }
    return h;
}
Also used : TriangularFacet(net.imagej.ops.geom.geom3d.mesh.TriangularFacet) Horizon(net.imagej.ops.geom.geom3d.mesh.Horizon)

Example 2 with Horizon

use of net.imagej.ops.geom.geom3d.mesh.Horizon in project imagej-ops by imagej.

the class DefaultConvexHull3D method replaceFacet.

/**
 * Replaces a facet with at least three new facets.
 *
 * @param facet the facet to replace. At least one point must be in front of
 *          next.
 */
private void replaceFacet(final double epsilon, final Set<Vertex> vertices, final List<TriangularFacet> facets, final List<TriangularFacet> facetsPointInFront, final TriangularFacet facet) {
    final Vertex v = facet.getMaximumDistanceVertex();
    final Horizon horizon = computeHorizon(epsilon, vertices, facets, facetsPointInFront, facet, v);
    assignPointsToFacets(epsilon, vertices, createFacets(horizon, v), facets, facetsPointInFront);
}
Also used : Vertex(net.imagej.ops.geom.geom3d.mesh.Vertex) Horizon(net.imagej.ops.geom.geom3d.mesh.Horizon)

Aggregations

Horizon (net.imagej.ops.geom.geom3d.mesh.Horizon)2 TriangularFacet (net.imagej.ops.geom.geom3d.mesh.TriangularFacet)1 Vertex (net.imagej.ops.geom.geom3d.mesh.Vertex)1