Class SinProjection

  • All Implemented Interfaces:
    Projection

    public class SinProjection
    extends SkyviewProjection
    Sine (orthographic) projection. This is the one that gives you a rotatable sphere. North always faces directly up (is aligned along the screen Y direction). This is a singleton class, see INSTANCE.
    Since:
    21 Feb 2013
    Author:
    Mark Taylor
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static SinProjection INSTANCE
      Singleton instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SkyAspect createAspect​(boolean reflect, double[] r3, double radiusRad, Range[] vxyzRanges)
      Creates a SkyAspect from configuration information.
      double[] cursorRotate​(double[] rot0, java.awt.geom.Point2D.Double pos0, java.awt.geom.Point2D.Double pos1)
      Attempts to return a rotation matrix corresponding to moving the cursor between two plane positions.
      SkyFov getFov​(SkySurface surf)
      Returns the field of view represented by this aspect.
      boolean isContinuous()
      Indicates whether this projection is known to be continous over its whole range.
      boolean isContinuousLine​(double[] r3a, double[] r3b)
      Indicates whether a line between the two given sky positions is (believed to be) continuous.
      boolean project​(double rx, double ry, double rz, java.awt.geom.Point2D.Double pos)
      Overridden for slight efficiency gain.
      double[] projRotate​(double[] rot0, java.awt.geom.Point2D.Double pos0, java.awt.geom.Point2D.Double pos1)
      Attempts to return a rotation matrix that will transform a sky position from one plane position to another.
      boolean useRanges​(boolean reflect, double[] r3, double radiusRad)
      Indicates whether ranges should be provided to generate a SkyAspect.
      static double[] verticalRotate​(double delta, double alpha, boolean reflect)
      Rotation matrix which results in an orientation with the viewing plane X coordinate of the north pole equal to zero.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INSTANCE

        public static SinProjection INSTANCE
        Singleton instance.
    • Method Detail

      • project

        public boolean project​(double rx,
                               double ry,
                               double rz,
                               java.awt.geom.Point2D.Double pos)
        Overridden for slight efficiency gain.
        Specified by:
        project in interface Projection
        Overrides:
        project in class SkyviewProjection
        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
      • 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 isContinuousLine returns false.
        Returns:
        true iff this projection is known to be continuous
      • isContinuousLine

        public boolean isContinuousLine​(double[] r3a,
                                        double[] r3b)
        Description copied from interface: Projection
        Indicates whether a line between the two given sky positions is (believed to be) continuous. "Line" in this context should ideally be interpreted as the shorter arc on a great circle. A line crossing lon=180 for instance would be discontinuous in an Aitoff projection, but not in a Sin projection.
        Parameters:
        r3a - 3-element array giving normalised X,Y,Z coordinates of line start
        r3b - 3-element array giving normalised X,Y,Z coordinates of line end
        Returns:
        true if line is believed to be continuous; if in doubt, probably better to return true
      • cursorRotate

        public double[] cursorRotate​(double[] rot0,
                                     java.awt.geom.Point2D.Double pos0,
                                     java.awt.geom.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.

        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,
                                   java.awt.geom.Point2D.Double pos0,
                                   java.awt.geom.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.

        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.
        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[] vxyzRanges)
        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.
        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)
        vxyzRanges - 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.
        Parameters:
        surf - sky surface, which must be set up using this projection
        Returns:
        field of view, or null
      • verticalRotate

        public static double[] verticalRotate​(double delta,
                                              double alpha,
                                              boolean reflect)
        Rotation matrix which results in an orientation with the viewing plane X coordinate of the north pole equal to zero. This is a rotation invariant we wish to preserve.
        Parameters:
        delta - rotation of pole from vertical (0..pi)
        alpha - rotation around pole (0..2pi)
        reflect - if true, alpha increases right to left
        Returns:
        rotation matrix