Commit 3499640a authored by Daniel Schramm's avatar Daniel Schramm
Browse files

PrioritySphere javadoc added

parent 8fb687ef
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -11,6 +11,19 @@ import java.util.Map;
import javax.vecmath.Point3d;

/**
 * This visitor computes priorities of vertices of a mesh facet according to their absolute distance from
 * the given {@link PrioritySphere#sphereCenterPosition} point.
 * <ul>
 *   <li>The closer a vertex is to {@link PrioritySphere#sphereCenterPosition}, the higher its priority is.</li>
 *   <li>Vertices that are further than {@link PrioritySphere#sphereRadius} from {@link PrioritySphere#sphereCenterPosition}
 *       have priority equal to 0.</li>
 * </ul>
 * <p>
 *   The visitor returns all mesh facets together with priorities of all their vertices
 * </p>
 * <p>
 *   This visitor is thread-safe.
 * </p>
 * 
 * @author Daniel Schramm
 */
@@ -21,6 +34,13 @@ public class PrioritySphere extends MeshVisitor {
    
    private final Map<MeshFacet, List<Double>> priorities = new HashMap<>();

    /**
     * Constructor.
     * 
     * @param sphereCenterPosition Position of the center of the sphere in which
     *                             the priorities will be calculated
     * @param sphereRadius Radius of the sphere
     */
    public PrioritySphere(Point3d sphereCenterPosition, double sphereRadius) {
        if (sphereCenterPosition == null) {
            throw new IllegalArgumentException("sphereCenterPosition");
@@ -29,6 +49,15 @@ public class PrioritySphere extends MeshVisitor {
        this.sphereRadius = sphereRadius;
    }

    /**
     * Returns map of visited mesh facets together with a list of priorities of their vertices.
     * 
     * The order of priorities corresponds to the order of vertices
     * in the visited facet, i.e., the i-th priority is a priority of the i-th vertex
     * of the visited facet.
     * 
     * @return map of visited mesh facets and priorities of their vertices
     */
    public Map<MeshFacet, List<Double>> getPriorities() {
        return Collections.unmodifiableMap(priorities);
    }