Search in sources :

Example 1 with DelaunayInterpolator

use of maspack.geometry.DelaunayInterpolator in project artisynth_core by artisynth.

the class MuscleBundle method getFibreRestDistanceInterpolator.

public DelaunayInterpolator getFibreRestDistanceInterpolator() {
    if (myFibres.size() == 0) {
        return null;
    }
    Point3d pos1 = new Point3d();
    Point3d pos2 = new Point3d();
    Point3d loc = new Point3d();
    Point3d[] muscleLocs = new Point3d[myFibres.size()];
    for (int i = 0; i < myFibres.size(); i++) {
        Muscle fibre = myFibres.get(i);
        getRestPosition(pos1, fibre.getFirstPoint());
        getRestPosition(pos2, fibre.getSecondPoint());
        loc.add(pos2, pos1);
        loc.scale(1 / 2.0);
        muscleLocs[i] = new Point3d(loc);
    }
    DelaunayInterpolator interpolator = new DelaunayInterpolator();
    interpolator.setPoints(muscleLocs);
    return interpolator;
}
Also used : Point3d(maspack.matrix.Point3d) Muscle(artisynth.core.mechmodels.Muscle) GenericMuscle(artisynth.core.materials.GenericMuscle) DelaunayInterpolator(maspack.geometry.DelaunayInterpolator) Point(artisynth.core.mechmodels.Point)

Aggregations

GenericMuscle (artisynth.core.materials.GenericMuscle)1 Muscle (artisynth.core.mechmodels.Muscle)1 Point (artisynth.core.mechmodels.Point)1 DelaunayInterpolator (maspack.geometry.DelaunayInterpolator)1 Point3d (maspack.matrix.Point3d)1