artisynth.core.mechmodels
Class DeformableContactConstraintBase

java.lang.Object
  extended by artisynth.core.mechmodels.DeformableContactConstraintBase
All Implemented Interfaces:
DeformableContactConstraint
Direct Known Subclasses:
DeformableContactConstraintGeneric

public abstract class DeformableContactConstraintBase
extends java.lang.Object
implements DeformableContactConstraint


Nested Class Summary
 class DeformableContactConstraintBase.CompInfo
          Provides matrix block information and computational function for a single dynamic component associated with a contact constraint.
 class DeformableContactConstraintBase.FrameInfo
           
 class DeformableContactConstraintBase.PointInfo
           
 
Field Summary
static int BODY_FACE
           
static int EDGE_BODY
           
static int EDGE_EDGE
           
static int VERTEX_BODY
           
static int VERTEX_FACE
           
 
Constructor Summary
DeformableContactConstraintBase()
           
 
Method Summary
 void addConstraintBlocks(SparseBlockMatrix GT, int bj)
          Adds matrix blocks for this constraint to a specified block column of the transposed constraint matrix.
 void addFrame(Frame frame, double weight, Point3d loc)
          Adds a frame as a component for this constraint.
 int addFrictionConstraints(SparseBlockMatrix DT, MechSystem.FrictionInfo[] finfo, int numf)
           
 void addPoint(Point pnt, double weight)
          Adds a point as a component for this constraint.
 void beginSet()
          Begin the process of setting this constraint.
 boolean componentsChanged()
          Returns true if the component structure of this constraint has changed.
 void endSet()
          Concludes the process of setting this constraint.
abstract  boolean equals(java.lang.Object obj)
           
 void getAuxState(DataBuffer data, CollisionData myData, CollisionData otherData)
           
 double getDerivative()
           
 double getDistance()
          The interpenetration distance when the contact was first created.
 double getFriction()
          Returns the friction coefficent for this constraint.
 double getImpulse()
          Returns the impulse associated with this constraint.
 Vector3d getNormal()
          Returns the normal for this constraint.
 int getSolveIndex()
           
abstract  int hashCode()
           
 boolean isActive()
          Returns true if this constraint is marked as being active.
 boolean isAdded()
          Returns true if the constraint is marked as being already added to the system
 boolean isControllable()
          Returns true if at least one of the components associated with this constraint is controllable.
 int numFrames()
          Returns the number of frames involved in the constraint
 int numPoints()
          Returns the number of points involved in the constraint
 void printConstraintInfo(java.io.PrintStream ps)
           
 void setActive(boolean active)
          Marks this constraint as being inactive.
 void setAdded(boolean added)
          Marks this constraint as being added to the system
 void setAuxState(DataBuffer data, CollisionData myData, CollisionData otherData)
           
 void setBodyFace(Vector3d nrml, double mu, Vertex3d v0, Vertex3d v1, Vertex3d v2, Point3d loc1, double w0, double w1, double w2, DeformableCollisionData thisData, Vertex3d rbvtx, RigidBody body, Point3d loc2, double wrb)
          Sets the constraint for rigidBody-deformable node-face contact
 void setDistance(double d)
           
 void setEdgeBody(Vector3d nrml, double mu, Vertex3d v0, Vertex3d v1, Point3d loc1, double w0, double w1, DeformableCollisionData thisData, RigidBody body, Point3d loc2, Vertex3d vb0, Vertex3d vb1, double wb0, double wb1)
          Set the constraint for a deformable-rigidBody edge-edge contact.
 void setEdgeEdge(Vector3d nrml, double mu, Vertex3d v0, Vertex3d v1, Point3d loc1, double w0, double w1, DeformableCollisionData thisData, Vertex3d v2, Vertex3d v3, Point3d loc2, double w2, double w3, DeformableCollisionData otherData)
          Set the constraint for a deformable-deformable edge-edge contact.
 void setFriction(double mu)
          Sets the friction coefficient for this constraint.
 void setImpulse(double lam)
          Sets the impulse associated with this constraint.
 void setSolveIndex(int idx)
           
 void setVertexBody(Vector3d nrml, double mu, Vertex3d v0, Point3d loc1, double w0, DeformableCollisionData thisData, RigidBody body, Point3d loc2, Vertex3d vb0, Vertex3d vb1, Vertex3d vb2, double wb0, double wb1, double wb2)
          Set the constraint for a deformable-rigidBody node-face contact.
 void setVertexFace(Vector3d nrml, double mu, Vertex3d v0, Point3d loc1, double w0, DeformableCollisionData thisData, Vertex3d v1, Vertex3d v2, Vertex3d v3, Point3d loc2, double w1, double w2, double w3, DeformableCollisionData otherData)
          Set the constraint for a deformable-deformable node-face contact.
 void skipAuxState(DataBuffer data)
           
 void updateFriction()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface artisynth.core.mechmodels.DeformableContactConstraint
