Package org.opensourcephysics.display
Class TrailBezier
java.lang.Object
org.opensourcephysics.display.AbstractTrail
org.opensourcephysics.display.TrailBezier
- All Implemented Interfaces:
Drawable,Measurable
- Direct Known Subclasses:
TrailSmart
TrailBezier defines a trail of points connected by a Bezier spline. This object is often used to
show the path of a moving object.
- Version:
- 1.0
- Author:
- Wolfgang Christian
-
Field Summary
Fields inherited from class org.opensourcephysics.display.AbstractTrail
closed, color, drawingStroke, enableMeasure, numpts, xmax, xmaxLogscale, xmin, xminLogscale, ymax, ymaxLogscale, ymin, yminLogscale -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPoint(double x, double y) Adds a point to the trail.voidclear()Clears all points from the trail.voidCloses the trail by connecting the first point to the last point.voiddraw(DrawingPanel panel, Graphics g) Draw the trail on the panel.static XML.ObjectLoaderReturns the XML.ObjectLoader for this class.doublegetXMax()Gets the maximum x value in the trail.doublegetXMin()Gets the minimum x value in the trail.doublegetYMax()Gets the maximum y value in the trail.doublegetYMin()Gets the minimum y value in the trail.booleanDetermines if this trail scales the drawing panel.voidsetSlack(double slack) Sets the slack which determines the position of the control points.Methods inherited from class org.opensourcephysics.display.AbstractTrail
getNumberOfPoints, getStroke, getXMaxLogscale, getXMinLogscale, getYMaxLogscale, getYMinLogscale, setDashedStroke, setMeasured, setStrokeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensourcephysics.display.Drawable
isInteractive
-
Constructor Details
-
TrailBezier
public TrailBezier()
-
-
Method Details
-
addPoint
public void addPoint(double x, double y) Adds a point to the trail.- Specified by:
addPointin classAbstractTrail- Parameters:
x- doubley- double
-
setSlack
public void setSlack(double slack) Sets the slack which determines the position of the control points.- Parameters:
slack- double
-
closeTrail
public void closeTrail()Closes the trail by connecting the first point to the last point.- Specified by:
closeTrailin classAbstractTrail
-
clear
public void clear()Clears all points from the trail.- Specified by:
clearin classAbstractTrail
-
draw
Draw the trail on the panel.- Parameters:
g-
-
getLoader
Returns the XML.ObjectLoader for this class.- Returns:
- the object loader
-
isMeasured
public boolean isMeasured()Determines if this trail scales the drawing panel.- Specified by:
isMeasuredin interfaceMeasurable- Overrides:
isMeasuredin classAbstractTrail- Returns:
- boolean
-
getXMin
public double getXMin()Gets the minimum x value in the trail.- Specified by:
getXMinin interfaceMeasurable- Overrides:
getXMinin classAbstractTrail- Returns:
- double
-
getXMax
public double getXMax()Gets the maximum x value in the trail.- Specified by:
getXMaxin interfaceMeasurable- Overrides:
getXMaxin classAbstractTrail- Returns:
- double
-
getYMin
public double getYMin()Gets the minimum y value in the trail.- Specified by:
getYMinin interfaceMeasurable- Overrides:
getYMinin classAbstractTrail- Returns:
- double
-
getYMax
public double getYMax()Gets the maximum y value in the trail.- Specified by:
getYMaxin interfaceMeasurable- Overrides:
getYMaxin classAbstractTrail- Returns:
- double
-