org.opensourcephysics.cabrillo.tracker
Class DynamicParticleConvertible

java.lang.Object
  extended by org.opensourcephysics.cabrillo.tracker.TTrack
      extended by org.opensourcephysics.cabrillo.tracker.PointMass
          extended by org.opensourcephysics.cabrillo.tracker.ParticleModel
              extended by org.opensourcephysics.cabrillo.tracker.DynamicParticle
                  extended by org.opensourcephysics.cabrillo.tracker.DynamicParticleConvertible
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, Drawable, Interactive, Measurable, Trackable, ODE

public class DynamicParticleConvertible
extends DynamicParticle

DynamicParticle models a particle using Newton'w 2nd law.

Version:
1.0
Author:
W. Christian, D. Brown

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
TTrack.StepArray
 
Field Summary
static java.lang.String OMEGA
           
static java.lang.String THETA
           
 
Fields inherited from class org.opensourcephysics.cabrillo.tracker.DynamicParticle
frameStates, initialState, iterationsPerStep, points, system
 
Fields inherited from class org.opensourcephysics.cabrillo.tracker.ParticleModel
dt, endFrame, functionEditor, functionPanel, inspector, inspectorH, inspectorX, inspectorY, invalidWarningShown, lastValidFrame, loading, nan, prevX, prevY, refreshDerivsLater, refreshing, refreshStepsLater, showInspector, startFrame, startFrameUndefined, t0, time, timeFormat, tracePt, tracePtsPerStep, traceX, traceY, xLimit, yLimit
 
Fields inherited from class org.opensourcephysics.cabrillo.tracker.PointMass
aAtOrigin, accelerationMenu, accelFootprintMenu, aDeriv, aDerivSpill, aFootprint, aFootprints, aMap, aTailsToOriginItem, aTailsToPositionItem, autotrackItem, aVisibleItem, aVisibleOnAll, aVisMap, dataDescriptions, derivData, mass, massField, massLabel, mSeparator, params, positionFootprintMenu, trace, traceStroke, traceVisible, validData, vAtOrigin, vDeriv, vDerivSpill, velocFootprintMenu, velocityMenu, vFootprint, vFootprints, vMap, vTailsToOriginItem, vTailsToPositionItem, vVisibleItem, vVisibleOnAll, vVisMap, xData, xVisibleOnAll, xVisMap, yData
 
Fields inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
alphabet, angleField, angleLabel, angleSeparator, autoAdvance, autoAdvanceItem, autoTrackerMarking, circleFootprintListener, clearStepsItem, closeButton, colorItem, constantsLoadedFromXML, data, dataBuilderItem, dataFrames, dataProp, dataValid, defaultColors, defaultFootprint, deleteItem, description, descriptionItem, enabled, fieldBorder, footprint, footprintListener, footprintMenu, footprints, frc, hint, isMarking, keyFrames, labelFont, locked, lockedItem, magField, magLabel, magSeparator, markByDefault, markByDefaultItem, menu, name, nameAction, nameDialog, nameField, nameItem, panels, partName, point, preferredColumnOrder, properties, refreshDataLater, skippedStepWarningCheckbox, skippedStepWarningDialog, skippedStepWarningOn, skippedStepWarningTextpane, stepLabel, steps, stepSeparator, stepSizeWhenFirstMarked, stepValueLabel, support, targetIndex, tField, tLabel, toolbarPointComponents, toolbarTrackComponents, trackerPanel, trailLength, trailVisible, trailVisibleItem, tSeparator, tValueLabel, viewable, visible, visibleItem, worldBounds, xField, xLabel, xSeparator, xSpinner, yField, yLabel, ySeparator, ySpinner
 
Constructor Summary
DynamicParticleConvertible()
           
 
Method Summary
protected  UserFunction[] createPolarMainFunctions()
           
protected  double[] getCartesianState(double[] polarState)
          Converts a polar state {t, r, theta, vr, omega} to cartesian {t, x, y, vx, vy}, both relative to the origin.
static XML.ObjectLoader getLoader()
          Returns an ObjectLoader to save and load data for this class.
protected  java.awt.geom.Point2D[] getNextTracePositions()
          Gets the next trace position.
protected  double[] getPolarState(double[] state)
          Converts a cartesian state {t, x, y, vx, vy} to polar {t, r, theta, vr, omega}, both relative to the origin.
 void getRate(double[] state, double[] rate)
          Gets the rate {vx, ax, vy, ay, 1} based on a specified state {x, vx, y, vy, t}.
 double[] getState()
          Gets the current state {x, vx, y, vy, t}.
protected  void initializeFunctionPanel()
          Creates the ModelFunctionPanel.
protected  void initializeParameters(double[] input)
          Creates the initial position and velocity parameters by converting from cartesian to polar or vice-versa.
 void reset()
          Resets parameters, initializes solver and sets position(s) for start frame or first clip frame following.
protected  void resetState(double[] input)
          Resets the state variables based on the specified input.
 void setSolver(java.lang.Class<?> solverClass)
          Sets the ODESolver type.
 
Methods inherited from class org.opensourcephysics.cabrillo.tracker.DynamicParticle
delete, draw, getDisplayName, getEndFrame, getInitialState, getStartFrame, getXYForces, initializeInitEditor, refreshSteps, resetState, restoreState, saveState, setEndFrame, setStartFrame, setTracePositions
 
