Class DeformableObject


  • public class DeformableObject
    extends Object
    The deformable object is an object that contain a deformable mesh. Deformations
    are part of the state object and they are modeled/controlled through control nodes.
    each control node correspond to a vertice in the mesh. All vertices are described relative to the base
    frame of the object.
    • Constructor Detail

      • DeformableObject

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

        public DeformableObject​(Frame baseframe,
                                int nr_of_nodes)
        constructor - constructs a deformable mesh with a specific number of control nodes
        and without any faces. Both geometry and model are created based on nodes.
        Parameters:
        baseframe - [in] base frame of object
        nr_of_nodes - [in] the number of controlling nodes in the deformable object
      • DeformableObject

        public DeformableObject​(Frame baseframe,
                                Model3DPtr model)
        constructor - control nodes are taken as vertices in the Model3D. Vertices that
        are equal are merged into the same control node. All faces of the model are used to
        define faces of the deformable object.

        geometry will be created based on model information

        Note: only triangle faces are currently supported.

        Parameters:
        baseframe - [in] base frame of object
        model - [in]
      • DeformableObject

        public DeformableObject​(Frame baseframe,
                                GeometryPtr geom)
        constructor - control nodes are taken from a triangle mesh generated from triangulating the
        geometry. Vertices that
        are equal are merged into the same control node. All faces of the geometry are used to
        define faces of the deformable object.

        model will be created based on geometry information

        Parameters:
        baseframe - [in] base frame of object
        geom - [in] geometry to define the faces and nodes
    • Method Detail

      • delete

        public void delete()
        Overrides:
        delete in class Object
      • getNode

        public Vector3Df getNode​(int id,
                                 State state)
        get a specific node from the state
        Parameters:
        id - [in] id of the node to fetch
        state - [in] current state
        Returns:
        handle to manipulate a node in the given state.
      • setNode

        public void setNode​(int id,
                            Vector3Df v,
                            State state)
        set the value of a specific node in the state.
        Parameters:
        id - [in] id of the node
        v - [in] value to set.
        state - [in] state in which to set the value.
      • getNrNodes

        public long getNrNodes​(State state)
        get the number of controlling nodes of this deformable object.
        Parameters:
        state - [in]
        Returns:
      • getNrNodes

        public long getNrNodes()
        get the number of controlling nodes of this deformable object.
        Returns:
        Number of Nodes
      • getFaces

        public IndexedTriangleU16Vector getFaces()
        get all faces of this soft body
        Returns:
        list of indexed triangles - indeces point to vertices/nodes
      • addFace

        public void addFace​(long node1,
                            long node2,
                            long node3)
        add a face to three existing nodes
        Parameters:
        node1 - [in] idx of node 1
        node2 - [in] idx of node 2
        node3 - [in] idx of node 3
      • getMass

        public double getMass​(State state)
        get mass in Kg of this object
        Overrides:
        getMass in class Object
        Parameters:
        state - [in] the state
        Returns:
        mass in kilo grams
      • getCOM

        public Vector3Dd getCOM​(State state)
        get center of mass of this object
        Overrides:
        getCOM in class Object
        Parameters:
        state - [in] the state in which to get center of mass
        Returns:
        Position of COM
      • getInertia

        public InertiaMatrixd getInertia​(State state)
        returns the inertia matrix of this body calculated around COM with the orientation
        of the base frame.
        Overrides:
        getInertia in class Object
        Parameters:
        state - [in] the state to get the inertia in
        Returns:
        matrix with inertia
      • update

        public void update​(Model3DPtr model,
                           State state)
        updates the model with the current state of the deformable model
        Parameters:
        model - [in/out] model to be updated
        state -