Class DynamicParticle
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.cabrillo.tracker.TTrack
org.opensourcephysics.cabrillo.tracker.PointMass
org.opensourcephysics.cabrillo.tracker.ParticleModel
org.opensourcephysics.cabrillo.tracker.DynamicParticle
- All Implemented Interfaces:
PropertyChangeListener,EventListener,Drawable,Interactive,Measurable,Trackable,ODE
- Direct Known Subclasses:
DynamicParticlePolar
DynamicParticle models a particle using Newton's 2nd law.
- Version:
- 1.0
- Author:
- W. Christian, D. Brown
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.PointMass
PointMass.FrameDataNested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
TTrack.NameDialog, TTrack.StepArray, TTrack.TextLineLabel, TTrack.TrackDecimalField, TTrack.TrackNumberField -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected static final String[]protected NumberFieldprotected double[]protected booleanprotected intprotected org.opensourcephysics.cabrillo.tracker.DynamicParticle.ModelBoosterprotected ODESolverprotected double[]protected DynamicSystemprotected double[]Fields inherited from class org.opensourcephysics.cabrillo.tracker.ParticleModel
dt, endFrame, functionEditor, functionPanel, inspectorH, inspectorX, inspectorY, invalidWarningShown, loading, massParamListener, modelBuilder, modelBuilderItem, myPoint, nan, nCalc, points, prevX, prevY, refreshDerivsLater, refreshing, refreshStepsLater, showModelBuilder, stampItem, startFrame, startFrameUndefined, t0, time, timeFormat, timeParamListener, tracePt, tracePtsPerStep, traceX, traceY, useDefaultReferenceFrame, useDefaultRefFrameItem, xLimit, yLimitFields inherited from class org.opensourcephysics.cabrillo.tracker.PointMass
aAtOrigin, accelerationMenu, aColorItem, aDeriv, aDerivSpill, aFootprint, aFootprintMenu, aFootprints, algorithm, allVariables, aTailsToOriginItem, aTailsToPositionItem, autotrackItem, aVisibleItem, aVisibleOnAll, BOUNCE_DETECT, bounceDerivs, bounceDerivsSpill, dataVariables, derivData, drawsTrace, fieldVariables, FINITE_DIFF, FINITE_DIFF_VSPILL2, footprintNames, formatDescriptionMap, formatMap, formatVariables, isAutofill, isAutoKeyDown, labelsVisible, mass, massField, massLabel, MINIMUM_MASS, mSeparator, params, showfilledSteps, skippedSteps, trace, traceStroke, traceVisible, validData, vAtOrigin, vColorItem, vDeriv, vDerivSpill, vectorFields, velocityMenu, vFootprint, vFootprintMenu, vFootprints, vTailsToOriginItem, vTailsToPositionItem, vVisibleItem, vVisibleOnAll, xData, xVisibleOnAll, yDataFields inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
angleField, angleLabel, angleSeparator, attachmentNames, attachments, autoAdvance, autoAdvanceItem, autoTrackerMarking, circleFootprintListener, clearStepsItem, closeButton, colorItem, constantsLoadedFromXML, customNumberFormats, dataBuilderItem, dataDescriptions, dataFrames, dataProp, datasetManager, dataValid, defaultColors, defaultFootprint, deleteStepItem, deleteTrackItem, description, descriptionItem, enabled, fieldBorder, fixedItem, footprint, footprintListener, footprintMenu, footprints, formatAngleMouseListener, formatMouseListener, hint, HINT_STEP_ADDED_OR_REMOVED, HINT_STEPS_SELECTED, initialized, isMarking, keyFrames, labelFont, locked, lockedItem, magField, magLabel, magSeparator, markByDefault, markByDefaultItem, name, nameDialog, nameItem, nextID, NOMAP, NOMAPS, NOVARA, NOVARS, numberFields, partName, positionFields, preferredColumnOrder, properties, PROPERTY_TTRACK_COLOR, PROPERTY_TTRACK_DATA, PROPERTY_TTRACK_FOOTPRINT, PROPERTY_TTRACK_FORMAT, PROPERTY_TTRACK_LOCKED, PROPERTY_TTRACK_MASS, PROPERTY_TTRACK_MODELEND, PROPERTY_TTRACK_MODELSTART, PROPERTY_TTRACK_NAME, PROPERTY_TTRACK_STEP, PROPERTY_TTRACK_STEPS, PROPERTY_TTRACK_TEXTCOLUMN, PROPERTY_TTRACK_VISIBLE, refreshDataLater, skippedStepWarningCheckbox, skippedStepWarningDialog, skippedStepWarningOn, skippedStepWarningTextpane, stepLabel, steps, stepSeparator, stepSizeWhenFirstMarked, stepValueLabel, targetIndex, textColumnEntries, textColumnNames, tField, tframe, tLabel, toolbarPointComponents, toolbarTrackComponents, tp, trailLength, trailVisible, trailVisibleItem, tSeparator, ttype, tValueLabel, TYPE_CALIBRATION, TYPE_CIRCLEFITTER, TYPE_COORDAXES, TYPE_LINEPROFILE, TYPE_OFFSETORIGIN, TYPE_PERSPECTIVE, TYPE_POINTMASS, TYPE_PROTRACTOR, TYPE_RGBREGION, TYPE_TAPEMEASURE, TYPE_UNKNOWN, TYPE_VECTOR, viewable, visible, visibleItem, xField, xLabel, xSeparator, xSpinner, yField, yLabel, ySeparator, ySpinnerFields inherited from interface org.opensourcephysics.media.core.Trackable
PROPERTY_ADJUSTING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidboost()Sets the initial conditions to those of the booster at the current start frame.voiddelete()Deletes this particle.voiddispose()Disposes of resources when this track is deleted or cleared.voiddraw(DrawingPanel panel, Graphics _g) Overrides ParticleModel draw method.protected PointMassGets the booster point mass.protected double[]getBoostState(PointMass target, int frameNumber) Gets the cartesian state {x, vx, y, vy, t} of a PointMass at a specified frame number.protected String[]Gets a display name for this model.intGets the end frame for this model.double[]Gets the initial state {x, vx, y, vy, t}.static XML.ObjectLoaderReturns an ObjectLoader to save and load data for this class.protected booleanGets the next trace positions.voidgetRate(double[] state, double[] rate) Gets the rate {vx, ax, vy, ay, 1} based on a specified state {x, vx, y, vy, t}.intGets the start frame for this model.double[]getState()Gets the current state {x, vx, y, vy, t}.protected voidgetXYForces(double[] cartesianState, double[] ret) Gets the x- and y-forces based on a specified cartesian state {x, vx, y, vy, t}.protected voidCreates and initializes the ModelFunctionPanel.protected voidCreates the initial position and velocity parameters.protected booleanisBoostedBy(PointMass target) Determines if a specified point mass is a booster of this particle (or a booster of a booster, etc).voidResponds to property change events.protected voidrefreshSteps(String why) Refreshes step positions.voidreset()Resets parameters, initializes solver and sets position(s) for start frame or first clip frame following.protected voidResets the state variables {x, vx, y, vy, t}.protected booleanrestoreState(int frameNumber) Restores the state to a previously saved state, if any.protected voidsaveState(int frameNumber) Saves the current state.protected voidsetBooster(PointMass booster) Sets the booster point mass.voidsetEndFrame(int n) Sets the end frame for this model.voidSets the ODESolver type.voidsetStartFrame(int n) Sets the start frame for this model.protected voidsetTracePositions(double[] state) Sets the positions of the trace points based on a specified state.Methods inherited from class org.opensourcephysics.cabrillo.tracker.ParticleModel
createMassAndTimeParameters, createPositionStep, doStamp, drawMe, findInteractive, fireStepsChanged, getFunctionEditor, getInitEditor, getInitialValues, getLastValidFrame, getMass, getMenu, getModelBuilder, getModels, getParamEditor, getToolbarPointComponents, holdPainting, isAutoTrackable, isDependent, isModelsVisible, isStepComplete, isUseDefaultReferenceFrame, newTimeParam, refreshDerivsIfNeeded, refreshInitialTime, setAnglesInRadians, setLastValidFrame, setLocked, setMass, setName, setTrackerPanel, setUseDefaultReferenceFrame, trimStepsMethods inherited from class org.opensourcephysics.cabrillo.tracker.PointMass
autoMarkAt, createGUI, createMenuIfNecessary, createStep, deleteAutoTrackerStep, deleteStep, erase, erase, getAArray, getAcceleration, getAccelerationFootprint, getAccelerationFootprints, getAccelerations, getBaseType, getFootprint, getFootprintLength, getFootprints, getFormatDescMap, getFormatMap, getFormatVariables, getNextVisibleStep, getNumberFields, getNumberFieldsForStep, getPreviousVisibleStep, getRotationData, getRotationData, getStep, getStepLength, getTargetDescription, getToolbarTrackComponents, getUnfilledGapCount, getVarDimsImpl, getVArray, getVelocities, getVelocity, getVelocityFootprint, getVelocityFootprints, getWorldAcceleration, getWorldPosition, getWorldVelocity, hasGaps, isAcceleration, isAutofill, isAVisible, isLabelsVisible, isPosition, isPositionVisible, isStepVisible, isTraceVisible, isVelocity, isVVisible, markAllInterpolatedSteps, markInterpolatedSteps, markInterpolatedSteps, refreshData, remark, remark, setAccelerationColor, setAccelerationFootprint, setAccelerationFootprints, setAlgorithm, setAutoFill, setAVisible, setAVisibleOnAll, setColor, setFontLevel, setFootprint, setLabelsVisible, setMarking, setPositionVisible, setPositionVisibleOnAll, setTraceVisible, setVelocityColor, setVelocityFootprint, setVelocityFootprints, setVisible, setVVisible, setVVisibleOnAll, updateDerivatives, updateDerivatives, updateDerivatives, updateDerivatives, updateDerivativesMethods inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
addFixedItem, addFootprint, addListener, addListenerNCF, addPanelEvents, addStepListener, addTextColumn, assembleMenu, clearColumns, convertTextToDataColumn, createAllVariables, createWarningDialog, delete, finalize, getAllVariables, getAttachmentDescription, getAttachmentLength, getAttachments, getBaseTrackName, getBaseTypeInt, getColor, getCustomFormatPatterns, getData, getData, getDataDescription, getDataName, getDefaultFormatPatterns, getDefaultFormatPatterns, getDescription, getFootprint, getFootprintName, getFootprints, getFormatPatterns, getFrameForData, getIcon, getID, getMarkedPoint, getMarkingCursor, getMenuItems, getMessage, getName, getName, getNameDialog, getPlotViews, getPreferredDataOrder, getProperty, getPropertyNames, getSkippedStepWarningDialog, getStep, getSteps, getStepSizeWarningDialog, getTableViews, getTargetIndex, getTextColumnEntry, getTextColumnNames, getTrack, getTrailLength, getValues, getVarFormatPattern, getVariableDimensions, getVariablesFromFormatterDisplayName, getX, getXMax, getXMin, getY, getYMax, getYMin, initialize, invalidateData, isAttached, isAutoAdvance, isAutoTrackable, isDataValid, isEmpty, isEnabled, isFullyAttached, isLocked, isMarkByDefault, isMarking, isMeasured, isTrailVisible, isViewable, isVisible, loadAttachmentsFromNames, refreshAttachments, refreshAttachmentsLater, refreshData, refreshDecimalSeparators, removeActiveTrack, removeDeleteTrackItem, removeListener, removeListenerNCF, removePanelEvents, removeStepListener, removeTextColumn, renameTextColumn, repaint, repaint, repaintAll, repaintStep, restorePatterns, savePatterns, setActive, setAutoAdvance, setColorToDefault, setDefaultNameAndColor, setDescription, setEnabled, setFixedPosition, setFootprint, setFootprints, setFootprints, setFormatPattern, setInitialFormatPatterns, setMarkByDefault, setProperty, setTargetIndex, setTargetIndex, setTargetIndex, setTextColumnEntry, setTrailLength, setTrailVisible, setViewable, setX, setXY, setY, showAnglePopup, showFormatPopup, toString, updateListenerVisibleMethods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
-
Field Details
-
modelBooster
protected org.opensourcephysics.cabrillo.tracker.DynamicParticle.ModelBooster modelBooster -
cellNumberField
-
inSystem
protected boolean inSystem -
boosterName
-
cartVars
-
state
protected double[] state -
initialState
protected double[] initialState -
solver
-
iterationsPerStep
protected int iterationsPerStep -
system
-
frameStates
-
temp
protected double[] temp
-
-
Constructor Details
-
DynamicParticle
public DynamicParticle()Constructor
-
-
Method Details
-
getBoostVars
-
draw
Overrides ParticleModel draw method.- Specified by:
drawin interfaceDrawable- Overrides:
drawin classParticleModel- Parameters:
panel- the drawing panel requesting the drawing_g- the graphics context on which to draw
-
getDisplayName
Gets a display name for this model.- Overrides:
getDisplayNamein classParticleModel- Returns:
- the display name
-
delete
public void delete()Deletes this particle. Overrides ParticleModel method to warn user if this is part of a DynamicSystem.- Overrides:
deletein classParticleModel
-
refreshSteps
Refreshes step positions.- Overrides:
refreshStepsin classParticleModel
-
reset
public void reset()Resets parameters, initializes solver and sets position(s) for start frame or first clip frame following.- Specified by:
resetin classParticleModel
-
getState
public double[] getState()Gets the current state {x, vx, y, vy, t}. -
saveState
protected void saveState(int frameNumber) Saves the current state.- Overrides:
saveStatein classParticleModel- Parameters:
frameNumber- the frame number
-
restoreState
protected boolean restoreState(int frameNumber) Restores the state to a previously saved state, if any.- Overrides:
restoreStatein classParticleModel- Parameters:
frameNumber- the frame number- Returns:
- true if state successfully restored
-
getRate
public void getRate(double[] state, double[] rate) Gets the rate {vx, ax, vy, ay, 1} based on a specified state {x, vx, y, vy, t}. -
setSolver
Sets the ODESolver type.- Parameters:
solverClass- the solver class
-
getInitialState
public double[] getInitialState()Gets the initial state {x, vx, y, vy, t}.- Returns:
- the initial state
-
getStartFrame
public int getStartFrame()Gets the start frame for this model. Overrides ParticleModel method.- Overrides:
getStartFramein classParticleModel- Returns:
- the start frame
-
setStartFrame
public void setStartFrame(int n) Sets the start frame for this model. Overrides ParticleModel method.- Overrides:
setStartFramein classParticleModel- Parameters:
n- the desired start frame
-
getEndFrame
public int getEndFrame()Gets the end frame for this model. Overrides ParticleModel method.- Overrides:
getEndFramein classParticleModel- Returns:
- the end frame
-
setEndFrame
public void setEndFrame(int n) Sets the end frame for this model. Overrides ParticleModel method.- Overrides:
setEndFramein classParticleModel- Parameters:
n- the desired end frame
-
propertyChange
Description copied from class:ParticleModelResponds to property change events.- Specified by:
propertyChangein interfacePropertyChangeListener- Overrides:
propertyChangein classParticleModel- Parameters:
e- the property change event
-
getXYForces
protected void getXYForces(double[] cartesianState, double[] ret) Gets the x- and y-forces based on a specified cartesian state {x, vx, y, vy, t}.- Parameters:
cartesianState- the stateret- the forces [fx, fy]
-
resetState
protected void resetState()Resets the state variables {x, vx, y, vy, t}. -
initializeInitEditor
protected void initializeInitEditor()Creates the initial position and velocity parameters. -
initializeFunctionPanel
protected void initializeFunctionPanel()Creates and initializes the ModelFunctionPanel.- Specified by:
initializeFunctionPanelin classParticleModel
-
getNextTracePositions
protected boolean getNextTracePositions()Gets the next trace positions.- Returns:
- an array of points at the trace positions
-
setTracePositions
protected void setTracePositions(double[] state) Sets the positions of the trace points based on a specified state.- Parameters:
state- the state
-
getBoostState
Gets the cartesian state {x, vx, y, vy, t} of a PointMass at a specified frame number.- Parameters:
target- the PointMassframeNumber- the frame number- Returns:
- the state, or null if the point mass is not marked at the frame number
-
getBooster
Gets the booster point mass.- Returns:
- the booster
-
setBooster
Sets the booster point mass.- Parameters:
booster- the new booster (may be null)
-
isBoostedBy
Determines if a specified point mass is a booster of this particle (or a booster of a booster, etc).- Parameters:
target- a point mass- Returns:
- true if the target is a booster
-
boost
protected void boost()Sets the initial conditions to those of the booster at the current start frame. -
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-
dispose
public void dispose()Description copied from class:TTrackDisposes of resources when this track is deleted or cleared.- Overrides:
disposein classParticleModel
-