public class StandardEllipse
extends java.lang.Object
PVector
s used to store point
coordinates. The ellipse parameters can be retrieved with the relevant accessor (getter)
methods, or the class can draw the ellipse directly with the draw()
method.
For convenience, the scale of the ellipse can be controlled with setScale()
and the coordinates of the endpoints of the axes can also be retrieved. Weighted or
unweighted points can be used by selecting setIsWeighted()
.Constructor and Description |
---|
StandardEllipse(java.util.Collection<processing.core.PVector> points)
Creates a standard ellipse from the given set of 2D Cartesian point values.
|
StandardEllipse(java.util.Collection<processing.core.PVector> points,
boolean isLatLong)
Creates a standard ellipse from the given set of 2D Cartesian or latitude/longitude point
values.
|
StandardEllipse(processing.core.PVector centre,
float major,
float minor,
float rotation)
Creates an ellipse with the given location, dimensions and rotation.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(processing.core.PApplet sketch)
Draws the ellipse.
|
void |
drawAxes(processing.core.PApplet sketch)
Draws the axes of the ellipse.
|
processing.core.PVector |
getCentre()
Reports the centre of the ellipse.
|
float |
getMajorAxis()
Reports the length of the major axis of the ellipse.
|
processing.core.PVector |
getMajorEndpoint1()
Reports the coordinates of one of the end points of the major axis.
|
processing.core.PVector |
getMajorEndpoint2()
Reports the coordinates of one of the end points of the major axis.
|
float |
getMinorAxis()
Reports the length of the minor axis of the ellipse.
|
processing.core.PVector |
getMinorEndpoint1()
Reports the coordinates of one of the end points of the minor axis.
|
processing.core.PVector |
getMinorEndpoint2()
Reports the coordinates of one of the end points of the minor axis.
|
float |
getRotation()
Reports the rotation of the ellipse.
|
float |
getScale()
Reports the scaling of the ellipse.
|
boolean |
isWeighted()
Reports whether or not weights are used in the calculation of the ellipse.
|
void |
setIsWeighted(boolean weighted)
Determines if the weighted or unweighted points are used to calculate the ellipse.
|
void |
setScale(float axisScale)
Sets the scaling of the ellipse.
|
public StandardEllipse(processing.core.PVector centre, float major, float minor, float rotation)
centre
- Centre of the ellipse.major
- Length of the major axis of the ellipse.minor
- Length of the minor axis of the ellipse.rotation
- Clockwise rotation of the axes (can be negative for anti-clockwise)public StandardEllipse(java.util.Collection<processing.core.PVector> points)
PVector
.points
- Collection of 2d point values.public StandardEllipse(java.util.Collection<processing.core.PVector> points, boolean isLatLong)
PVector
.points
- Collection of 2d point values. If lat/long angles are assumed to be in
decimal degrees in the longitude range of +-180 and latitude range of +-90
degrees.isLatLong
- If true, points are assumed to represent latitude/longitude bearings,
otherwise Cartesian points are assumed.public void setIsWeighted(boolean weighted)
weighted
- Uses weighted points if true.public boolean isWeighted()
public processing.core.PVector getCentre()
isWeighted()
is true
, otherwise it reports the unweighted mean centre.public float getMajorAxis()
isWeighted()
is true.public float getMinorAxis()
isWeighted()
is true.public float getRotation()
isWeighted()
is true.public processing.core.PVector getMajorEndpoint1()
getMajorEndpoint2()
. This will be
based on the weighted dispersion if isWeighted()
is true.public processing.core.PVector getMajorEndpoint2()
getMajorEndpoint1()
. This will be
based on the weighted dispersion if isWeighted()
is true.public processing.core.PVector getMinorEndpoint1()
getMinorEndpoint2()
. This will be
based on the weighted dispersion if isWeighted()
is true.public processing.core.PVector getMinorEndpoint2()
getMinorEndpoint1()
. This will be
based on the weighted dispersion if isWeighted()
is true.public float getScale()
public void setScale(float axisScale)
axisScale
- New scaling factor of the ellipse.public void draw(processing.core.PApplet sketch)
sketch
- in which to draw the ellipse.public void drawAxes(processing.core.PApplet sketch)
sketch
- in which to draw the axes.