use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class HydrostatModel method addTentacleExcitersX.
public void addTentacleExcitersX() {
for (Axis a : Axis.values()) {
for (Hemisphere hemi : Hemisphere.values()) {
MuscleExciter ex = new MuscleExciter(a.getDirName() + "_" + hemi.getName());
for (Muscle m : muscleFibres) {
if (Math.abs(m.getDir().dot(a.getDir())) == 1.0 && hemi.check(m.getFirstPoint()) && hemi.check(m.getSecondPoint())) {
ex.addTarget(m, 1.0);
}
}
addMuscleExciter(ex);
// RenderProps.setLineStyle(b, LineStyle.ELLIPSOID);
// RenderProps.setLineColor(b, PlotTraceInfo.getPaletteColors()[b
// .getNumber()]);
}
}
}
use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class HydrostatModel method createTubeMuscles.
public void createTubeMuscles(TubeAxis axis, MuscleBundle bundle) {
addMuscleBundle(bundle);
RenderProps.setLineWidth(bundle, 4);
RenderProps.setLineColor(bundle, Color.WHITE);
Point3d p0 = new Point3d();
Point3d p1 = new Point3d();
double dl = l / (nl - 1);
double dt = 2 * Math.PI / nt;
double dr = (r - rin) / (nr - 1);
int init_j = (periphLongP && axis == TubeAxis.LONG || periphCircP && axis == TubeAxis.CIRC ? nr - 1 : 0);
for (double i = 0; i < nt; i++) for (double j = init_j; j < (axis == TubeAxis.RADIAL ? nr - 1 : nr); j++) for (double k = 0; k < (axis == TubeAxis.LONG ? nl - 1 : nl); k++) {
p0.set(-l / 2 + k * dl, -(rin + dr * j) * Math.cos(dt * i), (rin + dr * j) * Math.sin(dt * i));
double radius = (rin + dr * (axis == TubeAxis.RADIAL ? j + 1 : j));
double angle = dt * (axis == TubeAxis.CIRC ? i + 1 : i);
p1.set(-l / 2 + (axis == TubeAxis.LONG ? k + 1 : k) * dl, -radius * Math.cos(angle), radius * Math.sin(angle));
Muscle f = new Muscle(findPoint(p0), findPoint(p1));
f.setConstantMuscleMaterial(muscleForce, 1);
bundle.addFibre(f);
}
}
use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class HydrostatModel method createExciter.
public void createExciter(String name, Point3d emin, Point3d emax, MuscleBundle b) {
Point3d pmin = new Point3d();
Point3d pmax = new Point3d();
MuscleExciter ex = new MuscleExciter(name);
addMuscleExciter(ex);
// great than check -- use minus minimum
emin.negate();
for (Muscle f : b.getFibres()) {
pmin.set(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE);
pmax.set(-Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE);
f.updateBounds(pmin, pmax);
// great than check -- use minus minimum
pmin.negate();
if (emax.greaterEquals(pmax) && emin.greaterEquals(pmin))
ex.addTarget(f, 1.0);
}
}
use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class HydrostatModel method addTentacleMuscles.
/*
* testing for tentacle simulations
*/
public void addTentacleMuscles() {
// don't just create peripheral long fibers
periphLongP = false;
for (Axis a : Axis.values()) createMuscles(a, a.getDirName());
for (Axis a : Axis.values()) {
MuscleBundle b = new MuscleBundle(a.getDirName());
for (Muscle m : muscleFibres) {
if (Math.abs(m.getDir().dot(a.getDir()) - 1.0) < 1e-4) {
// if (m.getName().startsWith(a.getDirName())) {
b.addFibre(m);
}
}
addMuscleBundle(b);
RenderProps.setLineStyle(b, Renderer.LineStyle.SPINDLE);
RenderProps.setLineColor(b, PlotTraceInfo.getPaletteColors()[b.getNumber()]);
}
}
use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class HydrostatModel method addTentacleExciters.
public void addTentacleExciters() {
for (Axis a : Axis.values()) {
MuscleBundle b = myMuscleList.get(a.getDirName());
for (Hemisphere hemi : Hemisphere.values()) {
if (Math.abs(hemi.getDir().dot(a.getDir())) == 1.0)
continue;
MuscleExciter ex = new MuscleExciter(a.getDirName() + "_" + hemi.getName());
for (Muscle m : b.getFibres()) {
if (hemi.check(m.getFirstPoint()) && hemi.check(m.getSecondPoint())) {
ex.addTarget(m, 1.0);
}
}
addMuscleExciter(ex);
}
}
}
Aggregations