Class SymmetryVisitorMesh
java.lang.Object
cz.fidentis.analyst.engines.symmetry.SymmetryVisitor
cz.fidentis.analyst.engines.symmetry.impl.SymmetryVisitorMesh
- All Implemented Interfaces:
MeshVisitor
A old implementation of the symmetry plane estimator taken from the old FIDENTIS.
Conceptually, it is similar to the
SymmetryVisitorRobustMesh
.
It also uses Gaussian curvature and normal vectors to prune candidate planes
and measure their quality. But some additional criteria are used as well.
Also, the calculation of "votes" differs.
This implementation has the following properties:
- Fast. A bit faster than the new robust algorithms of
SymmetryVisitorRobust
and much faster that theSymmetryVisitorRobustMesh
. - Best candidate planes are chosen based on the similarity of Gauss curvatures on both sides of the plane, inverse direction of normal vectors, and the distance of plane from centroid.
- Because the space of candidate planes is roughly approximated (several true-false rules), the final symmetry plane is computed by averaging best candidates (candidates with the most votes).
- Best results are achieved with Uniform Grid sampling with 200-300 points and averaging turn on.
- Should return reasonable results also for incomplete faces (was not tested).
This visitor is not thread-safe, i.e., a single instance of the visitor cannot be used to inspect multiple meshes simultaneously (sequential inspection is okay). It because the underlying visitors may not be thread-safe.
The main symmetry plane computation is performed by the getSymmetryPlane()
method,
not the visitMeshFacet(MeshFacet)
.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean
Iftrue
, then the final symmetry plane is computed by averaging the best candidates.static final double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
calculateSymmetryPlane
(boolean concurrently) Calculates the symmetry plane.void
dispose()
Dispose all disposable resources this visitor was using.Returns a symmetry plane.getSymmetryPlane
(boolean concurrently) Computes and returns the symmetry plane.protected int
checkAndUpdatePlanes
(List<CandidatePlaneMesh> planes, CandidatePlaneMesh newPlane, int maxVotes) boolean
Returnstrue
if the implementation is thread-safe and then a single visitor instance can be applied to multiple mesh facets simultaneously.protected void
setSymmetryPlane
(List<CandidatePlaneMesh> planes) void
visitMeshFacet
(MeshFacet facet) The inspection method to be implemented by specific visitors.
-
Field Details
-
MAX_REL_DISTANCE
public static final double MAX_REL_DISTANCE- See Also:
-
AVERAGING
public static final boolean AVERAGINGIftrue
, then the final symmetry plane is computed by averaging the best candidates. Iffalse
, then the random top candidate is selected.- See Also:
-
-
Constructor Details
-
SymmetryVisitorMesh
Constructor.- Parameters:
samplingStrategy
- Sub-sampling strategy. Must not benull
- Throws:
IllegalArgumentException
- if some input parameter is missing
-
-
Method Details
-
isThreadSafe
public boolean isThreadSafe()Description copied from interface:MeshVisitor
Returnstrue
if the implementation is thread-safe and then a single visitor instance can be applied to multiple mesh facets simultaneously.Thread-safe implementation means that any read or write from/to the visitor's state is protected by
synchronized
.- Returns:
true
if the implementation is thread-safe.
-
visitMeshFacet
Description copied from interface:MeshVisitor
The inspection method to be implemented by specific visitors.- Parameters:
facet
- Mesh facet to be visited.
-
getSymmetryPlane
Description copied from class:SymmetryVisitor
Returns a symmetry plane.- Specified by:
getSymmetryPlane
in classSymmetryVisitor
- Returns:
- a symmetry plane or
null
-
dispose
public void dispose()Description copied from interface:MeshVisitor
Dispose all disposable resources this visitor was using. Distances can still be retrieved after calling this method. Subclasses should override this method if they need to dispose something. -
getSymmetryPlane
Computes and returns the symmetry plane. The plane is computed only once, then the same instance is returned.- Parameters:
concurrently
- Iftrue
, then parallel computation is used utilizing all CPU cores.- Returns:
- the symmetry plane or
null
-
calculateSymmetryPlane
protected void calculateSymmetryPlane(boolean concurrently) Calculates the symmetry plane.- Parameters:
concurrently
- Iftrue
, then parallel computation is used utilizing all CPU cores. Otherwise, the computation is sequential.
-
checkAndUpdatePlanes
protected int checkAndUpdatePlanes(List<CandidatePlaneMesh> planes, CandidatePlaneMesh newPlane, int maxVotes) -
setSymmetryPlane
-