Package com.massifmaps.celestial
Class CelestialArc
java.lang.Object
com.massifmaps.celestial.CelestialObject
com.massifmaps.celestial.CelestialArc
A curve drawn on the sky.
Two ways to define one, and the first is what a daily path is:
- as a CIRCLE about an axis: every direction at a fixed angle from the axis. The daily
path of a distant body is exactly this - the axis is the rotation axis and the angle is
the complement of the declination - so an application draws it with an axis and one angle
rather than by sampling positions through the day.
- as an explicit list of directions, for a path that is not a circle: a satellite track, a
flight plan, a sampled trajectory.
The curve is generated once and drawn as a line strip; its width is in pixels, so it stays
legible at any field of view.
Two ways to define one, and the first is what a daily path is:
- as a CIRCLE about an axis: every direction at a fixed angle from the axis. The daily
path of a distant body is exactly this - the axis is the rotation axis and the angle is
the complement of the declination - so an application draws it with an axis and one angle
rather than by sampling positions through the day.
- as an explicit list of directions, for a path that is not a circle: a satellite track, a
flight plan, a sampled trajectory.
The curve is generated once and drawn as a line strip; its width is in pixels, so it stays
legible at any field of view.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatReturns the click radius of the curve.Returns the directions of an explicitly defined arc.floatReturns the angular radius of a circular arc.floatgetWidth()Returns the line width.booleanReturns whether the part of the curve below the horizon is drawn.booleanReturns true if the directions are read as separate segments rather than as a path.voidsetBelowHorizonVisible(boolean visible) Sets whether the part of the curve below the horizon is drawn.voidsetCircle(float axisAzimuth, float axisAltitude, float radius) Defines the arc as a circle about an axis.voidsetClickRadius(float degrees) Sets the click radius of the curve: how far, in degrees, a touch ray may miss the curve
and still hit it.voidsetDirections(DoubleVector directions) Defines the arc as an explicit list of directions, each an (azimuth, altitude) pair in
degrees.voidsetSegments(DoubleVector directions) Defines the arc as a list of SEPARATE segments: every pair of directions is one line and
consecutive pairs are not joined.voidsetWidth(float pixels) Sets the line width.Methods inherited from class com.massifmaps.celestial.CelestialObject
equals, getAltitude, getAzimuth, getColor, getDistance, getMetaDataElement, getPosition, getPositionAltitude, hashCode, isDirectionAnchored, isVisible, setColor, setDirection, setMetaDataElement, setPosition, setVisible
-
Constructor Details
-
CelestialArc
public CelestialArc()
-
-
Method Details
-
setCircle
public void setCircle(float axisAzimuth, float axisAltitude, float radius) Defines the arc as a circle about an axis.- Parameters:
axisAzimuth- The azimuth of the axis in degrees, clockwise from north.axisAltitude- The altitude of the axis in degrees above the horizon.radius- The angular radius in degrees: the angle between the axis and the curve.
-
setDirections
Defines the arc as an explicit list of directions, each an (azimuth, altitude) pair in
degrees. The curve runs through them in order and is not closed.- Parameters:
directions- The directions, as alternating azimuth and altitude values in degrees.
-
setSegments
Defines the arc as a list of SEPARATE segments: every pair of directions is one line and
consecutive pairs are not joined. A figure drawn between fixed directions is exactly
this - a set of lines that is not a single path - and it stays ONE object, so it is one
draw call and one clickable thing.- Parameters:
directions- The directions, as alternating azimuth and altitude values in degrees.
-
isSegmented
public boolean isSegmented()Returns true if the directions are read as separate segments rather than as a path.- Returns:
- True if the arc is a segment list.
-
getDirections
Returns the directions of an explicitly defined arc.- Returns:
- The directions, as alternating azimuth and altitude values in degrees.
-
getRadius
public float getRadius()Returns the angular radius of a circular arc.- Returns:
- The angular radius in degrees.
-
getWidth
public float getWidth()Returns the line width.- Returns:
- The width in pixels.
-
setWidth
public void setWidth(float pixels) Sets the line width.- Parameters:
pixels- The width in pixels.
-
isBelowHorizonVisible
public boolean isBelowHorizonVisible()Returns whether the part of the curve below the horizon is drawn.- Returns:
- True if the curve is drawn below the horizon.
-
setBelowHorizonVisible
public void setBelowHorizonVisible(boolean visible) Sets whether the part of the curve below the horizon is drawn. A daily path looks
right with this off - the arc then rises and sets like the body on it does.- Parameters:
visible- True to draw the curve below the horizon.
-
getClickRadius
public float getClickRadius()Returns the click radius of the curve.- Returns:
- The click radius in degrees.
-
setClickRadius
public void setClickRadius(float degrees) Sets the click radius of the curve: how far, in degrees, a touch ray may miss the curve
and still hit it. A curve is a line a pixel or two wide, so without this nothing could
ever be aimed at. 0 makes the curve unclickable. The default is 2 degrees.- Parameters:
degrees- The click radius in degrees.
-