use of artisynth.core.mechmodels.MultiPointMuscle in project artisynth_core by artisynth.
the class MultiMuscleDemo method build.
public void build(String[] args) {
super.build(args);
MechModel mechMod = (MechModel) models().get("mechMod");
RigidBody block = mechMod.rigidBodies().get("block");
Particle p0 = new Particle(0.1, 0, -size * 3, size / 2);
p0.setDynamic(false);
mechMod.addParticle(p0);
Particle p1 = new Particle(0.1, 0, size * 3, size / 2);
p1.setDynamic(false);
mechMod.addParticle(p1);
FrameMarker mkr0 = new FrameMarker();
mechMod.addFrameMarker(mkr0, block, new Point3d(0, -size / 2, size / 2));
FrameMarker mkr1 = new FrameMarker();
mechMod.addFrameMarker(mkr1, block, new Point3d(0, size / 2, size / 2));
MultiPointMuscle muscle = new MultiPointMuscle();
LinearAxialMuscle mat = new LinearAxialMuscle();
mat.setForceScaling(1);
mat.setMaxForce(10);
mat.setMaxLength(size);
mat.setPassiveFraction(0.1);
muscle.setMaterial(mat);
muscle.addPoint(p0);
muscle.addPoint(mkr0);
muscle.addPoint(mkr1);
muscle.addPoint(p1);
mechMod.addMultiPointSpring(muscle);
RenderProps.setLineColor(mechMod, Color.BLUE);
RenderProps.setLineStyle(muscle, LineStyle.SPINDLE);
RenderProps.setLineRadius(muscle, 0.1);
RenderProps.setLineColor(muscle, Color.RED);
}
use of artisynth.core.mechmodels.MultiPointMuscle in project artisynth_core by artisynth.
the class TrackingController method addExciter.
/**
* Adds an exciter to be used as a free variable in the inverse routine
* @param weight regularization weight to be applied to the exciter
* @param ex exciter to add
* @param gain the gain applied to the exciter
*/
public void addExciter(double weight, ExcitationComponent ex, double gain) {
if (useMyExciters) {
myExciters.addTarget(ex, gain);
} else {
exciters.add(ex);
}
excitationRegularizationWeights.append(weight);
if (ex instanceof MultiPointMuscle) {
MultiPointMuscle m = (MultiPointMuscle) ex;
if (m.getExcitationColor() == null) {
RenderProps.setLineColor(m, Color.WHITE);
m.setExcitationColor(Color.RED);
}
} else if (ex instanceof Muscle) {
Muscle m = (Muscle) ex;
if (m.getExcitationColor() == null) {
RenderProps.setLineColor(m, Color.WHITE);
m.setExcitationColor(Color.RED);
}
}
/* add an element to the excitation bounds list for possible use later */
upperExcitationBounds.add(null);
lowerExcitationBounds.add(null);
}
Aggregations