uk.ac.starlink.ttools.plot2.geom
Class HemisphereProjection

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.geom.HemisphereProjection
All Implemented Interfaces:
Projection

public class HemisphereProjection
extends Object
implements Projection

Toy projection class that provides a rotatable sphere. May not be completely working. Use SinProjection instead.

Since:
21 Feb 2013
Author:
Mark Taylor

Constructor Summary
HemisphereProjection()
          Constructs a HemisphereProjection with default characteristics.
HemisphereProjection(boolean upNorth)
          Constructs a HemisphereProjection optionally with north fixed pointing up.
 
Method Summary
 SkyAspect createAspect(boolean reflect, double[] r3, double radiusRad, Range[] ranges)
          Creates a SkyAspect from configuration information.
 double[] cursorRotate(double[] rot0, Point2D.Double pos0, Point2D.Double pos1)
          Attempts to return a rotation matrix corresponding to moving the cursor between two plane positions.
 boolean equals(Object o)
           
 String getProjectionDescription()
          Returns a short description of the projection.
 String getProjectionName()
          Returns the projection name.
 Shape getProjectionShape()
          Returns the shape which encloses all the plane positions to which legal sky coordinates can be projected.
 int hashCode()
           
 boolean project(double rx, double ry, double rz, Point2D.Double pos)
          Transforms a sky position to a plane position.
 double[] projRotate(double[] rot0, Point2D.Double pos0, Point2D.Double pos1)
          Attempts to return a rotation matrix that will transform a sky position from one plane position to another.
 boolean unproject(Point2D.Double ppos, double[] r3)
          Transforms a plane position to a sky position.
 boolean useRanges(boolean reflect, double[] r3, double radiusRad)
          Indicates whether ranges should be provided to generate a SkyAspect.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HemisphereProjection

public HemisphereProjection()
Constructs a HemisphereProjection with default characteristics.


HemisphereProjection

public HemisphereProjection(boolean upNorth)
Constructs a HemisphereProjection optionally with north fixed pointing up.

Parameters:
upNorth - whether north is fixed to align with the screen Y direction
Method Detail

getProjectionName

public String getProjectionName()
Description copied from interface: Projection
Returns the projection name.

Specified by:
getProjectionName in interface Projection
Returns:
user-directed projection name

getProjectionDescription

public String getProjectionDescription()
Description copied from interface: Projection
Returns a short description of the projection. return projection description

Specified by:
getProjectionDescription in interface Projection

project

public boolean project(double rx,
                       double ry,
                       double rz,
                       Point2D.Double pos)
Description copied from interface: Projection
Transforms a sky position to a plane position.

Specified by:
project in interface Projection
Parameters:
rx - normalised 3D X coordinate
ry - normalised 3D Y coordinate
rz - normalised 3D Z coordinate
pos - point object into which projected dimensionless X,Y coordinates will be written on success
Returns:
true if transformation succeeded

unproject

public boolean unproject(Point2D.Double ppos,
                         double[] r3)
Description copied from interface: Projection
Transforms a plane position to a sky position.

Specified by:
unproject in interface Projection
Parameters:
ppos - contains dimensionless X,Y coordinates of plane position
r3 - 3-element array into which normalised X,Y,Z sky coordinates will be written on success
Returns:
true if transformation succeeded

getProjectionShape

public 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 interface Projection
Returns:
projected sky shape

cursorRotate

public double[] cursorRotate(double[] rot0,
                             Point2D.Double pos0,
                             Point2D.Double pos1)
Description copied from interface: Projection
Attempts to return a rotation matrix corresponding to moving the cursor between two plane positions. Ideally this should do the same thing as projRotate, for both positions on the sky, and provide some other intuitive behaviour if one or both is out of the projection range.

Null may be returned if this projection does not support rotation.

Specified by:
cursorRotate in interface Projection
Parameters:
rot0 - initial rotation matrix
pos0 - initial cursor position
pos1 - destination cursor position
Returns:
destination rotation matrix, or null

projRotate

public double[] projRotate(double[] rot0,
                           Point2D.Double pos0,
                           Point2D.Double pos1)
Description copied from interface: Projection
Attempts to return a rotation matrix that will transform a sky position from one plane position to another.

Consider a sky point S, rotated by an initial rotation matrix rotmat to S', which when projected by this projection lands on the plane at pos0. This method attempts to determine a rotation matrix which when used instead of rotmat would end up with the rotated and projected point at pos1.

Null may be returned if this projection does not support projection.

Specified by:
projRotate in interface Projection
Parameters:
rot0 - initial rotation matrix
pos0 - initial projected position
pos1 - destination projected position
Returns:
destination rotation matrix, or null

useRanges

public boolean useRanges(boolean reflect,
                         double[] r3,
                         double radiusRad)
Description copied from interface: Projection
Indicates whether ranges should be provided to generate a SkyAspect. If supplied field of view arguments are sufficient, or if a default aspect is always produced, return false.

Specified by:
useRanges in interface Projection
Parameters:
reflect - whether requested aspect will be reflected
r3 - 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 interface Projection
Parameters:
reflect - whether requested aspect will be reflected
r3 - 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[])

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.