Class IcpVisitorImpl

java.lang.Object
cz.fidentis.analyst.engines.icp.impl.IcpVisitorImpl
All Implemented Interfaces:
MeshVisitor, IcpVisitor

public class IcpVisitorImpl extends Object implements IcpVisitor
The implementation of the ICP visitor.
  • Field Details

    • transformations

      protected final Map<MeshFacet,List<IcpTransformation>> transformations
      Transformed mesh facets and their history of transformations. Key = visited mesh facets. Value = History of transformations (transformation performed in each ICP iteration).
    • maxIteration

      protected final int maxIteration
      Maximal number of ICP iterations
    • primaryKdTree

      protected final KdTree primaryKdTree
      K-d tree of the primary triangular mesh(es).
    • crop

      protected final int crop
  • Constructor Details

    • IcpVisitorImpl

      public IcpVisitorImpl(Collection<MeshFacet> mainFacets, int maxIteration, boolean scale, double error, PointSamplingConfig strategy, int crop)
      Constructor.
      Parameters:
      mainFacets - Primary mesh facets. Must not be null. Inspected facets are transformed toward these primary mesh.
      maxIteration - Maximal number of ICP iterations (it includes computing new transformation and applying it). A number bigger than zero. Reasonable number seems to be 10.
      scale - If true, then the scale factor is also computed.
      error - Acceptable error - a number bigger than or equal to zero. Mean distance of vertices is computed for each ICP iteration. If the difference between the previous and current mean distances is less than the error, then the ICP computation stops. Reasonable number seems to be 0.05.
      strategy - One of the reduction strategies. If null, then NoUndersampling is used.
      crop - The iteration number from which partially overlapped parts of surfaces are omitted from distance minimization (i.e. the faces are auto-cropped for the ICP step). Set the parameter to zero to turn the auto-cropping feature on for all ICP iterations. Set the parameter to any negative number to disable the auto-cropping feature. In general, use auto-cropping if the faces are pre-aligned. If unsure, use value 1.
      Throws:
      IllegalArgumentException - if some parameter is wrong
    • IcpVisitorImpl

      public IcpVisitorImpl(MeshModel mainModel, int maxIteration, boolean scale, double error, PointSamplingConfig strategy, int crop)
      Constructor.
      Parameters:
      mainModel - Primary mesh model. Must not be null. Inspected facets are transformed toward this primary mesh.
      maxIteration - Maximal number of ICP iterations (it includes computing new transformation and applying it). A number bigger than zero. Reasonable number seems to be 10.
      scale - If true, then the scale factor is also computed.
      error - Acceptable error - a number bigger than or equal to zero. Mean distance of vertices is computed for each ICP iteration. If the difference between the previous and current mean distances is less than the error, then the ICP computation stops. Reasonable number seems to be 0.05.
      strategy - One of the reduction strategies. If null, then NoUndersampling is used.
      crop - The iteration number from which partially overlapped parts of surfaces are omitted from distance minimization (i.e. the faces are auto-cropped for the ICP step). Set the parameter to zero to turn the auto-cropping feature on for all ICP iterations. Set the parameter to any negative number to disable the auto-cropping feature. In general, use auto-cropping if the faces are pre-aligned. If unsure, use value 1.
      Throws:
      IllegalArgumentException - if some parameter is wrong
    • IcpVisitorImpl

      public IcpVisitorImpl(KdTree primaryKdTree, int maxIteration, boolean scale, double error, PointSamplingConfig strategy, int crop)
      Constructor.
      Parameters:
      primaryKdTree - The k-d tree of the primary mesh. Must not be null. Inspected facets are transformed toward this primary mesh.
      maxIteration - Maximal number of ICP iterations (it includes computing new transformation and applying it). A number bigger than zero. Reasonable number seems to be 10.
      scale - If true, then the scale factor is also computed.
      error - Acceptable error - a number bigger than or equal to zero. Mean distance of vertices is computed for each ICP iteration. If the difference between the previous and current mean distances is less than the error, then the ICP computation stops. Reasonable number seems to be 0.05.
      strategy - One of the reduction strategies. If null, then NoUndersampling is used.
      crop - The iteration number from which partially overlapped parts of surfaces are omitted from distance minimization (i.e. the faces are auto-cropped for the ICP step). Set the parameter to zero to turn the auto-cropping feature on for all ICP iterations. Set the parameter to any negative number to disable the auto-cropping feature. In general, use auto-cropping if the faces are pre-aligned. If unsure, use value 1.
      Throws:
      IllegalArgumentException - if some parameter is wrong
  • Method Details

    • getTransformations

      public Map<MeshFacet,List<IcpTransformation>> getTransformations()
      Description copied from interface: IcpVisitor
      Returns the history of transformations (transformation performed in each ICP iteration for each inspected mesh facet). Keys in the map contain mesh facets that were inspected and transformed. For each transformed facet, a list of transformations to the primary mesh is stored. The order of transformations corresponds to the order of ICP iterations, i.e., the i-th value is the transformation applied in the i-th iteration on the visited mesh facet. It also means that the size of the list corresponds to the number of iterations performed for given mesh facet.
      Specified by:
      getTransformations in interface IcpVisitor
      Returns:
      The history of transformations (transformation performed in each ICP iteration for each inspected mesh facet).
    • isThreadSafe

      public boolean isThreadSafe()
      Description copied from interface: MeshVisitor
      Returns true 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.

      Specified by:
      isThreadSafe in interface MeshVisitor
      Returns:
      true if the implementation is thread-safe.
    • getMaxIterations

      public int getMaxIterations()
      Returns the maximal number of ICP iterations used for the computation.
      Returns:
      the maximal number of ICP iterations used for the computation
    • getError

      public double getError()
      Returns maximal acceptable error used for the computation.
      Returns:
      maximal acceptable error used for the computation
    • getScale

      public boolean getScale()
      Returns true if the inspected mesh faces were also scaled.
      Returns:
      true if the inspected mesh faces were also scaled.
    • getPrimaryKdTree

      public KdTree getPrimaryKdTree()
      Returns k-d tree of the primary mesh to which other meshes has been transformed.
      Returns:
      k-d tree of the primary mesh
    • visitMeshFacet

      public void visitMeshFacet(MeshFacet transformedFacet)
      Description copied from interface: MeshVisitor
      The inspection method to be implemented by specific visitors.
      Specified by:
      visitMeshFacet in interface MeshVisitor
      Parameters:
      transformedFacet - Mesh facet to be visited.