Class MeshDistanceNN
- All Implemented Interfaces:
MeshVisitor
,MeshDistanceVisitor
,Serializable
MeshDistanceNN dA = new MeshDistanceNN(faceA); MeshDistanceNN dB = new MeshDistanceNN(faceB); dA.visitMeshFacet(faceB); dB.visitMeshFacet(faceA); double hausdorffDist = Math.max(dA.getStats.getMax(), dB.getStats.getMax());
This visitor is instantiated with a single k-d tree (either given as the input parameter, or automatically created from the triangular mesh). When applied to other mesh facets, it finds points from the k-d tree that are the closest to each point of the inspected mesh.
This visitor is thread-safe, i.e., a single instance of the visitor can be used to inspect multiple meshes simultaneously.
The distance is computed either as absolute or relative. Absolute represents Euclidean distance (all numbers are positive). On the contrary, relative distance considers orientation of the visited mesh (determined by its normal vectors) and produces positive or negative distances depending on whether the primary mesh is "in front of" or "behind" the given vertex.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMeshDistanceNN
(KdTree mainKdTree, boolean pointToPoint, boolean relativeDistance, boolean parallel, boolean crop) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected MeshPoint
Return the KD tree to which distances are computed.protected KdTreeVisitor
instantiateVisitor
(javax.vecmath.Point3d inspectedPoint) void
setCrop
(boolean crop) Enables to change auto-cropping feature at runtimeprotected void
updateResults
(PointToSurfaceDistanceVisitor vis, MeshPoint point, List<Double> distList, List<MeshPoint> nearestPointsList) void
visitMeshFacet
(MeshFacet comparedFacet) The inspection method to be implemented by specific visitors.Methods inherited from class cz.fidentis.analyst.engines.distance.impl.MeshDistanceVisitorImpl
dispose, getDistancesOfVisitedFacets, inParallel, relativeDistance
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cz.fidentis.analyst.data.mesh.MeshVisitor
isThreadSafe
-
Constructor Details
-
MeshDistanceNN
public MeshDistanceNN(KdTree mainKdTree, boolean pointToPoint, boolean relativeDistance, boolean parallel, boolean crop) Constructor.- Parameters:
mainKdTree
- The KD tree to which distance from the visited facets is to be computed. Must not benull
pointToPoint
- Iftrue
, then point-to-point distance measurement is used. Otherwise, point-to-triangle is usedrelativeDistance
- If true, then the visitor calculates the relative distances with respect to the normal vectors of source facets (normal vectors have to present), i.e., we can get negative distances.parallel
- Iftrue
, then the algorithm runs concurrently utilizing all CPU corescrop
- Iftrue
, then only parts of the visited secondary faces that overlay the primary face are taken into account. Parts (vertices) that are out of the surface of the primary face are ignored (their distance is set toNaN
). This feature makes the distance computation more symmetric.- Throws:
IllegalArgumentException
- if some parameter is wrong
-
-
Method Details
-
setCrop
public void setCrop(boolean crop) Enables to change auto-cropping feature at runtime- Parameters:
crop
- Iftrue
, then only parts of the visited secondary faces that overlay the primary face are taken into account. Parts (vertices) that are out of the surface of the primary face are ignored (their distance is set toNaN
). This feature makes the distance computation more symmetric.
-
getMainKdTree
Return the KD tree to which distances are computed.- Returns:
- KD tree to which distances are computed
-
visitMeshFacet
Description copied from interface:MeshVisitor
The inspection method to be implemented by specific visitors.- Parameters:
comparedFacet
- Mesh facet to be visited.
-
instantiateVisitor
-
updateResults
-
getClosestMeshPoint
- Parameters:
vis
- visitor- Returns:
- the only one existing closest vertex or
null
-