Class TriMeshSurfaceSampler


  • public class TriMeshSurfaceSampler
    extends java.lang.Object
    random sampling of points and orientations close to the surface of a geometry.

    A point p on the surface is randomly choosen.

    A rotation rot is randomly generated.

    A random distance d in the interval [minD, maxD] is generated

    The position pos is calculated as pos = p - rot*(0,0,d)^T

    The random pose X is thus X = (pos, rot)
    Optionally a random rotation of X can be generated such that z-axis of rot is
    not allways pointing toward the surface.
    • Constructor Detail

      • TriMeshSurfaceSampler

        public TriMeshSurfaceSampler​(long cPtr,
                                     boolean cMemoryOwn)
      • TriMeshSurfaceSampler

        public TriMeshSurfaceSampler()
        constructor
      • TriMeshSurfaceSampler

        public TriMeshSurfaceSampler​(GeometryPtr geom)
        constructor
        Parameters:
        geom - [in] geometry representing the surface that should be sampled.
      • TriMeshSurfaceSampler

        public TriMeshSurfaceSampler​(VectorGeometryPtr geoms)
        constructor
        Parameters:
        geoms - [in] list of geometries representing the surface that should be sampled.
    • Method Detail

      • delete

        public void delete()
      • add

        public void add​(GeometryPtr geom)
        add surface representing geometry to this sampler
        Parameters:
        geom - [in] geometry representing surface to be sampled
      • add

        public void add​(TriMeshPtr mesh)
        add surface mesh.
        Parameters:
        mesh - [in] mesh to add to sampler.
      • sample

        public Transform3D sample()
        sample a pose on the surface of the object.
        Returns:
        transform3d of the sampled pose
      • samplePoint

        public Vector3D samplePoint()
        sample point on surface of object
        Conditional comment:

        End of conditional comment.
      • setBoundsD

        public void setBoundsD​(double minD,
                               double maxD)
        set the bounds to which the random position around the sampled surface
        point will be generated. See setRandomPositionEnabled
        Parameters:
        minD - [in] minimum distance
        maxD - [in] maximum distance.
      • setRandomRotationEnabled

        public void setRandomRotationEnabled​(boolean enabled)
        enable the generation of a random rotation instead of a rotation with
        the z-axis pointing in the surface normal direction.
        Parameters:
        enabled - [in]
      • setRandomPositionEnabled

        public void setRandomPositionEnabled​(boolean enabled)
        enables generation of a random position within the sampled surface position.
        The local point will be generated within a min and max distance from the sampled
        surface point. See setBoundsD
        Parameters:
        enabled - [in] true to enable local random generation around sampled surface point.
        False otherwise.
      • setZAxisDirectionEnabled

        public void setZAxisDirectionEnabled​(boolean enabled)
        enable z-axis direction filtering. See setZAxisDirection for information
        on setting the direction.

        Parameters:
        enabled -
      • setZAxisDirection

        public void setZAxisDirection​(Vector3D dir)
        sets the direction that the z-axis must point into. this is equal
        to testing if the z-axis of the generated pose lies on the right side of
        the plane defined by the plane normal dir and (0,0,0).

        Setting this also sets setZAxisDirectionEnabled( true )

        Parameters:
        dir - [in]
      • getMesh

        public TriMeshPtr getMesh()
        return the mesh that is being sampled
        Returns:
        mesh