use of maspack.interpolation.NumericListKnot in project artisynth_core by artisynth.
the class NumericInputProbe method setData.
public void setData(double sec) {
double t = getVirtualTime(sec);
myNumericList.interpolate(myTmpVec, t);
myTmpVec.setZero();
double[] buf = myTmpVec.getBuffer();
int k = 0;
// load all channels
for (Map.Entry<String, NumericProbeVariable> entry : myVariables.entrySet()) {
for (int i = 0; i < myDrivers.size(); i++) {
NumericProbeDriver driver = myDrivers.get(i);
if (driver.usesVariable(entry.getKey())) {
// set variable at buf[k];
Object val = myPropList.get(i).get();
double[] array = myConverters[i].objectToArray(myPropList.get(i).get());
for (int j = 0; j < array.length; j++) {
buf[k + j] = array[j];
}
break;
}
}
k += entry.getValue().getDimension();
}
NumericListKnot knot = new NumericListKnot(myTmpVec.size());
knot.v.set(myTmpVec);
knot.t = t;
myNumericList.add(knot);
}
use of maspack.interpolation.NumericListKnot in project artisynth_core by artisynth.
the class NumericMonitorProbe method writeData.
public void writeData(PrintWriter pw, String fmtStr, boolean showTime) {
NumberFormat timeFmt = null;
if (showTime) {
if (getUpdateInterval() < 1e-5) {
timeFmt = new NumberFormat("%12.9f");
} else {
timeFmt = new NumberFormat("%9.6f");
}
}
NumberFormat fmt = new NumberFormat(fmtStr);
Iterator<NumericListKnot> it = myNumericList.iterator();
while (it.hasNext()) {
NumericListKnot knot = it.next();
if (showTime) {
pw.print(timeFmt.format(knot.t) + " ");
}
pw.println(knot.v.toString(fmt));
}
}
use of maspack.interpolation.NumericListKnot in project artisynth_core by artisynth.
the class NumericMonitorProbe method apply.
public void apply(double t) {
// XXX don't we want to apply scaling here too?
double trel = (t - getStartTime()) / myScale;
NumericListKnot knot = new NumericListKnot(myVsize);
generateData(knot.v, t, trel);
knot.t = trel;
myNumericList.add(knot);
myNumericList.clearAfter(knot);
}
use of maspack.interpolation.NumericListKnot in project artisynth_core by artisynth.
the class PointTracingProbe method updateBounds.
public void updateBounds(Vector3d pmin, Vector3d pmax) {
if (myNumericList == null) {
return;
}
Point3d pnt = new Point3d();
for (NumericListKnot knot : myNumericList) {
VectorNd v = knot.v;
pnt.x = v.get(0);
pnt.y = v.get(1);
pnt.z = v.get(2);
pnt.updateBounds(pmin, pmax);
}
}
Aggregations