Class CircleFitterStep
java.lang.Object
org.opensourcephysics.cabrillo.tracker.Step
org.opensourcephysics.cabrillo.tracker.CircleFitterStep
- All Implemented Interfaces:
Cloneable
This is a Step for a CircleFitter. It is used for measuring and finding
centers of circles.
- Author:
- Douglas Brown
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.opensourcephysics.cabrillo.tracker.CircleFitterStep.CenterPoint
protected CircleFitter
protected org.opensourcephysics.cabrillo.tracker.CircleFitterStep.DataPoint[][]
protected static boolean
protected TPoint
protected static TPoint
protected static TPoint
protected double
protected org.opensourcephysics.cabrillo.tracker.MultiShape
protected static AffineTransform
Fields inherited from class org.opensourcephysics.cabrillo.tracker.Step
dataVisible, defaultIndex, footprint, format, hitRect, n, panelMarks, points, screenPoints, selectionShape, selectionStroke, trackID, type, TYPE_ACCELERATION, TYPE_UNKNOWN, TYPE_VELOCITY, valid
-
Constructor Summary
ConstructorsConstructorDescriptionCircleFitterStep
(CircleFitter track, int n) Constructs an empty CircleFitterStep. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataPoint
(org.opensourcephysics.cabrillo.tracker.CircleFitterStep.DataPoint p, boolean refreshAndPostEdit) Adds a data point at the end of the array.clone()
Clones this Step.void
copy
(CircleFitterStep step) Copies data points from another step, then refreshes the circle.protected void
dispose()
Disposes of this step.void
draw
(DrawingPanel panel, Graphics _g) Draws this step.findInteractive
(DrawingPanel panel, int xpix, int ypix) Finds the Interactive located at the specified pixel position.org.opensourcephysics.cabrillo.tracker.CircleFitterStep.DataPoint
getDataPoint
(int column, int row) Gets a data point.Gets the default point.static int
Gets the step length.static XML.ObjectLoader
Returns an ObjectLoader to save and load data for this class.protected Mark
getMark
(TrackerPanel trackerPanel) Gets the mark for the specified panel.ArrayList<org.opensourcephysics.cabrillo.tracker.CircleFitterStep.DataPoint>
Gets the valid data points.Returns the circle center coordinates in world units.double
Returns the circle radius in world units.boolean
Returns true if the circle is valid (ie if at least 3 data points have been successfuly fit).void
Refreshes the circle based on the current data points.void
removeDataPoint
(org.opensourcephysics.cabrillo.tracker.CircleFitterStep.DataPoint p, boolean postUndoableEdit, boolean fireEvents) Removes a data point from the user-marked array.void
setDataPoint
(org.opensourcephysics.cabrillo.tracker.CircleFitterStep.DataPoint p, int column, int row, boolean refreshAndPostEdit, boolean reduceArrayLengthIfNull) Sets the data point at a specified column and row.toString()
Returns a String describing this.boolean
trimAttachedPointsToLength
(int len) Trims the attached points array to a specified length.Methods inherited from class org.opensourcephysics.cabrillo.tracker.Step
erase, erase, getFrameNumber, getPointIndex, getPoints, getTrack, remark, remark, repaint, repaint, setDefaultPointIndex, setFootprint, setHitRectCenter
-
Field Details
-
transform
-
endPoint1
-
endPoint2
-
doRefresh
protected static boolean doRefresh -
circleFitter
-
dataPoints
protected org.opensourcephysics.cabrillo.tracker.CircleFitterStep.DataPoint[][] dataPoints -
center
protected org.opensourcephysics.cabrillo.tracker.CircleFitterStep.CenterPoint center -
edge
-
radius
protected double radius -
panelCircleHitShapes
-
panelCenterHitShapes
-
panelPointHitShapes
-
selectedShape
protected org.opensourcephysics.cabrillo.tracker.MultiShape selectedShape
-
-
Constructor Details
-
CircleFitterStep
Constructs an empty CircleFitterStep.- Parameters:
track
- the trackn
- the frame number
-
-
Method Details
-
setDataPoint
public void setDataPoint(org.opensourcephysics.cabrillo.tracker.CircleFitterStep.DataPoint p, int column, int row, boolean refreshAndPostEdit, boolean reduceArrayLengthIfNull) Sets the data point at a specified column and row. Replaces existing element, adds null elements if needed. Data is stored in array element DataPoints[col][row]- Parameters:
p
- the data point (may be null)column
- the column indexrow
- the row indexrefreshAndPostEdit
- true to refresh circle, fire event and post undo editreduceArrayLengthIfNull
- true to eliminate null elements
-
addDataPoint
public void addDataPoint(org.opensourcephysics.cabrillo.tracker.CircleFitterStep.DataPoint p, boolean refreshAndPostEdit) Adds a data point at the end of the array.- Parameters:
p
- the data pointrefreshAndPostEdit
- true to refresh circle, fire event and post undo edit
-
removeDataPoint
public void removeDataPoint(org.opensourcephysics.cabrillo.tracker.CircleFitterStep.DataPoint p, boolean postUndoableEdit, boolean fireEvents) Removes a data point from the user-marked array.- Parameters:
p
- the point to removepostUndoableEdit
- true to post an undoable editfireEvents
- true to fire property change events
-
getDataPoint
public org.opensourcephysics.cabrillo.tracker.CircleFitterStep.DataPoint getDataPoint(int column, int row) Gets a data point.- Parameters:
column
- the column: 0=marked points, 1=attached pointsrow
- the row- Returns:
- the DataPoint, or null if not found
-
getValidDataPoints
public ArrayList<org.opensourcephysics.cabrillo.tracker.CircleFitterStep.DataPoint> getValidDataPoints()Gets the valid data points. A point is valid if non-null. This return points from all columns, with user-marked points (column 0) first. -
trimAttachedPointsToLength
public boolean trimAttachedPointsToLength(int len) Trims the attached points array to a specified length.- Parameters:
len
- the trimmed length- Returns:
- true if any non-null points were trimmed
-
getDefaultPoint
Description copied from class:Step
Gets the default point. The default point is the point initially selected when the step is created.- Overrides:
getDefaultPoint
in classStep
- Returns:
- the default TPoint
-
findInteractive
Description copied from class:Step
Finds the Interactive located at the specified pixel position.- Overrides:
findInteractive
in classStep
- Parameters:
panel
- the drawing panelxpix
- the x pixel positionypix
- the y pixel position- Returns:
- the TPoint that is hit, or null
-
draw
Description copied from class:Step
Draws this step. -
getMark
Description copied from class:Step
Gets the mark for the specified panel. -
getWorldRadius
public double getWorldRadius()Returns the circle radius in world units.- Returns:
- the radius in world units
-
getWorldCenter
Returns the circle center coordinates in world units.- Returns:
- the center point in world units
-
isValidCircle
public boolean isValidCircle()Returns true if the circle is valid (ie if at least 3 data points have been successfuly fit).- Returns:
- true if valid
-
refreshCircle
public void refreshCircle()Refreshes the circle based on the current data points. -
clone
Clones this Step. -
copy
Copies data points from another step, then refreshes the circle.- Parameters:
step
- the step to copy
-
toString
Returns a String describing this. -
getLength
public static int getLength()Gets the step length.- Returns:
- the length of the points array
-
dispose
protected void dispose()Description copied from class:Step
Disposes of this step. -
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-