Search in sources :

Example 1 with NeoHookeanMaterial

use of artisynth.core.materials.NeoHookeanMaterial in project artisynth_core by artisynth.

the class PointFemAttachment method addFem.

// create an FEM beam model, translate it to (x,y,z), fix the leftmost
// nodes, and add it to a mech model
private FemModel3d addFem(MechModel mech, double x, double y, double z) {
    FemModel3d fem = FemFactory.createHexGrid(null, 1.0, 0.2, 0.2, 10, 3, 3);
    fem.setMaterial(new NeoHookeanMaterial());
    // RenderProps.setSphericalPoints (fem, 0.005, Color.GREEN);
    RenderProps.setLineColor(fem, Color.BLUE);
    RenderProps.setLineWidth(fem, 2);
    mech.addModel(fem);
    fem.transformGeometry(new RigidTransform3d(x, y, z));
    // find and fix the leftmost elements:
    PointList<FemNode3d> nodes = fem.getNodes();
    for (int i = 0; i < nodes.size(); i++) {
        FemNode3d n = nodes.get(i);
        if (Math.abs(n.getPosition().x - (-0.5 + x)) < 1e-8) {
            n.setDynamic(false);
        }
    }
    return fem;
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d) NeoHookeanMaterial(artisynth.core.materials.NeoHookeanMaterial)

Aggregations

NeoHookeanMaterial (artisynth.core.materials.NeoHookeanMaterial)1 RigidTransform3d (maspack.matrix.RigidTransform3d)1