Search in sources :

Example 16 with FemElement3d

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

the class MFreeMuscleModel method render.

// public void setDrawFibers(boolean enable) {
// myDrawFibers = enable;
// }
public void render(Renderer renderer, int flags) {
    super.render(renderer, flags);
    // if (myFiberMesh != null) {
    // myFiberMesh.render(renderer, myRenderProps, /* flags= */0);
    // }
    // if (myDrawFibers) {
    RenderProps fiberRenderProps = myFiberRenderProps;
    if (fiberRenderProps == null) {
        fiberRenderProps = DEFAULT_FIBER_RENDER_PROPS;
    }
    double dirLen = getDirectionRenderLen();
    if (dirLen > 0) {
        Matrix3d F = new Matrix3d();
        Vector3d dir = new Vector3d();
        float[] coords0 = new float[3];
        float[] coords1 = new float[3];
        for (FemElement3d e : getElements()) {
            renderDirection(renderer, fiberRenderProps, e, coords0, coords1, F, dir, dirLen);
        }
    }
}
Also used : Matrix3d(maspack.matrix.Matrix3d) SymmetricMatrix3d(maspack.matrix.SymmetricMatrix3d) FemElement3d(artisynth.core.femmodels.FemElement3d) Vector3d(maspack.matrix.Vector3d) RenderProps(maspack.render.RenderProps)

Example 17 with FemElement3d

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

the class MFreeNode3d method computeMassFromDensity.

public double computeMassFromDensity() {
    double mass = 0;
    Iterator<FemElement3d> it = getElementDependencies().iterator();
    while (it.hasNext()) {
        FemElement3d e = it.next();
        mass += e.getRestVolume() * e.getDensity() / e.numNodes();
    }
    return mass;
}
Also used : FemElement3d(artisynth.core.femmodels.FemElement3d)

Example 18 with FemElement3d

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

the class FemSurfaceTargetDemo method addMuscle.

public void addMuscle(String name, Color color, Vector3d dir) {
    MuscleBundle b = new MuscleBundle(name);
    for (FemElement3d e : fem.getElements()) {
        b.addElement(e, dir);
    }
    b.setMuscleMaterial(new SimpleForceMuscle(muscleMaxStress));
    b.setDirectionRenderLen(w / 4);
    RenderProps.setLineColor(b, color);
    RenderProps.setLineWidth(b, 4);
    fem.addMuscleBundle(b);
}
Also used : MuscleBundle(artisynth.core.femmodels.MuscleBundle) SimpleForceMuscle(artisynth.core.materials.SimpleForceMuscle) FemElement3d(artisynth.core.femmodels.FemElement3d)

Example 19 with FemElement3d

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

the class FemMuscleDemo method createBundle.

protected MuscleBundle createBundle(String name, List<FemElement3d> elems) {
    MuscleBundle bundle = new MuscleBundle(name);
    if (elems != null) {
        for (FemElement3d e : elems) {
            MuscleElementDesc desc = new MuscleElementDesc();
            desc.setElement(e);
            desc.setDirection(Vector3d.X_UNIT);
            bundle.addElement(desc);
        }
    }
    return bundle;
}
Also used : MuscleBundle(artisynth.core.femmodels.MuscleBundle) FemElement3d(artisynth.core.femmodels.FemElement3d) MuscleElementDesc(artisynth.core.femmodels.MuscleElementDesc)

Example 20 with FemElement3d

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

the class HydrostatModel method createAndAddMarker.

private Point createAndAddMarker(Point3d pnt) {
    numCreatedMarkers++;
    // add the marker to the model
    FemElement3d elem = findContainingElement(pnt);
    if (elem == null) {
        /*
          * project pnt to nearest fem element -- not used b/c of styloglossus
          * System.out.println("containing element null"); Point3d newLoc = new
          * Point3d(); elem = tongue.findNearestElement (newLoc, pnt); pnt.set
          * (newLoc); FemMarker marker = new FemMarker (elem, pnt);
          * tongue.addMarker (marker, elem); return marker;
          */
        FemNode3d fixedNode = new FemNode3d(pnt);
        fixedNode.setDynamic(false);
        addNode(fixedNode);
        return fixedNode;
    } else {
        FemMarker marker = new FemMarker(elem, pnt);
        addMarker(marker, elem);
        return marker;
    }
}
Also used : FemElement3d(artisynth.core.femmodels.FemElement3d) FemNode3d(artisynth.core.femmodels.FemNode3d) FemMarker(artisynth.core.femmodels.FemMarker)

Aggregations

FemElement3d (artisynth.core.femmodels.FemElement3d)21 FemNode3d (artisynth.core.femmodels.FemNode3d)8 Point3d (maspack.matrix.Point3d)7 Vector3d (maspack.matrix.Vector3d)7 Point (artisynth.core.mechmodels.Point)6 IntegrationPoint3d (artisynth.core.femmodels.IntegrationPoint3d)4 MuscleBundle (artisynth.core.femmodels.MuscleBundle)4 IntegrationData3d (artisynth.core.femmodels.IntegrationData3d)3 VectorNd (maspack.matrix.VectorNd)3 FemMarker (artisynth.core.femmodels.FemMarker)2 FemMeshComp (artisynth.core.femmodels.FemMeshComp)2 FemMuscleModel (artisynth.core.femmodels.FemMuscleModel)2 LinearMaterial (artisynth.core.materials.LinearMaterial)2 SimpleForceMuscle (artisynth.core.materials.SimpleForceMuscle)2 MechModel (artisynth.core.mechmodels.MechModel)2 ArrayList (java.util.ArrayList)2 BVFeatureQuery (maspack.geometry.BVFeatureQuery)2 PolygonalMesh (maspack.geometry.PolygonalMesh)2 Vertex3d (maspack.geometry.Vertex3d)2 RigidTransform3d (maspack.matrix.RigidTransform3d)2