print, setEdgeEdge, setEdgeRigidBody, setFaceRigidBody, setVertexDeformable, setVertexRigidBody, setVertices
 

Field Detail

VERTEX_FACE

public static final int VERTEX_FACE
See Also:
Constant Field Values

VERTEX_BODY

public static final int VERTEX_BODY
See Also:
Constant Field Values

EDGE_EDGE

public static final int EDGE_EDGE
See Also:
Constant Field Values

EDGE_BODY

public static final int EDGE_BODY
See Also:
Constant Field Values

BODY_FACE

public static final int BODY_FACE
See Also:
Constant Field Values
Constructor Detail

DeformableContactConstraintBase

public DeformableContactConstraintBase()
Method Detail

getSolveIndex

public int getSolveIndex()
Specified by:
getSolveIndex in interface DeformableContactConstraint

setSolveIndex

public void setSolveIndex(int idx)
Specified by:
setSolveIndex in interface DeformableContactConstraint

getDistance

public double getDistance()
The interpenetration distance when the contact was first created.

Specified by:
getDistance in interface DeformableContactConstraint

setDistance

public void setDistance(double d)
Specified by:
setDistance in interface DeformableContactConstraint

getDerivative

public double getDerivative()
Specified by:
getDerivative in interface DeformableContactConstraint

addConstraintBlocks

public void addConstraintBlocks(SparseBlockMatrix GT,
                                int bj)
Adds matrix blocks for this constraint to a specified block column of the transposed constraint matrix.

Specified by:
addConstraintBlocks in interface DeformableContactConstraint
Parameters:
GT - transposed constraint matrix
bj - block column where blocks should be added

printConstraintInfo

public void printConstraintInfo(java.io.PrintStream ps)

addFrictionConstraints

public int addFrictionConstraints(SparseBlockMatrix DT,
                                  MechSystem.FrictionInfo[] finfo,
                                  int numf)
Specified by:
addFrictionConstraints in interface DeformableContactConstraint

setFriction

public void setFriction(double mu)
Sets the friction coefficient for this constraint.

Specified by:
setFriction in interface DeformableContactConstraint

getFriction

public double getFriction()
Returns the friction coefficent for this constraint.

Specified by:
getFriction in interface DeformableContactConstraint

getNormal

public Vector3d getNormal()
Returns the normal for this constraint.

Specified by:
getNormal in interface DeformableContactConstraint

hashCode

public abstract int hashCode()
Specified by:
hashCode in interface DeformableContactConstraint
Overrides:
hashCode in class java.lang.Object

equals

public abstract boolean equals(java.lang.Object obj)
Specified by:
equals in interface DeformableContactConstraint
Overrides:
equals in class java.lang.Object

getImpulse

public double getImpulse()
Returns the impulse associated with this constraint.

Specified by:
getImpulse in interface DeformableContactConstraint

setImpulse

public void setImpulse(double lam)
Sets the impulse associated with this constraint. In particular, this will be done after velocity solves. The resulting impulse is then used to compute friction and determine if the constraint should be broken.

Specified by:
setImpulse in interface DeformableContactConstraint

isActive

public boolean isActive()
Returns true if this constraint is marked as being active.

Specified by:
isActive in interface DeformableContactConstraint

setActive

public void setActive(boolean active)
Marks this constraint as being inactive.

Specified by:
setActive in interface DeformableContactConstraint

isAdded

public boolean isAdded()
Returns true if the constraint is marked as being already added to the system

Specified by:
isAdded in interface DeformableContactConstraint

setAdded

public void setAdded(boolean added)
Marks this constraint as being added to the system

Specified by:
setAdded in interface DeformableContactConstraint

beginSet

public void beginSet()
Begin the process of setting this constraint. After this method call, components can be added using the addPoint() and addFrame() methods. When all components have been added, endSet() should be called.

Specified by:
beginSet in interface DeformableContactConstraint

endSet

public void endSet()
Concludes the process of setting this constraint.

Specified by:
endSet in interface DeformableContactConstraint

componentsChanged

public boolean componentsChanged()
Returns true if the component structure of this constraint has changed. This will be true if, since the last call to clearComponents(), new component infos have been added, or if any infos are left on the free list.

Specified by:
componentsChanged in interface DeformableContactConstraint

isControllable

public boolean isControllable()
Returns true if at least one of the components associated with this constraint is controllable.

Specified by:
isControllable in interface DeformableContactConstraint

updateFriction

public void updateFriction()
Specified by:
updateFriction in interface DeformableContactConstraint

addPoint

