public interface Constrainer
The bilateral constraints are associated with a velocity constraint
matrix Gc, which is a sparse block matrix for which
Gc vel = 0where
vel is the composite velocity vector for all dynamic
components. The transpose of Gc is known as the bilateral
force constraint matrix.
Likewise, the unilateral constraints are associated with a
velocity constraint matrix Nc, for which
Nc vel >= 0,and the transpose of
Nc is the unilateral force constraint
matrix.| Modifier and Type | Method and Description |
|---|---|
int |
addBilateralConstraints(SparseBlockMatrix GT,
VectorNd dg,
int numb)
Appends the current bilateral force constraint matrix
Gc^T to the
matrix GT, by appending block columns to it. |
int |
addFrictionConstraints(SparseBlockMatrix DT,
java.util.ArrayList<FrictionInfo> finfo,
boolean prune,
int idx)
Appends the friction force constraint matrix
Dc^T to the matrix
DT, by appending block columns to it. |
int |
addUnilateralConstraints(SparseBlockMatrix NT,
VectorNd dn,
int numu)
Appends the current unilateral force constraint matrix
Nc^T to the
matrix NT, by appending block columns to it. |
int |
getBilateralForces(VectorNd lam,
int idx)
Returns the bilateral forces that were most recently set for this
constrainer using
setBilateralForces(maspack.matrix.VectorNd, double, int). |
int |
getBilateralInfo(MechSystem.ConstraintInfo[] ginfo,
int idx)
Returns constraint information for each row of the bilateral
constraint system
|
void |
getBilateralSizes(VectorNi sizes)
Returns the sizes of each block column in the bilateral force constraint
matrix.
|
void |
getConstrainedComponents(java.util.HashSet<DynamicComponent> comps)
Collected all the dynamic components constrained by this constrainer.
|
int |
getFrictionForces(VectorNd phi,
int idx)
Returns the friction forces that were most recently set for this
constrainer using
setFrictionForces(maspack.matrix.VectorNd, double, int). |
int |
getFrictionState(VectorNi state,
int idx) |
int |
getUnilateralForces(VectorNd the,
int idx)
Returns the unilateral forces that were most recently set for this
constrainer using
setUnilateralForces(maspack.matrix.VectorNd, double, int). |
int |
getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo,
int idx)
Returns constraint information for each row of the unilateral
constraint system
|
void |
getUnilateralSizes(VectorNi sizes)
Returns the sizes of each block column in the unilateral force constraint
matrix.
|
int |
getUnilateralState(VectorNi state,
int idx) |
int |
maxFrictionConstraintSets()
Returns the maximum number of friction constraint sets that can be
expected for this constraint.
|
int |
setBilateralForces(VectorNd lam,
double s,
int idx)
Sets the bilateral forces that were computed to enforce this
constraint.
|
int |
setFrictionForces(VectorNd phi,
double s,
int idx)
Sets the friction forces that were computed to enforce this
constraint.
|
int |
setFrictionState(VectorNi state,
int idx) |
int |
setUnilateralForces(VectorNd the,
double s,
int idx)
Sets the unilateral forces that were computed to enforce this
constraint.
|
int |
setUnilateralState(VectorNi state,
int idx) |
double |
updateConstraints(double t,
int flags)
Updates the current set of constraints, and returns the maximum
penetration
> 0 associated with all of them. |
void |
zeroForces()
Zeros all bilateral and unilateral constraint forces in this constraint.
|
void getBilateralSizes(VectorNi sizes)
sizes.sizes - vector to which the block column sizes are appendedint addBilateralConstraints(SparseBlockMatrix GT, VectorNd dg, int numb)
Gc^T to the
matrix GT, by appending block columns to it. If the argument
dg is non-null, it should be used to return the
velocity constraint time derivative, defined by
\dot Gc velstarting at the location
numb. In all cases, the method must
return an updated value of numb, incremented by the total row
size of Gc.GT - matrix to which the bilateral force contraint matrix
is appended.dg - if non-null, returns the velocity constraint time
derivativenumb - starting index for time derivative in dgnumbint getBilateralInfo(MechSystem.ConstraintInfo[] ginfo, int idx)
Gc vel = 0.This information is placed in pre-allocated
MechSystem.ConstraintInfo
structures in ginfo, starting at idx. The method must
return an updated value of idx, incremented by the number of
rows of Gc.
The constraint information to be set in ConstraintInfo includes:
dist // distance to the constraint surface. compliance // if > 0, gives constraint compliance value damping // damping; only used if compliance > 0 force // used for computing non-linear compliance
ginfo - returns the constraint informationidx - starting location in ginfo for returning constraint
infoidxint setBilateralForces(VectorNd lam, double s, int idx)
lam, starting at the index idx, and should be
scaled by s. (In practice, s is used to convert from
impulses to forces.) The method must return an updated value of idx, incremented by the number of forces associated with this constraint.lam - supplies the force impulses, which should be scaled by ss - scaling factor for the force valuesidx - starting index of forces in lamidxint getBilateralForces(VectorNd lam, int idx)
setBilateralForces(maspack.matrix.VectorNd, double, int). The forces are returned in
lam, starting at the index idx. The method must return
an updated value of idx, incremented by the number of forces
associated with this constraint.lam - returns the forcesidx - starting index for forces in lamidxvoid zeroForces()
void getUnilateralSizes(VectorNi sizes)
sizes.sizes - vector to which the block column sizes are appendedint addUnilateralConstraints(SparseBlockMatrix NT, VectorNd dn, int numu)
Nc^T to the
matrix NT, by appending block columns to it. If the argument
dn is non-null, it should be used to return the
velocity constraint time derivative, defined by
\dot Nc velstarting at the location
numu. In all cases, the method must
return an updated value of numu, incremented by the total row
size of Nc.NT - matrix to which the unilateral force contraint matrix
is appended.dn - if non-null, returns the velocity constraint time
derivativenumu - starting index for time derivative in dnnumuint getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo, int idx)
Nc vel > 0.This information is placed in pre-allocated
MechSystem.ConstraintInfo
structures in ninfo, starting at idx. The method must
return an updated value of idx, incremented by the number of
rows of Nc.
The constraint information to be set in ConstraintInfo includes:
dist // distance to the constraint surface. compliance // if > 0, gives constraint compliance value damping // damping; only used if compliance > 0 force // used for computing non-linear compliance
ninfo - returns the constraint informationidx - starting location in ninfo for returning constraint
infoidxint setUnilateralForces(VectorNd the, double s, int idx)
the, starting at the index idx, and should be
scaled by s. (In practice, s is used to convert from
impulses to forces.) The method must return an updated value of idx, incremented by the number of forces associated with this constraint.the - supplies the force impulses, which should be scaled by ss - scaling factor for the force valuesidx - starting index of forces in theidxint getUnilateralForces(VectorNd the, int idx)
setUnilateralForces(maspack.matrix.VectorNd, double, int). The forces are returned in
the, starting at the index idx. The method must return
an updated value of idx, incremented by the number of forces
associated with this constraint.the - returns the forcesidx - starting index for forces in theidxint setUnilateralState(VectorNi state, int idx)
int getUnilateralState(VectorNi state, int idx)
int maxFrictionConstraintSets()
finfo argument that is
passed to addFrictionConstraints(maspack.matrix.SparseBlockMatrix, java.util.ArrayList<maspack.spatialmotion.FrictionInfo>, boolean, int).int addFrictionConstraints(SparseBlockMatrix DT, java.util.ArrayList<FrictionInfo> finfo, boolean prune, int idx)
Dc^T to the matrix
DT, by appending block columns to it. Each block column in Dc^T corresponds to a friction constraint set, for which
information should be supplied in the pre-allocated FrictionInfo
structures in finfo, starting at idx. The method must
return an updated value of idx, incremented by the number of
friction constraint sets.DT - matrix to which the friction force contraint matrix
is appended.finfo - returns friction constraint information for each
block column in Dc^Tprune - restrict entries of DT to friction constraints
for which the contact force is > 0.idx - starting index for friction information in finfoidxint setFrictionForces(VectorNd phi, double s, int idx)
phi, starting at the index idx, and should be
scaled by s. (In practice, s is used to convert from
impulses to forces.) The method must return an updated value of idx, incremented by the number of forces associated with this constraint.phi - supplies the force impulses, which should be scaled by ss - scaling factor for the force valuesidx - starting index of forces in phiidxint getFrictionForces(VectorNd phi, int idx)
setFrictionForces(maspack.matrix.VectorNd, double, int). The forces are returned in
phi, starting at the index idx. The method must return
an updated value of idx, incremented by the number of forces
associated with this constraint.phi - returns the forcesidx - starting index for forces in phiidxint setFrictionState(VectorNi state, int idx)
int getFrictionState(VectorNi state, int idx)
double updateConstraints(double t,
int flags)
> 0 associated with all of them. If no constraints are
presently active, returns -1.void getConstrainedComponents(java.util.HashSet<DynamicComponent> comps)
comps - set to which constrained components should be added