Class ParticleModel
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.cabrillo.tracker.TTrack
org.opensourcephysics.cabrillo.tracker.PointMass
org.opensourcephysics.cabrillo.tracker.ParticleModel
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
,Drawable
,Interactive
,Measurable
,Trackable
- Direct Known Subclasses:
AnalyticParticle
,DynamicParticle
,ParticleDataTrack
An abstract class representing a point mass for which positions are
determined by a model. Subclassed as AnalyticParticle,
DynamicParticle, and ParticleDataTrack.
- Author:
- Douglas Brown
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.PointMass
PointMass.FrameData
Nested 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 double
protected int
protected UserFunctionEditor
protected ModelFunctionPanel
protected int
protected int
protected int
protected boolean
protected static boolean
protected PropertyChangeListener
protected ModelBuilder
protected JMenuItem
protected int
protected static Point2D.Double
protected static int
protected Point2D.Double[]
protected double[]
protected double[]
protected boolean
protected boolean
protected boolean
protected boolean
protected JMenuItem
protected int
protected boolean
protected double
protected double
protected static NumberFormat
protected PropertyChangeListener
protected TPoint
protected static int
protected double[]
protected double[]
protected boolean
protected JMenuItem
protected static double
protected static double
Fields 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, yData
Fields 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, ySpinner
Fields inherited from interface org.opensourcephysics.media.core.Trackable
PROPERTY_ADJUSTING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
This adds the mass and initial time parameters to the function panel.protected PositionStep
createPositionStep
(PointMass track, int n, double x, double y) Creates a position step with image coordinates.void
delete()
Removes this particle from all panels that draw it.void
dispose()
Disposes of resources when this track is deleted or cleared.protected void
doStamp()
void
draw
(DrawingPanel panel, Graphics _g) Overrides PointMass draw method.void
drawMe
(DrawingPanel panel, Graphics _g) Draws this without refreshing steps.findInteractive
(DrawingPanel panel, int xpix, int ypix) Overrides PointMass findInteractive method.void
Gets a display name for this model.int
Gets the end frame for this model.Gets the function editor.Gets the initial value editor.double[]
Gets the initial values.protected int
static XML.ObjectLoader
Returns an ObjectLoader to save and load data for this class.double
getMass()
Gets the mass.getMenu
(TrackerPanel trackerPanel, JMenu menu0) Returns a menu with items that control this track.Gets the model builder.protected ParticleModel[]
Gets the particle models associated with this model.Gets the parameter editor.int
Gets the start frame for this model.getToolbarPointComponents
(TrackerPanel trackerPanel, TPoint point) Overrides TTrack getToolbarPointComponents method.protected void
holdPainting
(boolean b) protected abstract void
Initializes the ModelFunctionPanel.protected boolean
Determines if any point in this track is autotrackable.boolean
Overrides TTrack method to report that this is a dependent track.protected boolean
boolean
isStepComplete
(int n) Overrides TTrack isStepComplete method.protected boolean
Determines if the default reference frame is used to determine step positions.static FunctionEditor.FObject
void
Responds to property change events.protected void
Refreshes the derivatives if they have not been refreshed in the refreshSteps() method (ie if the variable "refreshDerivsLater" is false).protected void
Refreshes initial time parameter for this model.protected void
refreshSteps
(String why) Refreshes step positions.protected abstract void
reset()
Resets model parameters and sets position(s) for start frame.protected boolean
restoreState
(int frameNumber) Restores the state to a previously saved state, if any.protected void
saveState
(int frameNumber) Saves the current state.protected void
setAnglesInRadians
(boolean radians) Sets the display format for angles.void
setEndFrame
(int n) Sets the end frame for this model.protected void
setLastValidFrame
(int i) void
setLocked
(boolean locked) Overrides TTrack setLocked method.void
setMass
(double mass) Sets the mass.void
Sets the name.void
setStartFrame
(int n) Sets the start frame for this model.void
setTrackerPanel
(TrackerPanel panel) Adds events for TrackerPanel.void
setUseDefaultReferenceFrame
(boolean useDefault) Sets the useDefaultReferenceFrame flag.protected void
Trims all steps after endFrame.Methods 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, updateDerivatives
Methods 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, updateListenerVisible
Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
-
Field Details
-
tracePtsPerStep
protected static int tracePtsPerStep -
loading
protected static boolean loading -
nan
-
xLimit
protected static double xLimit -
yLimit
protected static double yLimit -
timeFormat
-
modelBuilder
-
functionPanel
-
functionEditor
-
inspectorX
protected int inspectorX -
inspectorY
protected int inspectorY -
inspectorH
protected int inspectorH -
showModelBuilder
protected boolean showModelBuilder -
refreshing
protected boolean refreshing -
traceX
protected double[] traceX -
traceY
protected double[] traceY -
prevX
protected double[] prevX -
prevY
protected double[] prevY -
tracePt
-
t0
protected double t0 -
dt
protected double dt -
time
protected double time -
refreshDerivsLater
protected boolean refreshDerivsLater -
refreshStepsLater
protected boolean refreshStepsLater -
invalidWarningShown
protected boolean invalidWarningShown -
startFrameUndefined
protected boolean startFrameUndefined -
startFrame
protected int startFrame -
endFrame
protected int endFrame -
useDefaultReferenceFrame
protected boolean useDefaultReferenceFrame -
modelBuilderItem
-
useDefaultRefFrameItem
-
stampItem
-
massParamListener
-
timeParamListener
-
points
-
myPoint
protected int myPoint -
nCalc
protected static int nCalc
-
-
Constructor Details
-
ParticleModel
public ParticleModel()Constructs a ParticleModel.
-
-
Method Details
-
initializeFunctionPanel
protected abstract void initializeFunctionPanel()Initializes the ModelFunctionPanel. -
setLastValidFrame
protected void setLastValidFrame(int i) -
getLastValidFrame
protected int getLastValidFrame() -
draw
Overrides PointMass draw method. -
drawMe
Draws this without refreshing steps.- Parameters:
panel
- the drawing panel requesting the drawing_g
- the graphics context on which to draw
-
delete
public void delete()Removes this particle from all panels that draw it. Overrides TTrack method. -
setTrackerPanel
Description copied from class:PointMass
Adds events for TrackerPanel.- Overrides:
setTrackerPanel
in classPointMass
- Parameters:
panel
- the new TrackerPanel
-
propertyChange
Responds to property change events.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Overrides:
propertyChange
in classPointMass
- Parameters:
e
- the property change event
-
getMass
public double getMass()Gets the mass. Overrides PointMass method. -
setMass
public void setMass(double mass) Sets the mass. Overrides PointMass method. -
setName
Sets the name. Overrides TTrack method. -
getDisplayName
Gets a display name for this model. The default is the model name.- Returns:
- the display name
-
isAutoTrackable
protected boolean isAutoTrackable()Determines if any point in this track is autotrackable.- Overrides:
isAutoTrackable
in classPointMass
- Returns:
- true if autotrackable
-
findInteractive
Overrides PointMass findInteractive method.- Specified by:
findInteractive
in interfaceInteractive
- Overrides:
findInteractive
in classPointMass
- Parameters:
panel
- the drawing panelxpix
- the x pixel position on the panelypix
- the y pixel position on the panel- Returns:
- the first step or motion vector that is hit
-
setLocked
public void setLocked(boolean locked) Overrides TTrack setLocked method. ParticleModel is always locked. -
isDependent
public boolean isDependent()Overrides TTrack method to report that this is a dependent track.- Overrides:
isDependent
in classTTrack
- Returns:
true
if this track is dependent
-
isStepComplete
public boolean isStepComplete(int n) Overrides TTrack isStepComplete method. Always returns true.- Overrides:
isStepComplete
in classTTrack
- Parameters:
n
- the frame number- Returns:
true
always since gets data from model
-
getMenu
Returns a menu with items that control this track. -
doStamp
protected void doStamp() -
getToolbarPointComponents
Overrides TTrack getToolbarPointComponents method.- Overrides:
getToolbarPointComponents
in classPointMass
- Parameters:
trackerPanel
- the tracker panelpoint
- the TPoint- Returns:
- a list of components
-
setStartFrame
public void setStartFrame(int n) Sets the start frame for this model. Also sets the initial time to the video clip time at the start frame.- Parameters:
n
- the desired start frame
-
getStartFrame
public int getStartFrame()Gets the start frame for this model.- Returns:
- the start frame
-
setEndFrame
public void setEndFrame(int n) Sets the end frame for this model.- Parameters:
n
- the desired end frame
-
getEndFrame
public int getEndFrame()Gets the end frame for this model.- Returns:
- the end frame
-
setAnglesInRadians
protected void setAnglesInRadians(boolean radians) Sets the display format for angles.- Overrides:
setAnglesInRadians
in classPointMass
- Parameters:
radians
-true
for radians, false for degrees
-
reset
protected abstract void reset()Resets model parameters and sets position(s) for start frame. Most of the work in this method must be done by subclasses. -
getModels
Gets the particle models associated with this model. By default this model is returned.- Returns:
- array of particle models associated with this model
-
isModelsVisible
protected boolean isModelsVisible() -
refreshInitialTime
protected void refreshInitialTime()Refreshes initial time parameter for this model. -
refreshSteps
Refreshes step positions. -
holdPainting
protected void holdPainting(boolean b) -
fireStepsChanged
public void fireStepsChanged()- Overrides:
fireStepsChanged
in classTTrack
-
createPositionStep
Creates a position step with image coordinates. Overridden by ParticleDataTrack.- Parameters:
track
- the PointMass trackn
- the frame numberx
- the x coordinatey
- the y coordinate- Returns:
- the PositionStep
-
refreshDerivsIfNeeded
protected void refreshDerivsIfNeeded()Refreshes the derivatives if they have not been refreshed in the refreshSteps() method (ie if the variable "refreshDerivsLater" is false). -
trimSteps
protected void trimSteps()Trims all steps after endFrame. -
saveState
protected void saveState(int frameNumber) Saves the current state. Does nothing by default, but DynamicParticle overrides.- Parameters:
frameNumber
- the frame number
-
restoreState
protected boolean restoreState(int frameNumber) Restores the state to a previously saved state, if any. Does nothing by default, but DynamicParticle overrides.- Parameters:
frameNumber
- the frame number- Returns:
- true if state successfully restored
-
isUseDefaultReferenceFrame
protected boolean isUseDefaultReferenceFrame()Determines if the default reference frame is used to determine step positions.- Returns:
- true if the default reference frame is used
-
setUseDefaultReferenceFrame
public void setUseDefaultReferenceFrame(boolean useDefault) Sets the useDefaultReferenceFrame flag.- Parameters:
useDefault
- true to use the default reference frame
-
getModelBuilder
Gets the model builder.- Returns:
- the model builder
-
createMassAndTimeParameters
protected void createMassAndTimeParameters()This adds the mass and initial time parameters to the function panel. -
getInitialValues
public double[] getInitialValues()Gets the initial values.- Returns:
- initial values
-
getParamEditor
Gets the parameter editor.- Returns:
- ParamEditor
-
getInitEditor
Gets the initial value editor.- Returns:
- the editor
-
getFunctionEditor
Gets the function editor.- Returns:
- UserFunctionEditor
-
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-
dispose
public void dispose()Description copied from class:TTrack
Disposes of resources when this track is deleted or cleared. -
newTimeParam
-