Search in sources :

Example 6 with MuscleExciter

use of artisynth.core.mechmodels.MuscleExciter in project artisynth_core by artisynth.

the class SpongeDemo method build.

// boolean kinematic = false;
public void build(String[] args) throws IOException {
    sponge = new SpongeModel("sponge");
    addModel(sponge);
    MuscleExciter exciter = new MuscleExciter("gang");
    exciter.addTarget(sponge.getMuscleBundles().get(0), 1.0);
    exciter.addTarget(sponge.getMuscleBundles().get(1), 1.0);
    exciter.addTarget(sponge.getMuscleBundles().get(2), 1.0);
    sponge.addMuscleExciter(exciter);
    MuscleExciter all = new MuscleExciter("all");
    for (MuscleBundle b : sponge.getMuscleBundles()) {
        all.addTarget(b, 1.0);
    }
    sponge.addMuscleExciter(all);
    sponge.setSurfaceRendering(SurfaceRender.Shaded);
    RenderProps.setAlpha(sponge, 0.5);
    // loadProbes();
    // build solve matrix to set solve indices
    // SparseBlockMatrix M = sponge.getSolveMatrix();
    // System.out.printf("M size = (%d, %d), nonzero = %d\n", M.rowSize(),
    // M.colSize(), M.numNonZeroVals()); // + J.toString("%8.2e"));
    // SparseBlockMatrix J = sponge.updateActJacobian(1.0);
    // System.out.printf("J size = (%d, %d), nonzero = %d\n", J.rowSize(),
    // J.colSize(), J.numNonZeroVals()); // + J.toString("%8.2e"));
    // System.out.println("J = \n" + J.toString("%8.2e"));
    // testActJacobian();
    // printSparseJacobian();
    addControlPanel();
}
Also used : MuscleBundle(artisynth.core.femmodels.MuscleBundle) MuscleExciter(artisynth.core.mechmodels.MuscleExciter)

Aggregations

MuscleExciter (artisynth.core.mechmodels.MuscleExciter)6 ConstantAxialMuscle (artisynth.core.materials.ConstantAxialMuscle)3 Muscle (artisynth.core.mechmodels.Muscle)3 MuscleBundle (artisynth.core.femmodels.MuscleBundle)2 Point3d (maspack.matrix.Point3d)1 DoubleFieldSlider (maspack.widgets.DoubleFieldSlider)1