public void addPoint(Point pnt,
                     double weight)
Adds a point as a component for this constraint.

Specified by:
addPoint in interface DeformableContactConstraint
Parameters:
pnt - point to add
weight - weighting factor for the point. Note: if the weight is positive, it is assumed to belong to the 'first' component in the collision. If negative, it is assumed to belong to the second.

addFrame

public void addFrame(Frame frame,
                     double weight,
                     Point3d loc)
Adds a frame as a component for this constraint.

Specified by:
addFrame in interface DeformableContactConstraint
Parameters:
frame - Frame to add
loc - location of the point in frame coordinates

numPoints

public int numPoints()
Description copied from interface: DeformableContactConstraint
Returns the number of points involved in the constraint

Specified by:
numPoints in interface DeformableContactConstraint
Returns:
number of points involved

numFrames

public int numFrames()
Description copied from interface: DeformableContactConstraint
Returns the number of frames involved in the constraint

Specified by:
numFrames in interface DeformableContactConstraint
Returns:
number of frames involved

setEdgeEdge

public void setEdgeEdge(Vector3d nrml,
                        double mu,
                        Vertex3d v0,
                        Vertex3d v1,
                        Point3d loc1,
                        double w0,
                        double w1,
                        DeformableCollisionData thisData,
                        Vertex3d v2,
                        Vertex3d v3,
                        Point3d loc2,
                        double w2,
                        double w3,
                        DeformableCollisionData otherData)
Set the constraint for a deformable-deformable edge-edge contact. This constraint can be used to prevent interpenetration of two edges edge1 and edge0 as follows: n0, n1 are the nodes on the ends of edge0. n2, n3 are the nodes on the ends of edge1. w0, w1 are the weights of the nodes n0, n1: 0 <= w0 <= 1, w1 = 1 - w0 They define a position p0 on edge0: p0 = w0*n0.getPosition() + w1*n1.getPosition() Similarly, w2, w3 are the weights of the nodes n2, n3: 0 <= w2 <= 1, w3 = 1 - w2 They define a position p1 on edge1: p1 = w2 * n2.getPosition() + w3 * n3.getPosition() nrml is the direction in which p0 should move to remove the interpenetration. The constraint will ensure that q > 0 where q = (p0 - p1).dot(nrml). and will remain active as long as q < 0. The constraint also generates frictional forces opposite to the direction of any relative motion perpendicular to nrml.


setVertexFace

public void setVertexFace(Vector3d nrml,
                          double mu,
                          Vertex3d v0,
                          Point3d loc1,
                          double w0,
                          DeformableCollisionData thisData,
                          Vertex3d v1,
                          Vertex3d v2,
                          Vertex3d v3,
                          Point3d loc2,
                          double w1,
                          double w2,
                          double w3,
                          DeformableCollisionData otherData)
Set the constraint for a deformable-deformable node-face contact.


setBodyFace

public void setBodyFace(Vector3d nrml,
                        double mu,
                        Vertex3d v0,
                        Vertex3d v1,
                        Vertex3d v2,
                        Point3d loc1,
                        double w0,
                        double w1,
                        double w2,
                        DeformableCollisionData thisData,
                        Vertex3d rbvtx,
                        RigidBody body,
                        Point3d loc2,
                        double wrb)
Sets the constraint for rigidBody-deformable node-face contact


setVertexBody

public void setVertexBody(Vector3d nrml,
                          double mu,
                          Vertex3d v0,
                          Point3d loc1,
                          double w0,
                          DeformableCollisionData thisData,
                          RigidBody body,
                          Point3d loc2,
                          Vertex3d vb0,
                          Vertex3d vb1,
                          Vertex3d vb2,
                          double wb0,
                          double wb1,
                          double wb2)
Set the constraint for a deformable-rigidBody node-face contact.


setEdgeBody

public void setEdgeBody(Vector3d nrml,
                        double mu,
                        Vertex3d v0,
                        Vertex3d v1,
                        Point3d loc1,
                        double w0,
                        double w1,
                        DeformableCollisionData thisData,
                        RigidBody body,
                        Point3d loc2,
                        Vertex3d vb0,
                        Vertex3d vb1,
                        double wb0,
                        double wb1)
Set the constraint for a deformable-rigidBody edge-edge contact.


skipAuxState

public void skipAuxState(DataBuffer data)
Specified by:
skipAuxState in interface DeformableContactConstraint

getAuxState

public void getAuxState(DataBuffer data,
                        CollisionData myData,
                        CollisionData otherData)
Specified by:
getAuxState in interface DeformableContactConstraint

setAuxState

public void setAuxState(DataBuffer data,
                        CollisionData myData,
                        CollisionData otherData)
Specified by:
setAuxState in interface DeformableContactConstraint