Methods inherited from class org.opensourcephysics.cabrillo.tracker.ParticleModel
cleanup, createMassAndTimeParameters, drawMe, findInteractive, getFunctionEditor, getInitEditor, getInitialValues, getInspector, getMass, getMenu, getModels, getParamEditor, getToolbarPointComponents, isAutoTrackable, isDependent, isModelsVisible, isStepComplete, propertyChange, refreshDerivsIfNeeded, refreshInitialTime, setAnglesInRadians, setLocked, setMass, setName, setTrackerPanel, trimSteps
 
Methods inherited from class org.opensourcephysics.cabrillo.tracker.PointMass
createGUI, createStep, deleteStep, erase, erase, getAArray, getAcceleration, getAccelerationFootprint, getAccelerationFootprints, getAccelerations, getDataDescription, getDefaultAutoTrackerIndex, getFootprint, getFootprintLength, getFootprints, getNextVisibleStep, getPreviousVisibleStep, getRotationData, getRotationData, getStep, getStepLength, getTargetDescription, getToolbarTrackComponents, getVArray, getVelocities, getVelocity, getVelocityFootprint, getVelocityFootprints, getWorldAcceleration, getWorldPosition, getWorldVelocity, isAcceleration, isAVisible, isLabelsVisible, isPosition, isPositionVisible, isStepVisible, isTraceVisible, isVelocity, isVVisible, refreshData, remark, remark, setAccelerationFootprint, setAccelerationFootprints, setAVisible, setAVisibleOnAll, setColor, setFootprint, setLabelsVisible, setPositionVisible, setPositionVisibleOnAll, setTraceVisible, setVelocityFootprint, setVelocityFootprints, setVVisible, setVVisibleOnAll, updateDerivatives, updateDerivatives, updateDerivatives, updateDerivatives, updateDerivatives, updateDerivatives
 
Methods inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
addFootprint, addPropertyChangeListener, addPropertyChangeListener, autoMarkAt, createWarningDialog, firePropertyChange, getColor, getData, getDataName, getDescription, getFootprint, getFootprints, getFrameForData, getMarkedPoint, getMarkingCursor, getMessage, getName, getPreferredDataOrder, getProperty, getPropertyNames, getSkippedStepWarningDialog, getStep, getSteps, getStepSizeWarningDialog, getTargetIndex, getTrailLength, getWorldBounds, getX, getXMax, getXMax, getXMin, getXMin, getY, getYMax, getYMax, getYMin, getYMin, isAutoAdvance, isAutoTrackable, isEmpty, isEnabled, isLocked, isMarkByDefault, isMeasured, isTrailVisible, isViewable, isVisible, refreshData, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, setAutoAdvance, setColorToDefault, setDefaultNameAndColor, setDescription, setEnabled, setFootprint, setFootprints, setFootprints, setMarkByDefault, setMarking, setProperty, setTargetIndex, setTargetIndex, setTargetIndex, setTrailLength, setTrailVisible, setViewable, setVisible, setX, setXY, setY, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

THETA

public static final java.lang.String THETA

OMEGA

public static final java.lang.String OMEGA
Constructor Detail

DynamicParticleConvertible

public DynamicParticleConvertible()
Method Detail

reset

public void reset()
Description copied from class: DynamicParticle
Resets parameters, initializes solver and sets position(s) for start frame or first clip frame following.

Overrides:
reset in class DynamicParticle

getState

public double[] getState()
Description copied from class: DynamicParticle
Gets the current state {x, vx, y, vy, t}.

Specified by:
getState in interface ODE
Overrides:
getState in class DynamicParticle
Returns:
the state

getRate

public void getRate(double[] state,
                    double[] rate)
Description copied from class: DynamicParticle
Gets the rate {vx, ax, vy, ay, 1} based on a specified state {x, vx, y, vy, t}.

Specified by:
getRate in interface ODE
Overrides:
getRate in class DynamicParticle
Parameters:
state - the state
rate - the rate of change of the state

setSolver

public void setSolver(java.lang.Class<?> solverClass)
Sets the ODESolver type.

Overrides:
setSolver in class DynamicParticle
Parameters:
solverClass - the solver class

initializeFunctionPanel

protected void initializeFunctionPanel()
Creates the ModelFunctionPanel.

Overrides:
initializeFunctionPanel in class DynamicParticle

createPolarMainFunctions

protected UserFunction[] createPolarMainFunctions()

getNextTracePositions

protected java.awt.geom.Point2D[] getNextTracePositions()
Gets the next trace position.

Overrides:
getNextTracePositions in class DynamicParticle
Returns:
an array of points at the trace positions

resetState

protected void resetState(double[] input)
Resets the state variables based on the specified input. Note: if polarInitialConditions is true, the input must be polar. If not true, the input must be cartesian.

Parameters:
input - double[] {t, x, y, vx, vy} or {t, r, theta, vr, omega}

initializeParameters

protected void initializeParameters(double[] input)
Creates the initial position and velocity parameters by converting from cartesian to polar or vice-versa. Note: if polarInitialConditions is true, the input must be cartesian. If not, the input must be polar.

Parameters:
input - double[] {t, x, y, vx, vy} or {t, r, theta, vr, omega}

getPolarState

protected double[] getPolarState(double[] state)
Converts a cartesian state {t, x, y, vx, vy} to polar {t, r, theta, vr, omega}, both relative to the origin.

Parameters:
state - the cartesian state
Returns:
the polar state

getCartesianState

protected double[] getCartesianState(double[] polarState)
Converts a polar state {t, r, theta, vr, omega} to cartesian {t, x, y, vx, vy}, both relative to the origin.

Parameters:
polarState - the polar state
Returns:
the cartesian state

getLoader

public static XML.ObjectLoader getLoader()
Returns an ObjectLoader to save and load data for this class.

Returns:
the object loader