Package org.robwork.sdurw_models
Class DeformableObject
- java.lang.Object
-
- org.robwork.sdurw_kinematics.Stateless
-
- org.robwork.sdurw_models.Object
-
- org.robwork.sdurw_models.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 Summary
Constructors Constructor Description DeformableObject(long cPtr, boolean cMemoryOwn)
DeformableObject(FramePtr baseframe, int nr_of_nodes)
constructor - constructs a deformable mesh with a specific number of control nodes
and without any faces.DeformableObject(FramePtr baseframe, GeometryPtr geom)
constructor - control nodes are taken from a triangle mesh generated from
triangulating the geometry.DeformableObject(FramePtr baseframe, Model3DPtr model)
constructor - control nodes are taken as vertices in the Model3D.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFace(long node1, long node2, long node3)
add a face to three existing nodesvoid
delete()
Vector3D
getCOM(State state)
get center of mass of this objectstatic long
getCPtr(DeformableObject obj)
VectorIndexedTriangle
getFaces()
get all faces of this soft bodyInertiaMatrixd
getInertia(State state)
returns the inertia matrix of this body calculated around COM with the orientation
of the base frame.double
getMass(State state)
get mass in Kg of this objectIndexedTriMesh_fPtr
getMesh(State cstate)
return a triangle mesh representing the softbody in the current state
cstateVector3Df
getNode(int id, State state)
get a specific node from the statelong
getNrNodes()
get the number of controlling nodes of this deformable object.long
getNrNodes(State state)
get the number of controlling nodes of this deformable object.void
setNode(int id, Vector3Df v, State state)
set the value of a specific node in the state.void
update(Model3DPtr model, State state)
updates the model with the current state of the deformable model-
Methods inherited from class org.robwork.sdurw_models.Object
addFrame, getBase, getCPtr, getFrames, getGeometry, getGeometry, getModels, getModels, getName
-
Methods inherited from class org.robwork.sdurw_kinematics.Stateless
getCPtr, getStateStructure, isRegistered, registerIn, registerIn, unregister
-
-
-
-
Constructor Detail
-
DeformableObject
public DeformableObject(long cPtr, boolean cMemoryOwn)
-
DeformableObject
public DeformableObject(FramePtr 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 objectnr_of_nodes
- [in] the number of controlling nodes in the deformable object
-
DeformableObject
public DeformableObject(FramePtr 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 objectmodel
- [in]
-
DeformableObject
public DeformableObject(FramePtr 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 objectgeom
- [in] geometry to define the faces and nodes
-
-
Method Detail
-
getCPtr
public static long getCPtr(DeformableObject obj)
-
getNode
public Vector3Df getNode(int id, State state)
get a specific node from the state- Parameters:
id
- [in] id of the node to fetchstate
- [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 nodev
- [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:
- Number of Nodes
-
getNrNodes
public long getNrNodes()
get the number of controlling nodes of this deformable object.- Returns:
- Number of Nodes
-
getFaces
public VectorIndexedTriangle 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 1node2
- [in] idx of node 2node3
- [in] idx of node 3
-
getMesh
public IndexedTriMesh_fPtr getMesh(State cstate)
return a triangle mesh representing the softbody in the current state
cstate- Parameters:
cstate
-
-
getMass
public double getMass(State state)
get mass in Kg of this object
-
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 classObject
- 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 updatedstate
-
-
-