Package uk.ac.starlink.ttools.plot2.geom
Class SkyviewProjection
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.geom.SkyviewProjection
-
- All Implemented Interfaces:
Projection
- Direct Known Subclasses:
SinProjection
public class SkyviewProjection extends java.lang.Object implements Projection
Projection implementation based on classes from the Skyview package.- Since:
- 21 Feb 2013
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description static SkyviewProjection
AIT
Aitoff projection.static SkyviewProjection
CAR1
Cartesian projection.static SkyviewProjection
TAN
Gnomonic projection.
-
Constructor Summary
Constructors Constructor Description SkyviewProjection(skyview.geometry.Projecter projecter, java.awt.Shape shape, boolean isContinuous)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SkyAspect
createAspect(boolean reflect, double[] r3, double radiusRad, Range[] ranges)
Creates a SkyAspect from configuration information.static SkyviewProjection
createProjection(skyview.geometry.Projecter projecter, boolean isContinuous)
Factory method that knows shapes for some projections.double[]
cursorRotate(double[] rotmat, java.awt.geom.Point2D.Double pos0, java.awt.geom.Point2D.Double pos1)
Returns null - rotation not implemented.SkyFov
getFov(SkySurface surf)
Returns the field of view represented by this aspect.java.lang.String
getProjectionDescription()
Returns a short description of the projection.java.lang.String
getProjectionName()
Returns the projection name.java.awt.Shape
getProjectionShape()
Returns the shape which encloses all the plane positions to which legal sky coordinates can be projected.skyview.geometry.Projecter
getSkyviewProjecter()
Returns the projecter object used by this SkyviewProjection.boolean
isContinuous()
Indicates whether this projection is known to be continous over its whole range.boolean
project(double rx, double ry, double rz, java.awt.geom.Point2D.Double pos)
Transforms a sky position to a plane position.double[]
projRotate(double[] rotmat, java.awt.geom.Point2D.Double pos0, java.awt.geom.Point2D.Double pos1)
Returns null - rotation not implemented.boolean
unproject(java.awt.geom.Point2D.Double pos, double[] r3)
Transforms a plane position to a sky position.boolean
useRanges(boolean reflect, double[] r3, double radiusRad)
Returns false - ranging not used.
-
-
-
Field Detail
-
AIT
public static final SkyviewProjection AIT
Aitoff projection.
-
CAR1
public static final SkyviewProjection CAR1
Cartesian projection.
-
TAN
public static final SkyviewProjection TAN
Gnomonic projection.
-
-
Constructor Detail
-
SkyviewProjection
public SkyviewProjection(skyview.geometry.Projecter projecter, java.awt.Shape shape, boolean isContinuous)
Constructor. You have to tell it whether the projection is known to be continuous. In more recent SkyView releases, I think this can be determined programmatically from the Projecter instance by using the function!projecter.straddleable()
.- Parameters:
projecter
- projecter objectshape
- shape of the sky in this projectionisContinuous
- whether projection is known to be continuous
-
-
Method Detail
-
getProjectionName
public java.lang.String getProjectionName()
Description copied from interface:Projection
Returns the projection name.- Specified by:
getProjectionName
in interfaceProjection
- Returns:
- user-directed projection name
-
getProjectionDescription
public java.lang.String getProjectionDescription()
Description copied from interface:Projection
Returns a short description of the projection. return projection description- Specified by:
getProjectionDescription
in interfaceProjection
-
getProjectionShape
public java.awt.Shape getProjectionShape()
Description copied from interface:Projection
Returns the shape which encloses all the plane positions to which legal sky coordinates can be projected. Typically this has linear dimensions of the order of PI.- Specified by:
getProjectionShape
in interfaceProjection
- Returns:
- projected sky shape
-
isContinuous
public boolean isContinuous()
Description copied from interface:Projection
Indicates whether this projection is known to be continous over its whole range. Returns false if there may be any cases for which small changes in the 3-vector leads to large changes in the plane position (such as near lon=180 in an Aitoff, but not a Sinus, projection).- Specified by:
isContinuous
in interfaceProjection
- Returns:
- true iff this projection is known to be continuous
-
project
public boolean project(double rx, double ry, double rz, java.awt.geom.Point2D.Double pos)
Description copied from interface:Projection
Transforms a sky position to a plane position.- Specified by:
project
in interfaceProjection
- Parameters:
rx
- normalised 3D X coordinatery
- normalised 3D Y coordinaterz
- normalised 3D Z coordinatepos
- point object into which projected dimensionless X,Y coordinates will be written on success- Returns:
- true if transformation succeeded
-
unproject
public boolean unproject(java.awt.geom.Point2D.Double pos, double[] r3)
Description copied from interface:Projection
Transforms a plane position to a sky position.- Specified by:
unproject
in interfaceProjection
- Parameters:
pos
- contains dimensionless X,Y coordinates of plane positionr3
- 3-element array into which normalised X,Y,Z sky coordinates will be written on success- Returns:
- true if transformation succeeded
-
cursorRotate
public double[] cursorRotate(double[] rotmat, java.awt.geom.Point2D.Double pos0, java.awt.geom.Point2D.Double pos1)
Returns null - rotation not implemented.- Specified by:
cursorRotate
in interfaceProjection
- Parameters:
rotmat
- initial rotation matrixpos0
- initial cursor positionpos1
- destination cursor position- Returns:
- destination rotation matrix, or null
-
projRotate
public double[] projRotate(double[] rotmat, java.awt.geom.Point2D.Double pos0, java.awt.geom.Point2D.Double pos1)
Returns null - rotation not implemented.- Specified by:
projRotate
in interfaceProjection
- Parameters:
rotmat
- initial rotation matrixpos0
- initial projected positionpos1
- destination projected position- Returns:
- destination rotation matrix, or null
-
useRanges
public boolean useRanges(boolean reflect, double[] r3, double radiusRad)
Returns false - ranging not used.- Specified by:
useRanges
in interfaceProjection
- Parameters:
reflect
- whether requested aspect will be reflectedr3
- central position of field of view (may be null)radiusRad
- radius of field of view (may be NaN)- Returns:
- true if ranges would be useful given the other arguments
- See Also:
SurfaceFactory.readRanges(P, uk.ac.starlink.ttools.plot2.PlotLayer[], uk.ac.starlink.ttools.plot2.data.DataStore)
-
createAspect
public SkyAspect createAspect(boolean reflect, double[] r3, double radiusRad, Range[] ranges)
Description copied from interface:Projection
Creates a SkyAspect from configuration information. Either the supplied field of view or data ranges may be used, or neither.- Specified by:
createAspect
in interfaceProjection
- Parameters:
reflect
- whether requested aspect will be reflectedr3
- central position of field of view (may be null)radiusRad
- radius of field of view (may be NaN)ranges
- definite ranges for normalised X,Y,Z coordinates acquired from data- Returns:
- new sky aspect
- See Also:
SurfaceFactory.createAspect(P, uk.ac.starlink.ttools.plot2.config.ConfigMap, uk.ac.starlink.ttools.plot.Range[])
-
getFov
public SkyFov getFov(SkySurface surf)
Description copied from interface:Projection
Returns the field of view represented by this aspect. This is a best estimate, it may be approximate depending on the projection geometry. If the field of view is the default for this projection, then null should be returned. Null may also be returned if for some reason no field of view can be determined.- Specified by:
getFov
in interfaceProjection
- Parameters:
surf
- sky surface, which must be set up using this projection- Returns:
- field of view, or null
-
getSkyviewProjecter
public skyview.geometry.Projecter getSkyviewProjecter()
Returns the projecter object used by this SkyviewProjection.- Returns:
- projecter
-
createProjection
public static SkyviewProjection createProjection(skyview.geometry.Projecter projecter, boolean isContinuous)
Factory method that knows shapes for some projections. Name and description are taken from the skyview metadata.- Parameters:
projecter
- skyview projecterisContinuous
- whether projection is known to be continuous- Throws:
java.lang.IllegalArgumentException
- if the shape is not known
-
-