public abstract class DeformableBody extends RigidBody implements PropertyChangeListener
RigidBody.DistanceSurfaceRendering, RigidBody.InertiaMethod
Collidable.Collidability, Collidable.Group
Modifier and Type | Field and Description |
---|---|
static PropertyList |
myProps |
dynamicVelInWorldCoords, myRenderFrame
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
All, AllBodies, Deformable, Rigid, Self
COPY_REFERENCES
TG_ARTICULATED, TG_DRAGGER, TG_PRESERVE_ORIENTATION, TG_SIMULATING
TRANSPARENT, TWO_DIMENSIONAL
Modifier and Type | Method and Description |
---|---|
void |
addEffectivePointMass(double m,
Vector3d loc)
Adds a point mass to the effective spatial inertia for this Frame.
|
void |
addElasticForce(VectorNd f) |
void |
addExternalElasticForce(VectorNd f) |
void |
addPointForce(Point3d loc,
Vector3d f)
Adds to this body's forces the wrench arising from applying a force
f on a point loc . |
void |
addPointForce(Wrench wr,
VectorNd fe,
Point3d loc,
Vector3d f)
Adds to
wr and fe the wrench and elastic forces
arising from applying a force f on a point loc . |
void |
addPointMass(Matrix M,
double m,
Vector3d pos)
Adds a point mass to a matrix that contains the spatial
inertia for this Frame.
|
void |
addPosImpulse(double[] xbuf,
int xidx,
double h,
double[] vbuf,
int vidx) |
void |
addPosJacobian(SparseNumberedBlockMatrix S,
double s)
Scales the components of the position Jacobian associated with this force
effector and adds it to the supplied solve matrix M.
|
void |
addScaledExternalElasticForce(double s,
VectorNd f) |
void |
addSolveBlock(SparseNumberedBlockMatrix S) |
void |
addToPointVelocity(Vector3d vel,
double w,
ContactPoint cpnt)
Computes the velocity imparted to a contact point by this component's
current velocity, multiples it by a weighting factor
w ,
and add it to vel . |
void |
addVelJacobian(SparseNumberedBlockMatrix S,
double s)
Scales the components of the velocity Jacobian associated with this force
effector and adds it to the supplied solve matrix M.
|
void |
applyExternalForces() |
void |
applyForces(double t)
Adds forces to the components affected by this force effector at a
particular time.
|
void |
computeDeformationGradient(Matrix3d F,
Vector3d x0) |
void |
computeDeformedFrame(RigidTransform3d A,
PolarDecomposition3d polarDecomp,
RigidTransform3d A0) |
void |
computeDeformedFrame(RigidTransform3d A,
RigidTransform3d A0) |
void |
computeDeformedFrameVel(Twist vel,
PolarDecomposition3d polarDecomp,
RigidTransform3d A0)
Computes the spatial velocity of an attached frame A, as represented
in the coordinates of A.
|
void |
computeDeformedPos(Vector3d pos,
Vector3d pos0)
Computes the deformed position in body coordinates
|
void |
computeDeformedVel(Vector3d vel,
Vector3d pos0)
Computes the deformed velocity in body coordinates
|
void |
computeElasticJacobian(MatrixNd Pi,
PolarDecomposition3d polarDecomp,
RigidTransform3d A0,
boolean worldCoords)
Compute the transform that maps elastic velocities onto the spatial
velocity of an attached frame A.
|
void |
computeLocalPointForceJacobian(MatrixBlock GT,
Vector3d loc,
RotationMatrix3d R)
Computes a force Jacobian for a point attached to this frame, and then
optionally rotates its columns using a rotation matrix R.
|
void |
computePointCoriolis(Vector3d cor,
Vector3d loc)
Computes the velocity derivative of a point attached to this frame
that is due to the current velocity of the frame.
|
void |
computePointLocation(Vector3d loc,
Vector3d pos)
Computes the location, in body coordinates, of a point whose position
is given in world coordinates.
|
void |
computePointPosition(Vector3d pos,
Point3d loc)
Computes the position, in world coordinates, of a point attached to this
frame.
|
void |
computePointVelocity(Vector3d vel,
Point3d loc,
Twist frameVel)
Computes the velocity, in world coordinates, of a point attached to this
frame.
|
void |
computeUndeformedFrame(RigidTransform3d A0,
PolarDecomposition3d polarDecomp,
RigidTransform3d A) |
double |
computeUndeformedPos(Vector3d pos0,
Vector3d pos,
double tol)
Computes the undeformed position of a given position in body coordinates
|
void |
computeWorldPointForceJacobian(MatrixBlock GT,
Point3d loc)
Computes the force Jacobian, in world coordinates, for a point attached
to this frame.
|
static FemMaterial |
createDefaultMaterial() |
MatrixBlock |
createMassBlock()
Create a matrix block for representing the mass of this component,
initialized to the component's effective mass (instrinsic mass
plus the mass due to all attachmented components).
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
DistanceGrid |
getDistanceGrid()
Returns a signed distance grid that can be used with a
SignedDistanceCollider, or
null if a grid is not available
(i.e., if RigidBody.hasDistanceGrid() returns false ). |
abstract void |
getDShape(Matrix3d Dshp,
int i,
Vector3d pos0) |
void |
getEffectiveMass(Matrix M,
double t)
Gets the effective mass of this component at a particular time.
|
int |
getEffectiveMassForces(VectorNd f,
double t,
int idx)
Gets the mass forces for this component at a particular time.
|
VectorNd |
getElasticForce() |
VectorNd |
getElasticPos() |
double |
getElasticPos(int idx) |
void |
getElasticPos(VectorNd pos) |
VectorNd |
getElasticVel() |
double |
getElasticVel(int idx) |
void |
getElasticVel(VectorNd vel) |
VectorNd |
getExternalElasticForce() |
int |
getForce(double[] f,
int idx) |
void |
getInverseMass(Matrix Minv,
Matrix M)
Inverts a mass for this component.
|
void |
getMass(Matrix M,
double t)
Gets the mass of this component at a particular time.
|
double |
getMassDamping() |
FemMaterial |
getMaterial() |
int |
getPosDerivative(double[] dxdt,
int idx) |
int |
getPosState(double[] buf,
int idx) |
int |
getPosStateSize() |
abstract void |
getShape(Vector3d shp,
int i,
Vector3d pos0) |
double |
getStiffnessDamping() |
int |
getVelState(double[] buf,
int idx) |
int |
getVelStateSize() |
boolean |
hasDistanceGrid()
Returns
true if this RigidBody supports a signed
distance grid that can be used with a SignedDistanceCollider. |
void |
invalidateStiffness() |
boolean |
isDeformable()
Returns
true if this collidable is deformable. |
int |
mulInverseEffectiveMass(Matrix M,
double[] a,
double[] f,
int idx) |
abstract int |
numElasticCoords() |
void |
propertyChanged(PropertyChangeEvent e) |
void |
setContactConstraint(double[] buf,
double w,
Vector3d dir,
ContactPoint cpnt)
Computes the values for the block matrix which defines this component's
contribution to a contact constraint matrix.
|
void |
setElasticForce(VectorNd f) |
void |
setElasticPos(int idx,
double value) |
void |
setElasticPos(VectorNd pos) |
void |
setElasticVel(int idx,
double value) |
void |
setElasticVel(VectorNd vel) |
void |
setExternalElasticForce(VectorNd f) |
int |
setForce(double[] f,
int idx) |
void |
setMassDamping(double d) |
void |
setMaterial(FemMaterial mat) |
int |
setPosState(double[] buf,
int idx) |
void |
setStiffnessDamping(double d) |
int |
setVelState(double[] buf,
int idx) |
abstract void |
updateStiffnessMatrix() |
void |
zeroExternalForces() |
void |
zeroForces() |
addConnector, addEffectiveInertia, allowCollision, applyGravity, centerPoseOnCenterOfMass, computeVolume, containsContactMaster, copy, createBox, createBox, createCylinder, createEllipsoid, createFromMesh, createFromMesh, createFromMesh, createFromMesh, createIcosahedralSphere, createRenderProps, createSphere, extrapolatePose, getCenterOfMass, getCenterOfMass, getCollidable, getCollidableAncestor, getCollidableIndex, getCollisionMesh, getConnectors, getCopyReferences, getDensity, getDensityRange, getDistanceGridMaxRes, getDistanceGridOBB, getDistanceGridRenderRanges, getDistanceGridRenderRangesRange, getDistanceGridRes, getDistanceSurfaceIso, getEffectiveInertia, getEffectiveMassForces, getFileTransform, getFrameMarkers, getInertia, getInertiaMethod, getMass, getMass, getMassRange, getMesh, getMeshFileName, getMeshFileTransform, getRenderDistanceGrid, getRenderDistanceSurface, getRotationalInertia, getRotationalInertia, getSurfaceMesh, getSurfaceMeshes, getVertexMasters, isCompound, isDuplicatable, isFileTransformRigid, isFreeBody, isMassConstant, isMeshModfied, mulInverseEffectiveMass, numSurfaceMeshes, prerender, removeConnector, render, resetEffectiveMass, scaleDistance, scaleMass, scaleMesh, scaleMesh, scan, setCenterOfMass, setCollidable, setCollidableIndex, setDensity, setDistanceGridMaxRes, setDistanceGridOBB, setDistanceGridRenderRanges, setDistanceGridRes, setDistanceSurfaceIso, setDynamic, setInertia, setInertia, setInertia, setInertia, setInertiaFromDensity, setInertiaFromMass, setInertiaMethod, setMass, setMesh, setMesh, setMesh, setMeshFileName, setPose, setRenderDistanceGrid, setRenderDistanceSurface, setRotationalInertia, setSurfaceMesh, setSurfaceMesh, transformGeometry, updateAttachmentPosStates, updateBounds, write
addExternalForce, addForce, addPointForce, addScaledExternalForce, addSolveBlocks, addTargetJacobian, addTransformableDependencies, computeAppliedWrench, computePointVelocity, computePointVelocity, createFrameAttachment, createPointAttachment, getAxisLength, getBodyForce, getBodyVelocity, getBodyVelState, getExternalForce, getForce, getForce, getFrameDamping, getFrameDampingMode, getJacobianType, getMoment, getOrientation, getOrientation, getPose, getPose, getPosition, getRotaryDamping, getRotaryDampingMode, getRotation, getSelection, getTargetActivity, getTargetOrientation, getTargetPos, getTargetPose, getTargetPosition, getTargetVel, getTargetVelocity, getTraceablePositionProperty, getTraceables, getTransForce, getVelocity, getVelocity, getWorldVelState, resetTargets, setAxisLength, setBodyVelocity, setExternalForce, setForce, setFrameDamping, setFrameDampingMode, setOrientation, setPose, setPosition, setRotaryDamping, setRotaryDampingMode, setRotation, setState, setTargetActivity, setTargetOrientation, setTargetPos, setTargetPose, setTargetPosition, setTargetVel, setTargetVelocity, setVelocity, setVelocity, subPointForce, subPointForce, transformPose, velocityLimitExceeded
addConstrainer, addMasterAttachment, getAttachment, getConstrainers, getMasterAttachments, getSolveIndex, hasState, isActive, isAttached, isControllable, isDynamic, isParametric, removeConstrainer, removeMasterAttachment, setAttached, setSolveIndex, transformGeometry
getRenderHints, getRenderProps, isSelectable, numSelectionQueriesNeeded, setRenderProps, updateRenderProps
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, isConnectedToHierarchy, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
transformPose
createFrameAttachment
createPointAttachment
addConstrainer, addMasterAttachment, checkFlag, clearFlag, getAttachment, getConstrainers, getMasterAttachments, getSolveIndex, isActive, isAttached, isControllable, isDynamic, isParametric, removeConstrainer, removeMasterAttachment, setAttached, setFlag, setSolveIndex
transformGeometry
public static PropertyList myProps
public void invalidateStiffness()
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class RigidBody
public abstract int numElasticCoords()
public boolean isDeformable()
Collidable
true
if this collidable is deformable. Whether or
not a collidable is deformable determines how it responds to default
collision behaviors involving deformable and rigid collidables. Also,
self-collisions among sub-collidables of a collidable A are permitted
only if A is deformable.isDeformable
in interface Collidable
isDeformable
in interface ConnectableBody
isDeformable
in class RigidBody
true
if this collidable is deformablepublic boolean hasDistanceGrid()
RigidBody
true
if this RigidBody supports a signed
distance grid that can be used with a SignedDistanceCollider.
A grid is available if either the property
distanceGridMaxRes
is positive, or
the property distanceGridRes
contains all positive values.hasDistanceGrid
in interface CollidableBody
hasDistanceGrid
in interface HasDistanceGrid
hasDistanceGrid
in class RigidBody
true
if a signed distance grid is available
for this RigidBodyRigidBody.getDistanceGridMaxRes()
,
RigidBody.getDistanceGridRes()
public DistanceGrid getDistanceGrid()
RigidBody
null
if a grid is not available
(i.e., if RigidBody.hasDistanceGrid()
returns false
).
The number of divisons in the grid is controlled explicitly by the
property distanceGridRes
, or, that is 0, by the property
distanceGridMaxRes
. If both properties are 0, no grid is
available and null
will be returned.getDistanceGrid
in interface CollidableBody
getDistanceGrid
in interface HasDistanceGrid
getDistanceGrid
in class RigidBody
null
if a grid is
not available this RigidBodyRigidBody.getDistanceGridMaxRes()
,
RigidBody.getDistanceGridRes()
public void setMassDamping(double d)
public double getMassDamping()
public void setStiffnessDamping(double d)
public double getStiffnessDamping()
public static FemMaterial createDefaultMaterial()
public FemMaterial getMaterial()
public void setMaterial(FemMaterial mat)
public void propertyChanged(PropertyChangeEvent e)
propertyChanged
in interface PropertyChangeListener
public VectorNd getElasticPos()
public VectorNd getElasticVel()
public void getElasticPos(VectorNd pos)
public void getElasticVel(VectorNd vel)
public VectorNd getElasticForce()
public void setElasticForce(VectorNd f)
public void addElasticForce(VectorNd f)
public VectorNd getExternalElasticForce()
public void setExternalElasticForce(VectorNd f)
public void addExternalElasticForce(VectorNd f)
public void addScaledExternalElasticForce(double s, VectorNd f)
public void setElasticPos(VectorNd pos)
public void setElasticVel(VectorNd vel)
public MatrixBlock createMassBlock()
DynamicComponent
createMassBlock
in interface DynamicComponent
createMassBlock
in class Frame
public void getMass(Matrix M, double t)
DynamicComponent
getMass
in interface DynamicComponent
getMass
in class RigidBody
M
- matrix to return the mass int
- current timepublic int getEffectiveMassForces(VectorNd f, double t, int idx)
DynamicComponent
f
, starting at the location
specified by idx
. Upon return, this method should
return the value of idx
incremented by the dimension
of the mass forces.getEffectiveMassForces
in interface DynamicComponent
getEffectiveMassForces
in class RigidBody
f
- vector to return the forces int
- current timeidx
- starting location within f
where forces should be storedidx
public void getEffectiveMass(Matrix M, double t)
DynamicComponent
getEffectiveMass
in interface DynamicComponent
getEffectiveMass
in class RigidBody
M
- matrix to return the mass int
- current timepublic int mulInverseEffectiveMass(Matrix M, double[] a, double[] f, int idx)
mulInverseEffectiveMass
in interface DynamicComponent
mulInverseEffectiveMass
in class RigidBody
public void addEffectivePointMass(double m, Vector3d loc)
addEffectivePointMass
in class RigidBody
m
- mass of the pointloc
- location of the point (in local frame coordinates)public void getInverseMass(Matrix Minv, Matrix M)
DynamicComponent
getInverseMass
in interface DynamicComponent
getInverseMass
in class RigidBody
Minv
- matrix to return the inverse mass inM
- matrix containing the mass to be invertedpublic void addSolveBlock(SparseNumberedBlockMatrix S)
addSolveBlock
in interface DynamicComponent
addSolveBlock
in class Frame
public void addPosImpulse(double[] xbuf, int xidx, double h, double[] vbuf, int vidx)
addPosImpulse
in interface DynamicComponent
addPosImpulse
in class Frame
public int getPosDerivative(double[] dxdt, int idx)
getPosDerivative
in interface DynamicComponent
getPosDerivative
in class Frame
public int getPosState(double[] buf, int idx)
getPosState
in interface DynamicComponent
getPosState
in class Frame
public int setPosState(double[] buf, int idx)
setPosState
in interface DynamicComponent
setPosState
in class Frame
public int getVelState(double[] buf, int idx)
getVelState
in interface DynamicComponent
getVelState
in class Frame
public int setVelState(double[] buf, int idx)
setVelState
in interface DynamicComponent
setVelState
in class Frame
public int setForce(double[] f, int idx)
setForce
in interface DynamicComponent
setForce
in class Frame
public int getForce(double[] f, int idx)
getForce
in interface DynamicComponent
getForce
in class Frame
public int getPosStateSize()
getPosStateSize
in interface DynamicComponent
getPosStateSize
in interface MotionTargetComponent
getPosStateSize
in class Frame
public int getVelStateSize()
getVelStateSize
in interface DynamicComponent
getVelStateSize
in interface MotionTargetComponent
getVelStateSize
in class Frame
public void zeroForces()
zeroForces
in interface DynamicComponent
zeroForces
in class Frame
public void zeroExternalForces()
zeroExternalForces
in interface DynamicComponent
zeroExternalForces
in class Frame
public void applyExternalForces()
applyExternalForces
in interface DynamicComponent
applyExternalForces
in class Frame
public abstract void updateStiffnessMatrix()
public void applyForces(double t)
ForceEffector
applyForces
in interface ForceEffector
applyForces
in class Frame
t
- time (seconds)public void addVelJacobian(SparseNumberedBlockMatrix S, double s)
ForceEffector
M is guaranteed to be the same matrix supplied in the most recent call to
addSolveBlocks
, and so implementations may choose
to cache the relevant matrix blocks from that call, instead of retrieving
them directly from M.
addVelJacobian
in interface ForceEffector
addVelJacobian
in class Frame
S
- solve matrix to which scaled velocity Jacobian is to be addeds
- scaling factor for velocity Jacobianpublic void addPosJacobian(SparseNumberedBlockMatrix S, double s)
ForceEffector
M is guaranteed to be the same matrix supplied in the most recent call to
addSolveBlocks
, and so implementations may choose
to cache the relevant matrix blocks from that call, instead of retrieving
them directly from M.
addPosJacobian
in interface ForceEffector
addPosJacobian
in class Frame
S
- solve matrix to which scaled position Jacobian is to be addeds
- scaling factor for position Jacobianpublic void addPointMass(Matrix M, double m, Vector3d pos)
Frame
addPointMass
in class Frame
M
- matrix containing existing spatial inertiam
- mass of the pointpos
- location of the point (in local frame coordinates)public void computePointPosition(Vector3d pos, Point3d loc)
Frame
computePointPosition
in class Frame
pos
- returns the point positionloc
- position of the point, in body coordinatespublic void computePointLocation(Vector3d loc, Vector3d pos)
Frame
Frame.computePointPosition(maspack.matrix.Vector3d, maspack.matrix.Point3d)
.computePointLocation
in class Frame
loc
- returns the point locationpos
- position of the point, in world coordinatespublic void computePointVelocity(Vector3d vel, Point3d loc, Twist frameVel)
Frame
computePointVelocity
in class Frame
vel
- returns the point velocityloc
- position of the point, in body coordinatesframeVel
- velocity of the frame, in rotated world coordinatespublic void computePointCoriolis(Vector3d cor, Vector3d loc)
Frame
computePointCoriolis
in class Frame
cor
- returns the point Coriolis term (in world coordinates)loc
- position of the point, in body coordinatespublic void addPointForce(Wrench wr, VectorNd fe, Point3d loc, Vector3d f)
wr
and fe
the wrench and elastic forces
arising from applying a force f
on a point loc
.wr
- accumulates the wrench (world coordinates)fe
- accumulates the elastic forcesloc
- location of the point (undeformed body coordinates)f
- force applied to the point (world coordinates)public void addPointForce(Point3d loc, Vector3d f)
f
on a point loc
.addPointForce
in class Frame
loc
- location of the point (body coordinates)f
- force applied to the point (world coordinates)public void computeWorldPointForceJacobian(MatrixBlock GT, Point3d loc)
Frame
[ I ] [ ] [ [ R loc ] ]where I is the 3x3 identity matrix, R is the frame orientation matrix, and [ x ] denotes the 3x3 skew-symmetric cross product matrix.
computeWorldPointForceJacobian
in class Frame
GT
- returns the force Jacobianloc
- position of the point, in body coordinatespublic void computeLocalPointForceJacobian(MatrixBlock GT, Vector3d loc, RotationMatrix3d R)
Frame
null
, then the Jacobian
takes the following form for the 6x3 matrix case:
[ I ] [ ] [ [ RF loc ] ]where RF is the frame orientation matrix, loc is the location of the point in frame coordinates, and [ x ] denotes the 3x3 skew-symmetric cross product matrix. If the rotation matrix R is not
null
, then the
6x3 case takes the following form:
[ R ] [ ] [ [ RF loc ] R ]
computeLocalPointForceJacobian
in class Frame
GT
- returns the force Jacobianloc
- location of the point, relative to the frameR
- optional rotation transformpublic void computeDeformedPos(Vector3d pos, Vector3d pos0)
public double computeUndeformedPos(Vector3d pos0, Vector3d pos, double tol)
public void computeDeformedVel(Vector3d vel, Vector3d pos0)
public void computeDeformedFrame(RigidTransform3d A, PolarDecomposition3d polarDecomp, RigidTransform3d A0)
public void computeUndeformedFrame(RigidTransform3d A0, PolarDecomposition3d polarDecomp, RigidTransform3d A)
public void computeDeformedFrame(RigidTransform3d A, RigidTransform3d A0)
public void computeDeformedFrameVel(Twist vel, PolarDecomposition3d polarDecomp, RigidTransform3d A0)
public void computeElasticJacobian(MatrixNd Pi, PolarDecomposition3d polarDecomp, RigidTransform3d A0, boolean worldCoords)
Pi
- stores the elastic JacobianpolarDecomp
- should be initialized to the polar decomposition
of the deformation gradient at the origin of AA0
- rest pose of A (relative to the body frame)worldCoords
- if true
, the spatial velocity is rotated
into world coordinates. Otherwise, it is returned in the coordinates of
A.public void setElasticPos(int idx, double value)
public double getElasticPos(int idx)
public void setElasticVel(int idx, double value)
public double getElasticVel(int idx)
public void setContactConstraint(double[] buf, double w, Vector3d dir, ContactPoint cpnt)
CollidableDynamicComponent
n
is the component's velocity state size, and the contact is
defined by a direction dir
and a point cpnt
.
The computed values should be scaled by a weighting factor
w
.setContactConstraint
in interface CollidableDynamicComponent
setContactConstraint
in class Frame
buf
- returns the n values for the block matrixw
- weighting factor by which the values should be scaleddir
- contact direction (world coordinates)cpnt
- contact pointpublic void addToPointVelocity(Vector3d vel, double w, ContactPoint cpnt)
CollidableDynamicComponent
w
,
and add it to vel
.addToPointVelocity
in interface CollidableDynamicComponent
addToPointVelocity
in class Frame
vel
- accumulates contact point velocity (world coordinates)w
- weighting factorcpnt
- contact point