use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class FemModel3dAgent method initializePrototype.
protected void initializePrototype(ModelComponent comp, Class type) {
if (type == FemModel3d.class) {
FemModel3d mkr = (FemModel3d) comp;
RenderProps.setPointRadius(mkr, getDefaultPointRadius());
} else {
throw new InternalErrorException("Unimplemented type " + type);
}
}
use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class RigidBodyConnectorList method createAndAddConnector.
private void createAndAddConnector(Point3d origin) {
BodyConnector connector;
RigidTransform3d TCW = new RigidTransform3d();
TCW.R.set(myBodyA.getPose().R);
TCW.p.set(origin);
RigidTransform3d TCA = new RigidTransform3d();
TCA.mulInverseLeft(myBodyA.getPose(), TCW);
if (myComponentType == RevoluteJoint.class) {
RevoluteJoint joint;
if (myBodyB == null) {
joint = new RevoluteJoint(myBodyA, TCA, TCW);
} else {
RigidTransform3d TCB = new RigidTransform3d();
TCB.mulInverseLeft(myBodyB.getPose(), TCW);
joint = new RevoluteJoint(myBodyA, TCA, myBodyB, TCB);
}
connector = joint;
} else if (myComponentType == SphericalJoint.class) {
SphericalJoint joint;
if (myBodyB == null) {
joint = new SphericalJoint(myBodyA, TCA, TCW);
} else {
RigidTransform3d TCB = new RigidTransform3d();
TCB.mulInverseLeft(myBodyB.getPose(), TCW);
joint = new SphericalJoint(myBodyA, TCA, myBodyB, TCB);
}
connector = joint;
} else {
throw new InternalErrorException("Unimplemented connector type " + myComponentType);
}
connector.setName(getNameFieldValue());
setProperties(connector, getPrototypeComponent(myComponentType));
// update properties in the prototype as well ...
setProperties(myPrototype, myPrototype);
addComponent(new AddComponentsCommand("add BodyConnector", connector, (MutableCompositeComponent<?>) myModel.bodyConnectors()));
setState(State.Complete);
myMain.setSelectionMode(Main.SelectionMode.Translate);
}
use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class SelectionPopup method addTracing.
private void addTracing(LinkedList<ModelComponent> selectedItems) {
// RootModel root = myMain.getRootModel();
// String name = null;
// double startTime = myMain.getTimeSec();
// double updateInterval = root.getMaxStepSizeSec();
Traceable firstTraceable = null;
for (ModelComponent comp : selectedItems) {
if (comp instanceof Traceable) {
firstTraceable = (Traceable) comp;
}
}
if (firstTraceable == null) {
throw new InternalErrorException("'Add tracing' called with no traceabled in selection");
}
TracingProbePanel panel = new TracingProbePanel(firstTraceable, getCommonTraceables(selectedItems));
panel.pack();
GuiUtils.locateRelative(panel, myLastBounds, 0.5, 0.5, 0, 0.5);
// if (myTraceItemLoc != null)
// { panel.setLocation (
// myTraceItemLoc.x, myTraceItemLoc.y);
// }
panel.setVisible(true);
if (panel.getReturnValue() == OptionPanel.OK_OPTION) {
for (ModelComponent comp : selectedItems) {
if (comp instanceof Traceable) {
TracingProbe probe = panel.createProbe((Traceable) comp);
myMain.getRootModel().addOutputProbe(probe);
}
}
}
}
use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class ReadlinePanel method killLine.
protected void killLine() {
int offs = getCaretPosition();
int endOffs = getLineEnd();
if (offs < endOffs) {
try {
myKillBuffer = getText(offs, endOffs - offs);
doDelete(offs, endOffs);
} catch (BadLocationException ble) {
throw new InternalErrorException("bad location");
}
}
}
use of maspack.util.InternalErrorException in project artisynth_core by artisynth.
the class ReadlinePanel method acceptLine.
// we synchronize acceptLine so that we can ensure that scripts
// don't start running while we are still in this method
protected synchronized void acceptLine() {
String line = getLineText();
appendText("\n");
setHistory(0, line);
addHistory("");
myHistoryIdx = 0;
myInputRequested = false;
if (myInputWriter == null) {
String result = processInput(line);
if (result != null && !result.endsWith("\n")) {
result = result + "\n";
}
appendText(result);
requestInput(myPrompt);
} else {
try {
myInputWriter.write(line + "\n");
myInputWriter.flush();
} catch (Exception e) {
throw new InternalErrorException("Error writing to commandWriter: " + e);
}
}
}
Aggregations