Search in sources :

Example 1 with AuxMaterialElementDesc

use of artisynth.core.femmodels.AuxMaterialElementDesc in project artisynth_core by artisynth.

the class LinearAuxiliaryTest method build.

@Override
public void build(String[] args) throws IOException {
    super.build(args);
    MechModel mech = new MechModel("mech");
    addModel(mech);
    double h = 0.1;
    double r = 0.005;
    LinearMaterial lmat = new LinearMaterial(50000, 0.45, true);
    FemModel3d fem1 = createCylinder(h, r);
    fem1.setName("auxiliary");
    mech.addModel(fem1);
    fem1.setMaterial(new NullMaterial());
    AuxMaterialBundle bundle = new AuxMaterialBundle("mat");
    for (FemElement3d elem : fem1.getElements()) {
        bundle.addElement(new AuxMaterialElementDesc(elem));
    }
    fem1.addMaterialBundle(bundle);
    bundle.setMaterial(lmat);
    FemModel3d fem2 = createCylinder(h, r);
    fem2.setName("linear");
    fem2.setMaterial(lmat);
    mech.addModel(fem2);
    RigidTransform3d rot = new RigidTransform3d(Vector3d.ZERO, AxisAngle.ROT_Y_90);
    fem1.transformGeometry(rot);
    fem2.transformGeometry(rot);
    fem2.transformGeometry(new RigidTransform3d(new Vector3d(0, 2 * r, 0), AxisAngle.IDENTITY));
    RenderProps.setFaceColor(fem2, Color.MAGENTA);
    addMonitor(new StiffnessErrorMonitor(fem1, fem2));
}
Also used : NullMaterial(artisynth.core.materials.NullMaterial) MechModel(artisynth.core.mechmodels.MechModel) RigidTransform3d(maspack.matrix.RigidTransform3d) FemModel3d(artisynth.core.femmodels.FemModel3d) FemElement3d(artisynth.core.femmodels.FemElement3d) Vector3d(maspack.matrix.Vector3d) AuxMaterialElementDesc(artisynth.core.femmodels.AuxMaterialElementDesc) AuxMaterialBundle(artisynth.core.femmodels.AuxMaterialBundle) LinearMaterial(artisynth.core.materials.LinearMaterial)

Aggregations

AuxMaterialBundle (artisynth.core.femmodels.AuxMaterialBundle)1 AuxMaterialElementDesc (artisynth.core.femmodels.AuxMaterialElementDesc)1 FemElement3d (artisynth.core.femmodels.FemElement3d)1 FemModel3d (artisynth.core.femmodels.FemModel3d)1 LinearMaterial (artisynth.core.materials.LinearMaterial)1 NullMaterial (artisynth.core.materials.NullMaterial)1 MechModel (artisynth.core.mechmodels.MechModel)1 RigidTransform3d (maspack.matrix.RigidTransform3d)1 Vector3d (maspack.matrix.Vector3d)1