Search in sources :

Example 21 with Particle

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

the class PointModel1d method setProperties.

public void setProperties() {
    double springK = 100.0;
    double passiveFraction = 0.5;
    double muscleD = 0.0;
    double pointDamping = 0.1;
    for (AxialSpring s : model.axialSprings()) {
        if (s instanceof AxialSpring) {
            if (s.getMaterial() instanceof LinearAxialMaterial) {
                LinearAxialMaterial mat = (LinearAxialMaterial) s.getMaterial().clone();
                mat.setStiffness(springK);
                s.setMaterial(mat);
            }
        }
        if (s instanceof Muscle) {
            Muscle m = (Muscle) s;
            if (m.getMaterial() instanceof AxialMuscleMaterial) {
                AxialMuscleMaterial mat = (AxialMuscleMaterial) m.getMaterial().clone();
                mat.setPassiveFraction(passiveFraction);
                mat.setDamping(muscleD);
                m.setMaterial(mat);
            }
        }
    }
    for (Particle p : model.particles()) {
        p.setPointDamping(pointDamping);
    }
}
Also used : Particle(artisynth.core.mechmodels.Particle) Muscle(artisynth.core.mechmodels.Muscle) AxialSpring(artisynth.core.mechmodels.AxialSpring)

Aggregations

Particle (artisynth.core.mechmodels.Particle)21 Point3d (maspack.matrix.Point3d)12 AxialSpring (artisynth.core.mechmodels.AxialSpring)10 MechModel (artisynth.core.mechmodels.MechModel)8 RigidBody (artisynth.core.mechmodels.RigidBody)5 FrameMarker (artisynth.core.mechmodels.FrameMarker)4 Muscle (artisynth.core.mechmodels.Muscle)4 Point (artisynth.core.mechmodels.Point)4 SphericalJoint (artisynth.core.mechmodels.SphericalJoint)4 RigidTransform3d (maspack.matrix.RigidTransform3d)4 MultiPointSpring (artisynth.core.mechmodels.MultiPointSpring)3 RenderProps (maspack.render.RenderProps)3 FemMarker (artisynth.core.femmodels.FemMarker)2 LinearAxialMuscle (artisynth.core.materials.LinearAxialMuscle)2 SimpleAxialMuscle (artisynth.core.materials.SimpleAxialMuscle)2 PolygonalMesh (maspack.geometry.PolygonalMesh)2 FemElement (artisynth.core.femmodels.FemElement)1 FemNode (artisynth.core.femmodels.FemNode)1 FemNode3d (artisynth.core.femmodels.FemNode3d)1 ConnectorForceRenderer (artisynth.core.inverse.ConnectorForceRenderer)1