use of artisynth.core.mechmodels.MechSystem.ConstraintInfo in project artisynth_core by artisynth.
the class BodyConnector method getUnilateralInfo.
public int getUnilateralInfo(ConstraintInfo[] ninfo, int idx) {
int nc = (myUnilaterals != null ? myUnilaterals.size() : 0);
if (nc > 0) {
for (int j = 0; j < nc; j++) {
RigidBodyConstraint uc = myUnilaterals.get(j);
uc.setSolveIndex(idx);
ConstraintInfo ni = ninfo[idx++];
if (uc.getDistance() < -myPenetrationTol) {
ni.dist = uc.getDistance() + myPenetrationTol;
} else {
ni.dist = 0;
}
ni.compliance = uc.getCompliance();
ni.damping = uc.getDamping();
ni.force = 0;
}
}
return idx;
}
use of artisynth.core.mechmodels.MechSystem.ConstraintInfo in project artisynth_core by artisynth.
the class ParticleConstraintBase method getBilateralInfo.
public int getBilateralInfo(ConstraintInfo[] ginfo, int idx) {
if (!myUnilateralP) {
for (int i = 0; i < myParticleInfo.size(); i++) {
ParticleInfo pi = myParticleInfo.get(i);
if (pi.myPart.getSolveIndex() != -1) {
ConstraintInfo gi = ginfo[idx++];
gi.dist = pi.myDist;
gi.compliance = myCompliance;
gi.damping = myDamping;
gi.force = 0;
}
}
}
return idx;
}
use of artisynth.core.mechmodels.MechSystem.ConstraintInfo in project artisynth_core by artisynth.
the class ParticleConstraintNdBase method getBilateralInfo.
public int getBilateralInfo(ConstraintInfo[] ginfo, int idx) {
if (!myUnilateralP) {
for (ParticleInfo pi : myParticleInfo) {
if (pi.myPart.getSolveIndex() != -1) {
for (int i = 0; i < pi.myDist.length; ++i) {
ConstraintInfo gi = ginfo[idx++];
gi.dist = pi.myDist[i];
gi.compliance = myCompliance;
gi.damping = myDamping;
gi.force = 0;
}
}
}
}
return idx;
}
use of artisynth.core.mechmodels.MechSystem.ConstraintInfo in project artisynth_core by artisynth.
the class ParticleConstraintNdBase method getUnilateralInfo.
public int getUnilateralInfo(ConstraintInfo[] ninfo, int idx) {
if (myUnilateralP) {
for (ParticleInfo pi : myParticleInfo) {
if (pi.myEngagedP && pi.myPart.getSolveIndex() != -1) {
for (int j = 0; j < pi.myDist.length; ++j) {
ConstraintInfo gi = ninfo[idx++];
gi.dist = pi.myDist[j];
gi.compliance = myCompliance;
gi.damping = myDamping;
gi.force = 0;
}
}
}
}
return idx;
}
use of artisynth.core.mechmodels.MechSystem.ConstraintInfo in project artisynth_core by artisynth.
the class MechSystemSolver method setUnilateralOffsets.
private void setUnilateralOffsets(double h, double dotscale) {
if (myNsize > 0) {
mySys.getUnilateralInfo(myNInfo);
double[] ndot = myNdot.getBuffer();
double[] Rbuf = myRn.getBuffer();
double[] nbuf = myBn.getBuffer();
for (int i = 0; i < myNsize; i++) {
ConstraintInfo ni = myNInfo[i];
if (ni.compliance > 0) {
if (ni.force != 0) {
double alpha = 1 / (0.5 * h / ni.compliance + ni.damping);
Rbuf[i] = alpha / h;
nbuf[i] -= alpha * ni.force;
} else {
double s = 1 / (0.5 * h + ni.damping * ni.compliance);
Rbuf[i] = s * ni.compliance / h;
nbuf[i] -= s * ni.dist;
}
}
nbuf[i] -= dotscale * ndot[i];
}
}
}
Aggregations