Search in sources :

Example 11 with WayPoint

use of artisynth.core.probes.WayPoint in project artisynth_core by artisynth.

the class TimelineController method refreshWayPoints.

// Refresh the set of waypoint from info the RootModel. Return true if
// changes were made, and false otherwise.
private boolean refreshWayPoints(RootModel root) {
    myToolBar.updateToolbarState(root);
    if (!wayPointsNeedRefreshing(root)) {
        return false;
    }
    // remove all way infos ...
    Iterator<WayPointInfo> it = wayInfos.iterator();
    while (it.hasNext()) {
        WayPointInfo info = it.next();
        it.remove();
        info.finalize();
    }
    // now add new ones from rootModel ...
    int idx = 0;
    for (WayPoint wayPoint : root.getWayPoints().getPoints()) {
        WayPointInfo info = new WayPointInfo(this, wayPoint);
        wayInfos.add(info);
        info.setIndex(idx++);
    }
    rebuildWayPointTrack();
    return true;
}
Also used : WayPoint(artisynth.core.probes.WayPoint) WayPoint(artisynth.core.probes.WayPoint)

Example 12 with WayPoint

use of artisynth.core.probes.WayPoint in project artisynth_core by artisynth.

the class TimelineController method deleteWayPoints.

public void deleteWayPoints() {
    if (confirmAction("Delete WayPoints?")) {
        int count = wayInfos.size();
        // Delete all but the 0 waypoint.
        for (int j = 1; j < count; j++) {
            WayPointInfo info = wayInfos.get(1);
            if (info.getTime() != 0) {
                info.removeWayPointFromRoot();
                deleteWaypoint(1, true);
                info.finalize();
            }
        }
    }
}
Also used : WayPoint(artisynth.core.probes.WayPoint)

Example 13 with WayPoint

use of artisynth.core.probes.WayPoint in project artisynth_core by artisynth.

the class TimelineController method resetAll.

// /**
// * Called internally when the step time is set by the GUI
// */
// void setStepTime (double newStep) {
// myScheduler.setStepTime (newStep);
// }
/**
 * Resets the timeline.  Called when it is first created and when new
 * models are loaded.
 */
public void resetAll() {
    // Assume that caller has ensured the scheduler is not running
    // myScheduler.stopRequest();
    // myScheduler.waitForPlayingToStop();
    RootModel rootModel = myMain.getRootModel();
    int count = myInTracks.size();
    for (int i = 0; i < count; i++) {
        deleteTrack(Track.TYPE_INPUT, 0, false);
    }
    count = myOutTracks.size();
    for (int j = 0; j < count; j++) {
        deleteTrack(Track.TYPE_OUTPUT, 0, false);
    }
    myProbeMap.clear();
    // Add the root model on timeline
    Track suitableTrack;
    // Process all the input probes into proper places
    for (Probe p : rootModel.getInputProbes()) {
        addProbe(p);
    }
    // Process all the output probes into proper places
    for (Probe p : rootModel.getOutputProbes()) {
        if (!(p instanceof WayPointProbe)) {
            addProbe(p);
        }
    }
    // Process the waypoints
    refreshWayPoints(rootModel);
    // for (WayPoint wayPoint : getWayPoints().getPoints ()) {
    // addWayPointFromRoot (wayPoint);
    // }
    // setAppropriateVirtualWaypoint (false);
    // timescale.updateTimeCursor (0);
    myToolBar.updateToolbarState(rootModel);
    closeProbeEditors();
    myProbeEditors = new ArrayList<NumericProbeEditor>();
    selectedProbes = new ArrayList<ProbeInfo>();
    expandToggle.setSelected(false);
    muteToggle.setSelected(false);
    updateWidgets(rootModel, /*refreshCursor=*/
    true);
    updateDisplay();
// requestUpdate (UPDATE_WIDGETS | REFRESH_CURSOR);
}
Also used : RootModel(artisynth.core.workspace.RootModel) NumericProbeEditor(artisynth.core.gui.probeEditor.NumericProbeEditor) WayPointProbe(artisynth.core.probes.WayPointProbe) Probe(artisynth.core.probes.Probe) WayPointProbe(artisynth.core.probes.WayPointProbe) WayPoint(artisynth.core.probes.WayPoint)

Example 14 with WayPoint

use of artisynth.core.probes.WayPoint in project artisynth_core by artisynth.

the class InverseManager method replaceBreakpoint.

public static void replaceBreakpoint(RootModel root, double oldt, double newt) {
    WayPoint waypoint = root.getWayPoint(oldt);
    if (waypoint != null && waypoint.isBreakPoint()) {
        root.removeWayPoint(waypoint);
    }
    root.addBreakPoint(newt);
}
Also used : WayPoint(artisynth.core.probes.WayPoint)

Example 15 with WayPoint

use of artisynth.core.probes.WayPoint in project artisynth_core by artisynth.

the class RootModel method addBreakPoint.

public WayPoint addBreakPoint(double t) {
    if (t != 0) {
        WayPoint way = new WayPoint(t);
        way.setBreakPoint(true);
        addWayPoint(way);
        return way;
    } else {
        return null;
    }
}
Also used : WayPoint(artisynth.core.probes.WayPoint)

Aggregations

WayPoint (artisynth.core.probes.WayPoint)15 WayPointProbe (artisynth.core.probes.WayPointProbe)2 FemElement (artisynth.core.femmodels.FemElement)1 FemMarker (artisynth.core.femmodels.FemMarker)1 FemNode (artisynth.core.femmodels.FemNode)1 FemNode3d (artisynth.core.femmodels.FemNode3d)1 NumericProbeEditor (artisynth.core.gui.probeEditor.NumericProbeEditor)1 AxialSpring (artisynth.core.mechmodels.AxialSpring)1 MechModel (artisynth.core.mechmodels.MechModel)1 Particle (artisynth.core.mechmodels.Particle)1 RigidBody (artisynth.core.mechmodels.RigidBody)1 Probe (artisynth.core.probes.Probe)1 RootModel (artisynth.core.workspace.RootModel)1 Color (java.awt.Color)1 PolygonalMesh (maspack.geometry.PolygonalMesh)1 Point3d (maspack.matrix.Point3d)1 RigidTransform3d (maspack.matrix.RigidTransform3d)1 Renderable (maspack.render.Renderable)1 StringHolder (maspack.util.StringHolder)1 BooleanSelector (maspack.widgets.BooleanSelector)1