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,
MechSystem.FrictionInfo[] finfo,
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.List<DynamicComponent> list)
Collected all the dynamic components constrained by this constrainer.

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 
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 
setUnilateralForces(VectorNd the,
double s,
int idx)
Sets the unilateral forces that were computed to enforce this
constraint.

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 nonnull
, 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 nonnull
, returns the velocity constraint time
derivativenumb
 starting index for time derivative in dg
numb
int getBilateralInfo(MechSystem.ConstraintInfo[] ginfo, int idx)
Gc vel = 0.This information is placed in preallocated
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 nonlinear compliance
ginfo
 returns the constraint informationidx
 starting location in ginfo
for returning constraint
infoidx
int 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 s
s
 scaling factor for the force valuesidx
 starting index of forces in lam
idx
int 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 lam
idx
void 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 nonnull
, 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 nonnull
, returns the velocity constraint time
derivativenumu
 starting index for time derivative in dn
numu
int getUnilateralInfo(MechSystem.ConstraintInfo[] ninfo, int idx)
Nc vel > 0.This information is placed in preallocated
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 nonlinear compliance
ninfo
 returns the constraint informationidx
 starting location in ninfo
for returning constraint
infoidx
int 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 s
s
 scaling factor for the force valuesidx
 starting index of forces in the
idx
int 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 the
idx
int maxFrictionConstraintSets()
finfo
argument that is
passed to addFrictionConstraints(maspack.matrix.SparseBlockMatrix, artisynth.core.mechmodels.MechSystem.FrictionInfo[], int)
.int addFrictionConstraints(SparseBlockMatrix DT, MechSystem.FrictionInfo[] finfo, 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 preallocated MechSystem.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^T
idx
 starting index for friction information in finfo
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.List<DynamicComponent> list)
list
 list to which constrained components should be appended