use of maspack.matrix.VectorNd in project artisynth_core by artisynth.
the class NumericInputProbe method set.
public void set(Property[] props, String[] driverExpressions, String[] variableNames, int[] variableDimensions, PlotTraceInfo[] traceInfos) {
if (props.length != driverExpressions.length) {
throw new IllegalArgumentException("number of drivers must equal number of properties");
}
if (variableNames.length != variableDimensions.length) {
throw new IllegalArgumentException("number of channels must equal number of variable names");
}
NumericConverter[] newConverters = createConverters(props);
LinkedHashMap<String, NumericProbeVariable> newVariables = new LinkedHashMap<String, NumericProbeVariable>();
int newVsize = 0;
for (int i = 0; i < variableNames.length; i++) {
String name = variableNames[i];
if (name == null || newVariables.get(name) != null) {
throw new IllegalArgumentException("null or repeated variable name '" + name + "'");
}
if (!isValidVariableName(name)) {
throw new IllegalArgumentException("variable name '" + name + "' is not a valid variable name");
}
if (variableDimensions[i] <= 0) {
throw new IllegalArgumentException("channel sizes must be greater than 0");
}
newVariables.put(name, new NumericProbeVariable(variableDimensions[i]));
newVsize += variableDimensions[i];
}
ArrayList<NumericProbeDriver> newDrivers = createDrivers(driverExpressions, newVariables);
myPropList = createPropertyList(props);
myConverters = newConverters;
// myPropValues = new double[props.length][];
myVariables = newVariables;
myDrivers = newDrivers;
if (myNumericList == null || myVsize != newVsize) {
myVsize = newVsize;
myNumericList = new NumericList(myVsize);
myNumericList.setInterpolation(myInterpolation);
myTmpVec = new VectorNd(myVsize);
}
if (traceInfos != null) {
myPlotTraceManager.rebuild(getPropsOrDimens(), traceInfos);
} else {
myPlotTraceManager.rebuild(getPropsOrDimens());
}
if (myLegend != null) {
myLegend.rebuild();
}
}
use of maspack.matrix.VectorNd in project artisynth_core by artisynth.
the class AffineNumericInputProbe method setTransform.
// fills in a larger transform
public void setTransform(AffineTransform3d A) {
int nPoints = myVsize / 3;
Matrix3dBase Ar = A.getMatrix();
Vector3d At = A.getOffset();
for (int i = 0; i < nPoints; i++) {
R.setSubMatrix(i * 3, i * 3, Ar);
t.setSubVector(i * 3, new VectorNd(At));
}
}
use of maspack.matrix.VectorNd in project artisynth_core by artisynth.
the class AffineNumericInputProbe method getValues.
public VectorNd getValues(double t) {
VectorNd result = new VectorNd(myVsize);
double tloc = (t - getStartTime() - timeOffset) / myScale;
myNumericList.interpolate(result, tloc);
result = transform(result);
return result;
}
use of maspack.matrix.VectorNd in project artisynth_core by artisynth.
the class AffineNumericInputProbe method set.
@Override
public void set(Property[] props, String[] driverExpressions, String[] variableNames, int[] variableDimensions, PlotTraceInfo[] traceInfos) {
super.set(props, driverExpressions, variableNames, variableDimensions, traceInfos);
myTmpVec = new VectorNd(myVsize);
initTransform(myVsize);
}
use of maspack.matrix.VectorNd in project artisynth_core by artisynth.
the class RigidTransformInputProbe method addTransform.
public void addTransform(double t, RigidTransform3d tx) {
VectorNd posVector = new VectorNd();
Vector3d offset = tx.getOffset();
posVector.append(offset.x);
posVector.append(offset.y);
posVector.append(offset.z);
RotationMatrix3d rot = new RotationMatrix3d();
Vector3d scale = new Vector3d();
Matrix3d shear = new Matrix3d();
tx.getMatrixComponents(rot, scale, shear);
Quaternion q = new Quaternion(rot.getAxisAngle());
posVector.append(q.s);
posVector.append(q.u.x);
posVector.append(q.u.y);
posVector.append(q.u.z);
NumericListKnot knot = new NumericListKnot(myVectorSize);
knot.t = t;
knot.v.set(posVector);
myTransAndQuaternParams.add(knot);
if (t < getStartTime()) {
setStartTime(t);
}
if (t > getStopTime()) {
setStopTime(t);
}
}
Aggregations