Package org.robwork.sdurw_models
Class DeformableObjectPtr
- java.lang.Object
-
- org.robwork.sdurw_models.DeformableObjectPtr
-
public class DeformableObjectPtr extends java.lang.ObjectPtr stores a pointer and optionally takes ownership of the value.
-
-
Constructor Summary
Constructors Constructor Description DeformableObjectPtr()Default constructor yielding a NULL-pointer.DeformableObjectPtr(long cPtr, boolean cMemoryOwn)DeformableObjectPtr(DeformableObject ptr)Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DeformableObject__ref__()Dereferencing operator.voidaddFace(long node1, long node2, long node3)add a face to three existing nodesvoidaddFrame(FramePtr frame)associate a frame to this Object.DeformableObjectCPtrcptr()voiddelete()DeformableObjectderef()The pointer stored in the object.booleanequals(DeformableObject p)FramegetBase()get base frame of this objectVector3DgetCOM(State state)get center of mass of this objectstatic longgetCPtr(DeformableObjectPtr obj)DeformableObjectgetDeref()Member access operator.VectorIndexedTrianglegetFaces()get all faces of this soft bodyFrameVectorgetFrames()get all associated frames of this objectVectorGeometryPtrgetGeometry()get default geometriesVectorGeometryPtrgetGeometry(State state)get geometry of this objectInertiaMatrixdgetInertia(State state)returns the inertia matrix of this body calculated around COM with the orientation
of the base frame.doublegetMass(State state)get mass in Kg of this objectIndexedTriMesh_fPtrgetMesh(State cstate)return a triangle mesh representing the softbody in the current state
cstateModel3DPtrVectorgetModels()get the default modelsModel3DPtrVectorgetModels(State state)get visualization models of this objectjava.lang.StringgetName()get name of this object.Vector3DfgetNode(int id, State state)get a specific node from the statelonggetNrNodes()get the number of controlling nodes of this deformable object.longgetNrNodes(State state)get the number of controlling nodes of this deformable object.StateStructurePtrgetStateStructure()Get the state structure.booleanisNull()checks if the pointer is nullbooleanisRegistered()Check if object has registered its state.booleanisShared()check if this Ptr has shared ownership or none
ownershipvoidregisterIn(State state)initialize this stateless data to a specific statevoidregisterIn(StateStructurePtr state)register this stateless object in a statestructure.voidsetNode(int id, Vector3Df v, State state)set the value of a specific node in the state.voidunregister()unregisters all state data of this stateless objectvoidupdate(Model3DPtr model, State state)updates the model with the current state of the deformable model
-
-
-
Constructor Detail
-
DeformableObjectPtr
public DeformableObjectPtr(long cPtr, boolean cMemoryOwn)
-
DeformableObjectPtr
public DeformableObjectPtr()
Default constructor yielding a NULL-pointer.
-
DeformableObjectPtr
public DeformableObjectPtr(DeformableObject ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
-
Method Detail
-
getCPtr
public static long getCPtr(DeformableObjectPtr obj)
-
delete
public void delete()
-
deref
public DeformableObject deref()
The pointer stored in the object.
-
__ref__
public DeformableObject __ref__()
Dereferencing operator.
-
getDeref
public DeformableObject getDeref()
Member access operator.
-
equals
public boolean equals(DeformableObject p)
-
isShared
public boolean isShared()
check if this Ptr has shared ownership or none
ownership- Returns:
- true if Ptr has shared ownership, false if it has no ownership.
-
isNull
public boolean isNull()
checks if the pointer is null- Returns:
- Returns true if the pointer is null
-
cptr
public DeformableObjectCPtr cptr()
-
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- Parameters:
state- [in] the state- Returns:
- mass in kilo grams
-
getCOM
public Vector3D getCOM(State state)
get center of mass of this 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.- 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-
-
getName
public java.lang.String getName()
get name of this object. Name is always the same as the name of the
base frame.- Returns:
- name of object.
-
getBase
public Frame getBase()
get base frame of this object- Returns:
- base frame of object
-
getFrames
public FrameVector getFrames()
get all associated frames of this object- Returns:
- a vector of frames
-
addFrame
public void addFrame(FramePtr frame)
associate a frame to this Object.- Parameters:
frame- [in] frame to associate to object
-
getGeometry
public VectorGeometryPtr getGeometry()
get default geometries- Returns:
- geometry for collision detection
-
getGeometry
public VectorGeometryPtr getGeometry(State state)
get geometry of this object- Returns:
- geometry for collision detection.
-
getModels
public Model3DPtrVector getModels()
get the default models- Returns:
- models for vizualization
-
getModels
public Model3DPtrVector getModels(State state)
get visualization models of this object- Returns:
- models for visualization
-
registerIn
public void registerIn(State state)
initialize this stateless data to a specific state- Parameters:
state- [in] the state in which to register the data.
Note: the data will be registered in the state structure of the state
and any copies or other instances of the state will therefore also
contain the added states.
-
registerIn
public void registerIn(StateStructurePtr state)
register this stateless object in a statestructure.
-
unregister
public void unregister()
unregisters all state data of this stateless object
-
getStateStructure
public StateStructurePtr getStateStructure()
Get the state structure.- Returns:
- the state structure.
-
isRegistered
public boolean isRegistered()
Check if object has registered its state.- Returns:
- true if registered, false otherwise.
-
-