00001 /** @file psSphereOps.h 00002 * 00003 * @brief Contains spherical rotation and offset operations 00004 * 00005 * @ingroup CoordinateTransform 00006 * 00007 * @author Robert DeSonia, MHPCC 00008 * 00009 * @version $Revision: 1.1.1.1 $ $Name: $ 00010 * @date $Date: 2005/10/14 00:32:52 $ 00011 * 00012 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 00013 */ 00014 00015 #ifndef PS_SPHERE_H 00016 #define PS_SPHERE_H 00017 00018 /// @addtogroup CoordinateTransform 00019 /// @{ 00020 00021 //#include "psCoord.h" 00022 #include "psTime.h" 00023 00024 /** Spherical Rotation Definition 00025 * 00026 * We need to be able to convert between ICRS, Galactic and Ecliptic 00027 * coordinates, and potentially between arbitrary spherical coordinate 00028 * systems. All of these basic spherical transformations represent rotations 00029 * of the spherical coordinate reference. 00030 * 00031 */ 00032 typedef struct 00033 { 00034 double q0; 00035 double q1; 00036 double q2; 00037 double q3; 00038 } 00039 psSphereRot; 00040 00041 /** Mode for Offset calculation between two sky positions 00042 * 00043 * @see psSphereGetOffset, psSphereSetOffset 00044 * 00045 */ 00046 typedef enum { 00047 PS_SPHERICAL, ///< offset corresponds to an angular offset 00048 PS_LINEAR ///< offset corresponds to a linear offset 00049 } psSphereOffsetMode; 00050 00051 /** The units of the offset 00052 * 00053 * @see psSphereGetOffset, psSphereSetOffset 00054 * 00055 */ 00056 typedef enum { 00057 PS_ARCSEC, ///< Arcseconds 00058 PS_ARCMIN, ///< Arcminutes 00059 PS_DEGREE, ///< Degrees 00060 PS_RADIAN ///< Radians 00061 } psSphereOffsetUnit; 00062 00063 00064 /** Allocator for psSphereRot 00065 * 00066 * @return psSphereRot* newly allocated psSphereRot 00067 */ 00068 00069 psSphereRot* psSphereRotAlloc( 00070 double alphaP, ///< north pole latitude 00071 double deltaP, ///< north pole longitude 00072 double phiP ///< defines the longitude in the input system of the equatorial intersection between the two systems (e.g, the first point of Ares). 00073 ); 00074 00075 00076 /** Checks the type of a particular pointer. 00077 * 00078 * Uses the appropriate deallocation function in psMemBlock to check the ptr datatype. 00079 * 00080 * @return bool: True if the pointer matches a psSphereRot structure, false otherwise. 00081 */ 00082 bool psMemCheckSphereRot( 00083 psPtr ptr ///< the pointer whose type to check 00084 ); 00085 00086 00087 /** Allocator for psSphereRot given quaternions. 00088 * 00089 * Normalizes a given quaternion and returns the cooresponding newly allocated 00090 * psSphereRot object. 00091 * 00092 * @return psSphereRot* newly allocated psSphereRot 00093 */ 00094 psSphereRot* psSphereRotQuat( 00095 double q0, ///< q0 00096 double q1, ///< q1 00097 double q2, ///< q2 00098 double q3 ///< q3 00099 ); 00100 00101 /** Applies the psSphereTransform transform for a specified coordinate 00102 * 00103 * @return psSphere* resulting coordinate based on transform 00104 */ 00105 psSphere* psSphereRotApply( 00106 psSphere* out, ///< a psSphere to recycle. If NULL, a new one is generated. 00107 const psSphereRot* transform, ///< the transform to apply 00108 const psSphere* coord ///< the coordinate to apply the transform above.x 00109 ); 00110 00111 /** Combines two rotations. 00112 * 00113 * Combines two rotations to produce a single rotation which is the 00114 * equivalent of applying the first rotation and then the second. The output 00115 * rotation may be supplied, or will be allocated if NULL. 00116 * 00117 * @return psSphereRot* New psSphereRot that is the combination of the input psSphereRots 00118 */ 00119 psSphereRot* psSphereRotCombine( 00120 psSphereRot* out, ///< a psSphereRot to recycle or NULL 00121 const psSphereRot* rot1, ///< first rotation to combine 00122 const psSphereRot* rot2 ///< second rotation to combine 00123 ); 00124 00125 /** Inverts the rotation. 00126 * 00127 * @return psSphereRot* Inverted input psSphereRot 00128 */ 00129 psSphereRot* psSphereRotInvert( 00130 psSphereRot *rot 00131 ); 00132 00133 /** Converts a psCube to a psSphere 00134 * 00135 * @return psSphere* New psSphere that is equivalent to the input psCube 00136 * 00137 */ 00138 psSphere* psCubeToSphere( 00139 const psCube* cube ///< a cubic coordinate to convert 00140 ); 00141 00142 /** Converts a psSphere to a psCube 00143 * 00144 * @return psCube* New psCube that is equivalent to the input psSphere 00145 * 00146 */ 00147 psCube* psSphereToCube( 00148 const psSphere* sphere ///< a spherical coordinate to convert 00149 ); 00150 00151 /** Determines the offset (RA,Dec) on the sky between two positions. 00152 * 00153 * Both an offset mode and an offset unit may be defined. The mode may be 00154 * either PS_SPHERICAL, in which case the specified offset corresponds to an 00155 * offset in angles, or it may be PS_LINEAR, in which case the offset 00156 * corresponds to a linear offset in a local projection. The offset unit may 00157 * be in one of PS_ARCSEC, PS_ARCMIN, PS_DEGREE, and PS_RADIAN, which 00158 * specifies the units of the offset only. 00159 * 00160 * @return psSphere* the offset between position1 and position2 00161 */ 00162 psSphere* psSphereGetOffset( 00163 const psSphere* position1, ///< first position for calculating offset 00164 const psSphere* position2, ///< second position for calculating offset 00165 psSphereOffsetMode mode, ///< type of offset can be PS_SPHERICAL or PS_LINEAR 00166 psSphereOffsetUnit unit ///< specifies the units of offset only 00167 ); 00168 00169 /** Applies the given offset to a coordinate. 00170 * 00171 * Both an offset mode and an offset unit may be defined. The mode may be 00172 * either PS_SPHERICAL, in which case the specified offset corresponds to an 00173 * offset in angles, or it may be PS_LINEAR, in which case the offset 00174 * corresponds to a linear offset in a local projection. The offset unit may 00175 * be in one of PS_ARCSEC, PS_ARCMIN, PS_DEGREE, and PS_RADIAN, which 00176 * specifies the units of the offset only. 00177 * 00178 * @return psSphere* the original position with the given offset applied. 00179 */ 00180 psSphere* psSphereSetOffset( 00181 const psSphere* position, ///< coordinate of origin 00182 const psSphere* offset, ///< coordinate of offset to apply 00183 psSphereOffsetMode mode, ///< corresponds to an offset in angles or local projection 00184 psSphereOffsetUnit unit ///< specifies the units of offset only 00185 ); 00186 00187 /** Creates the appropriate transform for converting from ICRS to Ecliptic 00188 * coordinate systems. 00189 * 00190 * @return psSphereTransform* transform for ICRS->Ecliptic coordinate systems 00191 */ 00192 psSphereRot* psSphereRotICRSToEcliptic( 00193 const psTime *time ///< the time for which the resulting transform will be valid 00194 ); 00195 00196 /** Creates the appropriate transform for converting from Ecliptic to ICRS 00197 * coordinate systems. 00198 * 00199 * @return psSphereTransform* transform for Ecliptic->ICRS coordinate systems 00200 */ 00201 psSphereRot* psSphereRotEclipticToICRS( 00202 const psTime *time ///< the time for which the resulting transform will be valid 00203 ); 00204 00205 /** Creates the appropriate transform for converting from ICRS to Galactic 00206 * coordinate systems. 00207 * 00208 */ 00209 psSphereRot* psSphereRotICRSToGalactic(void); 00210 00211 /** Creates the appropriate transform for converting from Galactic to ICRS 00212 * coordinate systems. 00213 * 00214 */ 00215 psSphereRot* psSphereRotGalacticToICRS(void); 00216 00217 /** Generates the complete spherical rotation to account for precession 00218 * between two times. The equinoxes shall be Julian equinoxes. 00219 * 00220 * @return psSphere* the resulting spherical rotation 00221 */ 00222 psSphere* psSpherePrecess( 00223 psSphere *coords, ///< coordinates (modified in-place) 00224 const psTime *fromTime, ///< equinox of coords input 00225 const psTime *toTime ///< equinox of coords output 00226 ); 00227 00228 /// @} 00229 00230 #endif // #ifndef PS_SPHERE_H
1.4.2