/* $Procedure ILLUM ( Illumination angles ) */ /* Subroutine */ int illum_(char *target, doublereal *et, char *abcorr, char * obsrvr, doublereal *spoint, doublereal *phase, doublereal *solar, doublereal *emissn, ftnlen target_len, ftnlen abcorr_len, ftnlen obsrvr_len) { /* Initialized data */ static logical first = TRUE_; extern /* Subroutine */ int zzbods2c_(integer *, char *, integer *, logical *, char *, integer *, logical *, ftnlen, ftnlen); extern doublereal vsep_(doublereal *, doublereal *); extern /* Subroutine */ int vsub_(doublereal *, doublereal *, doublereal * ), vequ_(doublereal *, doublereal *), zzctruin_(integer *); integer n; doublereal radii[3]; extern /* Subroutine */ int chkin_(char *, ftnlen), errch_(char *, char *, ftnlen, ftnlen); logical found; extern /* Subroutine */ int spkez_(integer *, doublereal *, char *, char * , integer *, doublereal *, doublereal *, ftnlen, ftnlen); extern logical eqstr_(char *, char *, ftnlen, ftnlen); static logical svfnd1, svfnd2; static integer svctr1[2], svctr2[2]; integer obscde; doublereal lt; extern /* Subroutine */ int bodvcd_(integer *, char *, integer *, integer *, doublereal *, ftnlen); integer frcode; extern /* Subroutine */ int cidfrm_(integer *, integer *, char *, logical *, ftnlen); char frname[80]; integer trgcde; doublereal offobs[3], obsvec[3], tepoch, normal[3]; static integer svtcde; extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *, ftnlen); static integer svobsc; doublereal offsun[3]; extern /* Subroutine */ int setmsg_(char *, ftnlen); doublereal sstate[6], sunvec[3], tstate[6]; static char svtarg[36]; extern /* Subroutine */ int surfnm_(doublereal *, doublereal *, doublereal *, doublereal *, doublereal *); extern logical return_(void); static char svobsr[36]; extern /* Subroutine */ int vminus_(doublereal *, doublereal *); doublereal lts; /* $ Abstract */ /* Deprecated: This routine has been superseded by the SPICELIB */ /* routine ILUMIN. This routine is supported for purposes of */ /* backward compatibility only. */ /* Find the illumination angles at a specified surface point of a */ /* target body. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Required_Reading */ /* KERNEL */ /* NAIF_IDS */ /* SPK */ /* TIME */ /* $ Keywords */ /* GEOMETRY */ /* MOSPICE */ /* $ Declarations */ /* $ Abstract */ /* This include file defines the dimension of the counter */ /* array used by various SPICE subsystems to uniquely identify */ /* changes in their states. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Parameters */ /* CTRSIZ is the dimension of the counter array used by */ /* various SPICE subsystems to uniquely identify */ /* changes in their states. */ /* $ Author_and_Institution */ /* B.V. Semenov (JPL) */ /* $ Literature_References */ /* None. */ /* $ Version */ /* - SPICELIB Version 1.0.0, 29-JUL-2013 (BVS) */ /* -& */ /* End of include file. */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* TARGET I Name of target body. */ /* ET I Epoch in ephemeris seconds past J2000. */ /* ABCORR I Desired aberration correction. */ /* OBSRVR I Name of observing body. */ /* SPOINT I Body-fixed coordinates of a target surface point. */ /* PHASE O Phase angle at the surface point. */ /* SOLAR O Solar incidence angle at the surface point. */ /* EMISSN O Emission angle at the surface point. */ /* $ Detailed_Input */ /* TARGET is the name of the target body. TARGET is */ /* case-insensitive, and leading and trailing blanks */ /* in TARGET are not significant. Optionally, you may */ /* supply a string containing the integer ID code for */ /* the object. For example both 'MOON' and '301' are */ /* legitimate strings that indicate the moon is the */ /* target body. */ /* ET is the epoch, specified in ephemeris seconds past */ /* J2000, at which the apparent illumination angles at */ /* the specified surface point on the target body, as */ /* seen from the observing body, are to be computed. */ /* ABCORR is the aberration correction to be used in */ /* computing the location and orientation of the */ /* target body and the location of the Sun. Possible */ /* values are: */ /* 'NONE' No aberration correction. */ /* 'LT' Correct the position and */ /* orientation of target body for */ /* light time, and correct the */ /* position of the Sun for light */ /* time. */ /* 'LT+S' Correct the observer-target vector */ /* for light time and stellar */ /* aberration, correct the */ /* orientation of the target body */ /* for light time, and correct the */ /* target-Sun vector for light time */ /* and stellar aberration. */ /* 'CN' Converged Newtonian light time */ /* correction. In solving the light */ /* time equation, the 'CN' */ /* correction iterates until the */ /* solution converges (three */ /* iterations on all supported */ /* platforms). Whether the 'CN+S' */ /* solution is substantially more */ /* accurate than the 'LT' solution */ /* depends on the geometry of the */ /* participating objects and on the */ /* accuracy of the input data. In */ /* all cases this routine will */ /* execute more slowly when a */ /* converged solution is computed. */ /* See the Particulars section of */ /* SPKEZR for a discussion of */ /* precision of light time */ /* corrections. */ /* Both the state and rotation of */ /* the target body are corrected for */ /* light time. */ /* 'CN+S' Converged Newtonian light time */ /* correction and stellar aberration */ /* correction. */ /* Both the state and rotation of */ /* the target body are corrected for */ /* light time. */ /* OBSRVR is the name of the observing body, typically a */ /* spacecraft, the earth, or a surface point on the */ /* earth. OBSRVR is case-insensitive, and leading */ /* and trailing blanks in OBSRVR are not significant. */ /* Optionally, you may supply a string containing the */ /* integer ID code for the object. For example both */ /* 'EARTH' and '399' are legitimate strings that */ /* indicate the earth is the observer. */ /* OBSRVR may be not be identical to TARGET. */ /* SPOINT is a surface point on the target body, expressed */ /* in rectangular body-fixed (body equator and prime */ /* meridian) coordinates. SPOINT need not be visible */ /* from the observer's location at time ET. */ /* $ Detailed_Output */ /* PHASE is the phase angle at SPOINT, as seen from OBSRVR */ /* at time ET. This is the angle between the */ /* SPOINT-OBSRVR vector and the SPOINT-Sun vector. */ /* Units are radians. The range of PHASE is [0, pi]. */ /* See Particulars below for a detailed discussion of */ /* the definition. */ /* SOLAR is the solar incidence angle at SPOINT, as seen */ /* from OBSRVR at time ET. This is the angle */ /* between the surface normal vector at SPOINT and the */ /* SPOINT-Sun vector. Units are radians. The range */ /* of SOLAR is [0, pi]. See Particulars below for a */ /* detailed discussion of the definition. */ /* EMISSN is the emission angle at SPOINT, as seen from */ /* OBSRVR at time ET. This is the angle between the */ /* surface normal vector at SPOINT and the */ /* SPOINT-observer vector. Units are radians. The */ /* range of EMISSN is [0, pi]. See Particulars below */ /* for a detailed discussion of the definition. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* 1) If TARGET and OBSRVR are not distinct, the error */ /* SPICE(BODIESNOTDISTINCT) will be signaled. */ /* 2) If no SPK (ephemeris) data are available for the observer, */ /* target, and Sun at the time specified by ET, the error will */ /* be diagnosed by routines called by this routine. If light */ /* time corrections are used, SPK data for the target body must */ /* be available at the time ET - LT, where LT is the one-way */ /* light time from the target to the observer at ET. */ /* Additionally, SPK data must be available for the Sun at the */ /* time ET - LT - LT2, where LT2 is the light time from the Sun */ /* to the target body at time ET - LT. */ /* 3) If PCK data defining the orientation or shape of the target */ /* body are unavailable, the error will be diagnosed by routines */ /* called by this routine. */ /* 4) If no body-fixed frame is associated with the target body, */ /* the error SPICE(NOFRAME) is signaled. */ /* 5) If name of target or observer cannot be translated to its */ /* NAIF ID code, the error SPICE(IDCODENOTFOUND) is signaled. */ /* $ Files */ /* No files are input to this routine. However, ILLUM expects */ /* that the appropriate SPK and PCK files have been loaded via */ /* FURNSH. */ /* $ Particulars */ /* The term "illumination angles" refers to following set of */ /* angles: */ /* solar incidence angle Angle between the surface normal at */ /* the specified surface point and the */ /* vector from the surface point to the */ /* Sun. */ /* emission angle Angle between the surface normal at */ /* the specified surface point and the */ /* vector from the surface point to the */ /* observer. */ /* phase angle Angle between the vectors from the */ /* surface point to the observing body's */ /* location and from the surface point */ /* to the Sun. */ /* The diagram below illustrates the geometrical relationships */ /* defining these angles. The labels for the solar incidence, */ /* emission, and phase angles are "s.i.", "e.", and "phase". */ /* * */ /* Sun */ /* surface normal vector */ /* ._ _. */ /* |\ /| Sun vector */ /* \ phase / */ /* \ . . / */ /* . . */ /* \ ___ / */ /* . \/ \/ */ /* _\ s.i./ */ /* . / \ / */ /* . | e. \ / */ /* * <--------------- * surface point on */ /* viewing vector target body */ /* location to viewing */ /* (observer) location */ /* Note that if the target-observer vector, the target normal vector */ /* at the surface point, and the target-sun vector are coplanar, */ /* then phase is the sum of incidence and emission. This is rarely */ /* true; usually */ /* phase angle < solar incidence angle + emission angle */ /* All of the above angles can be computed using light time */ /* corrections, light time and stellar aberration corrections, or */ /* no aberration corrections. The way aberration corrections */ /* are used is described below. */ /* Care must be used in computing light time corrections. The */ /* guiding principle used here is "describe what appears in */ /* an image." We ignore differential light time; the light times */ /* from all points on the target to the observer are presumed to be */ /* equal. */ /* Observer-target body vector */ /* --------------------------- */ /* Let ET be the epoch at which an observation or remote */ /* sensing measurement is made, and let ET - LT ("LT" stands */ /* for "light time") be the epoch at which the photons received */ /* at ET were emitted from the body (we use the term "emitted" */ /* loosely here). */ /* The correct observer-target vector points from the observer's */ /* location at ET to the target body's location at ET - LT. */ /* The target-observer vector points in the opposite direction. */ /* Since light time corrections are not symmetric, the correct */ /* target-observer vector CANNOT be found by computing the light */ /* time corrected position of the observer as seen from the */ /* target body. */ /* Target body's orientation */ /* ------------------------- */ /* Using the definitions of ET and LT above, the target */ /* body's orientation at ET - LT is used. The surface */ /* normal is dependent on the target body's orientation, so */ /* the body's orientation model must be evaluated for the correct */ /* epoch. */ /* Target body -- Sun vector */ /* ------------------------- */ /* All surface features on the target body will appear in */ /* a measurement made at ET as they were at ET-LT. In */ /* particular, lighting on the target body is dependent on */ /* the apparent location of the Sun as seen from the target */ /* body at ET-LT. So, a second light time correction is used */ /* in finding the apparent location of the Sun. */ /* Stellar aberration corrections, when used, are applied as follows: */ /* Observer-target body vector */ /* --------------------------- */ /* In addition to light time correction, stellar aberration is */ /* used in computing the apparent target body position as seen */ /* from the observer's location at time ET. This apparent */ /* position defines the observer-target body vector. */ /* Target body-Sun vector */ /* ---------------------- */ /* The target body-Sun vector is the apparent position of the Sun, */ /* corrected for light time and stellar aberration, as seen from */ /* the target body at time ET-LT. Note that the target body's */ /* position is not affected by the stellar aberration correction */ /* applied in finding its apparent position as seen by the */ /* observer. */ /* Once all of the vectors, as well as the target body's */ /* orientation, have been computed with the proper aberration */ /* corrections, the element of time is eliminated from the */ /* computation. The problem becomes a purely geometrical one, */ /* and is described by the diagram above. */ /* $ Examples */ /* The numerical results shown for this example may differ across */ /* platforms. The results depend on the SPICE kernels used as */ /* input, the compiler and supporting libraries, and the machine */ /* specific arithmetic implementation. */ /* In the following example program, the file */ /* spk_m_031103-040201_030502.bsp */ /* is a binary SPK file containing data for Mars Global Surveyor, */ /* Mars, and the Sun for a time interval bracketing the date */ /* 2004 JAN 1 12:00:00 UTC. */ /* pck00007.tpc is a planetary constants kernel file containing */ /* radii and rotation model constants. naif0007.tls is a */ /* leapseconds kernel. */ /* Find the phase, solar incidence, and emission angles at the */ /* sub-solar and sub-spacecraft points on Mars as seen from the */ /* Mars Global Surveyor spacecraft at a specified UTC time. */ /* Use light time and stellar aberration corrections. */ /* PROGRAM ANGLES */ /* IMPLICIT NONE */ /* C */ /* C SPICELIB functions */ /* C */ /* DOUBLE PRECISION DPR */ /* C */ /* C Local parameters */ /* C */ /* INTEGER NAMLEN */ /* PARAMETER ( NAMLEN = 32 ) */ /* INTEGER TIMLEN */ /* PARAMETER ( TIMLEN = 25 ) */ /* C */ /* C Local variables */ /* C */ /* CHARACTER*(NAMLEN) OBSRVR */ /* CHARACTER*(NAMLEN) TARGET */ /* CHARACTER*(TIMLEN) UTC */ /* DOUBLE PRECISION ALT */ /* DOUBLE PRECISION ET */ /* DOUBLE PRECISION SSCEMI */ /* DOUBLE PRECISION SSCPHS */ /* DOUBLE PRECISION SSCSOL */ /* DOUBLE PRECISION SSLEMI */ /* DOUBLE PRECISION SSLPHS */ /* DOUBLE PRECISION SSLSOL */ /* DOUBLE PRECISION SSOLPT ( 3 ) */ /* DOUBLE PRECISION SSCPT ( 3 ) */ /* C */ /* C Load kernel files. */ /* C */ /* CALL FURNSH ( 'naif0007.tls' ) */ /* CALL FURNSH ( 'pck00007.tpc' ) */ /* CALL FURNSH ( 'spk_m_031103-040201_030502.bsp' ) */ /* C */ /* C Convert our UTC time to ephemeris seconds past J2000. */ /* C */ /* UTC = '2004 JAN 1 12:00:00' */ /* CALL UTC2ET ( UTC, ET ) */ /* C */ /* C Assign observer and target names. The acronym MGS */ /* C indicates Mars Global Surveyor. See NAIF_IDS for a */ /* C list of names recognized by SPICE. */ /* C */ /* TARGET = 'Mars' */ /* OBSRVR = 'MGS' */ /* C */ /* C Find the sub-solar point on the Earth as seen from */ /* C the MGS spacecraft at ET. Use the "surface intercept" */ /* C style of sub-point definition. This makes it easy */ /* C to verify the solar incidence angle. */ /* C */ /* CALL SUBSOL ( 'Near point', TARGET, ET, */ /* . 'LT+S', OBSRVR, SSOLPT ) */ /* C */ /* C Now find the sub-spacecraft point. Use the */ /* C "nearest point" definition of the sub-point */ /* C here---this makes it easy to verify the emission angle. */ /* C */ /* CALL SUBPT ( 'Near point', TARGET, ET, */ /* . 'LT+S', OBSRVR, SSCPT, ALT ) */ /* C */ /* C Find the phase, solar incidence, and emission */ /* C angles at the sub-solar point on the Earth as seen */ /* C from Mars Observer at time ET. */ /* C */ /* CALL ILLUM ( TARGET, ET, 'LT+S', OBSRVR, */ /* . SSOLPT, SSLPHS, SSLSOL, SSLEMI ) */ /* C */ /* C Do the same for the sub-spacecraft point. */ /* C */ /* CALL ILLUM ( TARGET, ET, 'LT+S', OBSRVR, */ /* . SSCPT, SSCPHS, SSCSOL, SSCEMI ) */ /* C */ /* C Convert the angles to degrees and write them out. */ /* C */ /* SSLPHS = DPR() * SSLPHS */ /* SSLSOL = DPR() * SSLSOL */ /* SSLEMI = DPR() * SSLEMI */ /* SSCPHS = DPR() * SSCPHS */ /* SSCSOL = DPR() * SSCSOL */ /* SSCEMI = DPR() * SSCEMI */ /* WRITE (*,*) ' ' */ /* WRITE (*,*) 'UTC epoch is ', UTC */ /* WRITE (*,*) ' ' */ /* WRITE (*,*) 'Illumination angles at the sub-solar point:' */ /* WRITE (*,*) ' ' */ /* WRITE (*,*) 'Phase angle (deg.): ', SSLPHS */ /* WRITE (*,*) 'Solar incidence angle (deg.): ', SSLSOL */ /* WRITE (*,*) 'Emission angle (deg.): ', SSLEMI */ /* WRITE (*,*) ' ' */ /* WRITE (*,*) 'The solar incidence angle should be 0.' */ /* WRITE (*,*) 'The emission and phase angles should be equal.' */ /* WRITE (*,*) ' ' */ /* WRITE (*,*) 'Illumination angles at the sub-s/c point:' */ /* WRITE (*,*) ' ' */ /* WRITE (*,*) 'Phase angle (deg.): ', SSCPHS */ /* WRITE (*,*) 'Solar incidence angle (deg.): ', SSCSOL */ /* WRITE (*,*) 'Emission angle (deg.): ', SSCEMI */ /* WRITE (*,*) ' ' */ /* WRITE (*,*) 'The emission angle should be 0.' */ /* WRITE (*,*) 'The solar incidence and phase angles should '// */ /* . 'be equal.' */ /* END */ /* When this program is executed, the output will be: */ /* UTC epoch is 2004 JAN 1 12:00:00 */ /* Illumination angles at the sub-solar point: */ /* Phase angle (deg.): 150.210714 */ /* Solar incidence angle (deg.): 6.3735213E-15 */ /* Emission angle (deg.): 150.210714 */ /* The solar incidence angle should be 0. */ /* The emission and phase angles should be equal. */ /* Illumination angles at the sub-s/c point: */ /* Phase angle (deg.): 123.398202 */ /* Solar incidence angle (deg.): 123.398202 */ /* Emission angle (deg.): 6.36110936E-15 */ /* The emission angle should be 0. */ /* The solar incidence and phase angles should be equal. */ /* $ Restrictions */ /* None. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* C.H. Acton (JPL) */ /* B.V. Semenov (JPL) */ /* N.J. Bachman (JPL) */ /* $ Version */ /* - SPICELIB Version 1.3.0, 04-JUL-2014 (NJB) (BVS) */ /* Discussion of light time corrections was updated. Assertions */ /* that converged light time corrections are unlikely to be */ /* useful were removed. */ /* Last update was 19-SEP-2013 (BVS) */ /* Updated to save the input body names and ZZBODTRN state */ /* counters and to do name-ID conversions only if the counters */ /* have changed. */ /* - SPICELIB Version 1.2.2, 18-MAY-2010 (BVS) */ /* Index lines now state that this routine is deprecated. */ /* - SPICELIB Version 1.2.1, 07-FEB-2008 (NJB) */ /* Abstract now states that this routine is deprecated. */ /* - SPICELIB Version 1.2.0, 23-OCT-2005 (NJB) */ /* Updated to remove non-standard use of duplicate arguments */ /* in VSUB calls. Replaced call to BODVAR with call to BODVCD. */ /* - SPICELIB Version 1.1.0, 22-JUL-2004 (NJB) */ /* Updated to support representations of integers in the input */ /* arguments TARGET and OBSRVR. */ /* - SPICELIB Version 1.0.2, 27-JUL-2003 (NJB) (CHA) */ /* Various header corrections were made. The example program */ /* was upgraded to use real kernels, and the program's output is */ /* shown. */ /* - SPICELIB Version 1.0.1, 10-JUL-2002 (NJB) */ /* Updated Index_Entries header section. */ /* - SPICELIB Version 1.0.0, 21-MAR-1999 (NJB) */ /* Adapted from the MGSSPICE version dated 10-MAR-1992. */ /* -& */ /* $ Index_Entries */ /* DEPRECATED illumination angles */ /* DEPRECATED lighting angles */ /* DEPRECATED phase angle */ /* DEPRECATED solar incidence angle */ /* DEPRECATED emission angle */ /* -& */ /* $ Revisions */ /* - SPICELIB Version 1.2.0, 23-OCT-2005 (NJB) */ /* Updated to remove non-standard use of duplicate arguments */ /* in VSUB calls. Replaced call to BODVAR with call to BODVCD. */ /* - SPICELIB Version 1.1.0, 22-JUL-2004 (NJB) */ /* Updated to support representations of integers in the */ /* input arguments TARGET and OBSRVR: calls to BODN2C */ /* were replaced by calls to BODS2C. */ /* -& */ /* SPICELIB functions */ /* Local parameters */ /* Saved body name length. */ /* Local variables */ /* Saved name/ID item declarations. */ /* Saved name/ID items. */ /* Initial values. */ /* Standard SPICE error handling. */ if (return_()) { return 0; } else { chkin_("ILLUM", (ftnlen)5); } /* Initialization. */ if (first) { /* Initialize counters. */ zzctruin_(svctr1); zzctruin_(svctr2); first = FALSE_; } /* Obtain integer codes for the target and observer. */ zzbods2c_(svctr1, svtarg, &svtcde, &svfnd1, target, &trgcde, &found, ( ftnlen)36, target_len); if (! found) { setmsg_("The target, '#', is not a recognized name for an ephemeris " "object. The cause of this problem may be that you need an up" "dated version of the SPICE Toolkit. ", (ftnlen)155); errch_("#", target, (ftnlen)1, target_len); sigerr_("SPICE(IDCODENOTFOUND)", (ftnlen)21); chkout_("ILLUM", (ftnlen)5); return 0; } zzbods2c_(svctr2, svobsr, &svobsc, &svfnd2, obsrvr, &obscde, &found, ( ftnlen)36, obsrvr_len); if (! found) { setmsg_("The observer, '#', is not a recognized name for an ephemeri" "s object. The cause of this problem may be that you need an " "updated version of the SPICE Toolkit. ", (ftnlen)157); errch_("#", obsrvr, (ftnlen)1, obsrvr_len); sigerr_("SPICE(IDCODENOTFOUND)", (ftnlen)21); chkout_("ILLUM", (ftnlen)5); return 0; } /* The observer and target must be distinct. */ if (trgcde == obscde) { setmsg_("Target is #; observer is #.", (ftnlen)27); errch_("#", target, (ftnlen)1, target_len); errch_("#", obsrvr, (ftnlen)1, obsrvr_len); sigerr_("SPICE(BODIESNOTDISTINCT)", (ftnlen)24); chkout_("ILLUM", (ftnlen)5); return 0; } /* Find the name of the body-fixed frame associated with the */ /* target body. We'll want the state of the target relative to */ /* the observer in this body-fixed frame. */ cidfrm_(&trgcde, &frcode, frname, &found, (ftnlen)80); if (! found) { setmsg_("No body-fixed frame is associated with target body #; a fra" "me kernel must be loaded to make this association. Consult " "the FRAMES Required Reading for details.", (ftnlen)159); errch_("#", target, (ftnlen)1, target_len); sigerr_("SPICE(NOFRAME)", (ftnlen)14); chkout_("ILLUM", (ftnlen)5); return 0; } /* Find the body-fixed state of the target as seen from the observer */ /* at ET. The appropriate aberration corrections will be used in */ /* evaluating this state. */ spkez_(&trgcde, et, frname, abcorr, &obscde, tstate, <, (ftnlen)80, abcorr_len); /* Determine the epoch to be used in computing the target-Sun vector. */ if (eqstr_(abcorr, "NONE", abcorr_len, (ftnlen)4)) { tepoch = *et; } else { tepoch = *et - lt; } /* Find the body-fixed state of the Sun as seen from the target at */ /* TEPOCH. */ spkez_(&c__10, &tepoch, frname, abcorr, &trgcde, sstate, <s, (ftnlen)80, abcorr_len); /* Grab the position portions of the states (the first three */ /* elements of each state). Negate the observer-target vector, */ /* since the vector required for the illumination angle */ /* computation is the target-observer vector. The vectors we've */ /* found point from the target body center to the observer and */ /* Sun, and already take light time corrections into account. */ vminus_(tstate, obsvec); vequ_(sstate, sunvec); /* Now we'll modify target-observer and target-Sun vectors to */ /* take into account the offset between the target center and the */ /* surface point of interest; we want the vectors to point from */ /* the surface point to the observer and Sun respectively. */ vsub_(obsvec, spoint, offobs); vsub_(sunvec, spoint, offsun); /* Find the surface normal at SPOINT. We'll need the radii of the */ /* target body. */ bodvcd_(&trgcde, "RADII", &c__3, &n, radii, (ftnlen)5); surfnm_(radii, &radii[1], &radii[2], spoint, normal); /* Find the illumination angles. VSEP will give us angular */ /* separation in radians. */ *phase = vsep_(offsun, offobs); *solar = vsep_(normal, offsun); *emissn = vsep_(normal, offobs); chkout_("ILLUM", (ftnlen)5); return 0; } /* illum_ */
/* $Procedure RECGEO ( Rectangular to geodetic ) */ /* Subroutine */ int recgeo_(doublereal *rectan, doublereal *re, doublereal * f, doublereal *long__, doublereal *lat, doublereal *alt) { doublereal base[3], a, b, c__; extern /* Subroutine */ int chkin_(char *, ftnlen), errdp_(char *, doublereal *, ftnlen), reclat_(doublereal *, doublereal *, doublereal *, doublereal *); doublereal radius, normal[3]; extern /* Subroutine */ int nearpt_(doublereal *, doublereal *, doublereal *, doublereal *, doublereal *, doublereal *), sigerr_( char *, ftnlen), chkout_(char *, ftnlen), setmsg_(char *, ftnlen), surfnm_(doublereal *, doublereal *, doublereal *, doublereal *, doublereal *); extern logical return_(void); /* $ Abstract */ /* Convert from rectangular coordinates to geodetic coordinates. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Required_Reading */ /* None. */ /* $ Keywords */ /* CONVERSION, COORDINATES */ /* $ Declarations */ /* $ Brief_I/O */ /* VARIABLE I/O DESCRIPTION */ /* -------- --- -------------------------------------------------- */ /* RECTAN I Rectangular coordinates of a point. */ /* RE I Equatorial radius of the reference spheroid. */ /* F I Flattening coefficient. */ /* LONG O Geodetic longitude of the point (radians). */ /* LAT O Geodetic latitude of the point (radians). */ /* ALT O Altitude of the point above reference spheroid. */ /* $ Detailed_Input */ /* RECTAN The rectangular coordinates of a point. */ /* RE Equatorial radius of a reference spheroid. This */ /* spheroid is a volume of revolution: its horizontal */ /* cross sections are circular. The shape of the */ /* spheroid is defined by an equatorial radius RE and */ /* a polar radius RP. */ /* F Flattening coefficient = (RE-RP) / RE, where RP is */ /* the polar radius of the spheroid. */ /* $ Detailed_Output */ /* LONG Geodetic longitude of the input point. This is the */ /* angle between the prime meridian and the meridian */ /* containing RECTAN. The direction of increasing */ /* longitude is from the +X axis towards the +Y axis. */ /* LONG is output in radians. The range of LONG is */ /* [-pi, pi]. */ /* LAT Geodetic latitude of the input point. For a point P */ /* on the reference spheroid, this is the angle between */ /* the XY plane and the outward normal vector at P. */ /* For a point P not on the reference spheroid, the */ /* geodetic latitude is that of the closest point to P on */ /* the spheroid. */ /* LAT is output in radians. The range of LAT is */ /* [-pi/2, pi/2]. */ /* ALT Altitude of point above the reference spheroid. */ /* The units associated with ALT are those associated */ /* with the input RECTAN. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* 1) If the equatorial radius is non-positive, the error */ /* SPICE(VALUEOUTOFRANGE) is signaled. */ /* 2) If the flattening coefficient is greater than or equal to */ /* one, the error SPICE(VALUEOUTOFRANGE) is signaled. */ /* 3) For points inside the reference ellipsoid, the nearest */ /* point on the ellipsoid to RECTAN may not be unique, so */ /* latitude may not be well-defined. */ /* $ Files */ /* None. */ /* $ Particulars */ /* Given the body-fixed rectangular coordinates of a point, and the */ /* constants describing the reference spheroid, this routine */ /* returns the geodetic coordinates of the point. The body-fixed */ /* rectangular frame is that having the x-axis pass through the */ /* 0 degree latitude 0 degree longitude point. The y-axis passes */ /* through the 0 degree latitude 90 degree longitude. The z-axis */ /* passes through the 90 degree latitude point. For some bodies */ /* this coordinate system may not be a right-handed coordinate */ /* system. */ /* $ Examples */ /* This routine can be used to convert body fixed rectangular */ /* coordinates (such as the Satellite Tracking and Data Network */ /* of 1973) to geodetic coordinates such as those used by the */ /* United States Geological Survey topographic maps. */ /* The code would look something like this */ /* C */ /* C Shift the STDN-73 coordinates to line up with the center */ /* C of the Clark66 reference system. */ /* C */ /* CALL VSUB ( STDNX, OFFSET, X ) */ /* C */ /* C Using the equatorial radius of the Clark66 spheroid */ /* C (CLARKR = 6378.2064 km) and the Clark 66 flattening */ /* C factor (CLARKF = 1.0D0 / 294.9787D0 ) convert to */ /* C geodetic coordinates of the North American Datum of 1927. */ /* C */ /* CALL RECGEO ( X, CLARKR, CLARKF, LONG, LAT, ALT ) */ /* Below are two tables. */ /* Listed in the first table (under X(1), X(2) and X(3)) are a */ /* number of points whose rectangular coordinates are */ /* taken from the set {-1, 0, 1}. */ /* The results of the code fragment */ /* CALL RECGEO ( X, CLARKR, CLARKF, LONG, LAT, ALT ) */ /* Use the SPICELIB routine CONVRT to convert the angular */ /* quantities to degrees */ /* CALL CONVRT ( LAT, 'RADIANS', 'DEGREES', LAT ) */ /* CALL CONVRT ( LONG, 'RADIANS', 'DEGREES', LONG ) */ /* are listed to 4 decimal places in the second parallel table under */ /* LONG (longitude), LAT (latitude), and ALT (altitude). */ /* X(1) X(2) X(3) LONG LAT ALT */ /* -------------------------- ---------------------------- */ /* 0.0000 0.0000 0.0000 0.0000 90.0000 -6356.5838 */ /* 1.0000 0.0000 0.0000 0.0000 0.0000 -6377.2063 */ /* 0.0000 1.0000 0.0000 90.0000 0.0000 -6377.2063 */ /* 0.0000 0.0000 1.0000 0.0000 90.0000 -6355.5838 */ /* -1.0000 0.0000 0.0000 180.0000 0.0000 -6377.2063 */ /* 0.0000 -1.0000 0.0000 -90.0000 0.0000 -6377.2063 */ /* 0.0000 0.0000 -1.0000 0.0000 -90.0000 -6355.5838 */ /* 1.0000 1.0000 0.0000 45.0000 0.0000 -6376.7921 */ /* 1.0000 0.0000 1.0000 0.0000 88.7070 -6355.5725 */ /* 0.0000 1.0000 1.0000 90.0000 88.7070 -6355.5725 */ /* 1.0000 1.0000 1.0000 45.0000 88.1713 -6355.5612 */ /* $ Restrictions */ /* None. */ /* $ Literature_References */ /* See FUNDAMENTALS OF ASTRODYNAMICS, Bate, Mueller, White */ /* published by Dover for a description of geodetic coordinates. */ /* $ Author_and_Institution */ /* C.H. Acton (JPL) */ /* N.J. Bachman (JPL) */ /* H.A. Neilan (JPL) */ /* W.L. Taber (JPL) */ /* $ Version */ /* - SPICELIB Version 1.0.3, 02-JUL-2007 (NJB) */ /* In Examples section of header, description of right-hand */ /* table was updated to use correct names of columns. Term */ /* "bodyfixed" is now hyphenated. */ /* - SPICELIB Version 1.0.2, 30-JUL-2003 (NJB) (CHA) */ /* Various header changes were made to improve clarity. Some */ /* minor header corrections were made. */ /* - SPICELIB Version 1.0.1, 10-MAR-1992 (WLT) */ /* Comment section for permuted index source lines was added */ /* following the header. */ /* - SPICELIB Version 1.0.0, 31-JAN-1990 (WLT) */ /* -& */ /* $ Index_Entries */ /* rectangular to geodetic */ /* -& */ /* $ Revisions */ /* - Beta Version 3.0.1, 9-JUN-1989 (HAN) */ /* Error handling was added to detect and equatorial radius */ /* whose value is less than or equal to zero. */ /* - Beta Version 2.0.0, 21-DEC-1988 (HAN) */ /* Error handling to detect invalid flattening coefficients */ /* was added. Because the flattening coefficient is used to */ /* compute the length of an axis, it must be checked so that */ /* the length is greater than zero. */ /* -& */ /* SPICELIB functions */ /* Local variables */ /* Standard SPICE error handling. */ if (return_()) { return 0; } else { chkin_("RECGEO", (ftnlen)6); } /* The equatorial radius must be positive. If not, signal an error */ /* and check out. */ if (*re <= 0.) { setmsg_("Equatorial radius was *.", (ftnlen)24); errdp_("*", re, (ftnlen)1); sigerr_("SPICE(VALUEOUTOFRANGE)", (ftnlen)22); chkout_("RECGEO", (ftnlen)6); return 0; } /* If the flattening coefficient is greater than one, the length */ /* of the 'C' axis computed below is negative. If it's equal to one, */ /* the length of the axis is zero. Either case is a problem, so */ /* signal an error and check out. */ if (*f >= 1.) { setmsg_("Flattening coefficient was *.", (ftnlen)29); errdp_("*", f, (ftnlen)1); sigerr_("SPICE(VALUEOUTOFRANGE)", (ftnlen)22); chkout_("RECGEO", (ftnlen)6); return 0; } /* Determine the lengths of the axes of the reference ellipsoid. */ a = *re; b = *re; c__ = *re - *f * *re; /* Find the point on the reference spheroid closes to the input point */ nearpt_(rectan, &a, &b, &c__, base, alt); /* From this closest point determine the surface normal */ surfnm_(&a, &b, &c__, base, normal); /* Using the surface normal, determine the latitude and longitude */ /* of the input point. */ reclat_(normal, &radius, long__, lat); chkout_("RECGEO", (ftnlen)6); return 0; } /* recgeo_ */
void surfnm_c ( SpiceDouble a, SpiceDouble b, SpiceDouble c, ConstSpiceDouble point[3], SpiceDouble normal[3] ) /* -Brief_I/O VARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- a I Length of the ellisoid semi-axis along the x-axis. b I Length of the ellisoid semi-axis along the y-axis. c I Length of the ellisoid semi-axis along the z-axis. point I Body-fixed coordinates of a point on the ellipsoid normal O Outward pointing unit normal to ellipsoid at point -Detailed_Input a This is the length of the semi-axis of the ellipsoid that is parallel to the x-axis of the body-fixed coordinate system. b This is the length of the semi-axis of the ellipsoid that is parallel to the y-axis of the body-fixed coordinate system. c This is the length of the semi-axis of the ellipsoid that is parallel to the z-axis of the body-fixed coordinate system. point This is a 3-vector giving the bodyfixed coordinates of a point on the ellipsoid. In bodyfixed coordinates, the semi-axes of the ellipsoid are aligned with the x, y, and z-axes of the coordinate system. -Detailed_Output normal A unit vector pointing away from the ellipsoid and normal to the ellipsoid at point. -Parameters None. -Exceptions 1) If any of the axes are non-positive, the error SPICE(BADAXISLENGTH) will be signalled. -Files None. -Particulars This routine computes the outward pointing unit normal vector to the ellipsoid having semi-axes of length a, b, and c from the point point. -Examples A typical use of surfnm_c would be to find the angle of incidence of the light from the sun at a point on the surface of an ellipsoid. Let q be a 3-vector representing the rectangular body-fixed coordinates of a point on the ellipsoid (we are assuming that the axes of the ellipsoid are aligned with the axes of the body fixed frame.) Let v be the vector from q to the sun in bodyfixed coordinates. Then the following code fragment could be used to compute angle of incidence of sunlight at q. surfnm_c ( a, b, c, q, nrml ); incidn = vsep_c ( v, nrml ); -Restrictions It is assumed that the input point is indeed on the ellipsoid. No checking for this is done. -Literature_References None. -Author_and_Institution W.L. Taber (JPL) N.J. Bachman (JPL) B.V. Semenov (JPL) -Version -CSPICE Version 1.3.1, 31-JAN-2008 (BVS) Removed '-Revisions' from the header. -CSPICE Version 1.3.0, 22-OCT-1998 (NJB) Made input vector const. -CSPICE Version 1.2.0, 08-FEB-1998 (NJB) Removed local variables used for temporary capture of outputs. -CSPICE Version 1.0.0, 25-OCT-1997 (NJB) Based on SPICELIB Version 1.2.0, 07-AUG-1996 (WLT) -Index_Entries surface normal vector on an ellipsoid -& */ { /* Begin surfnm_c */ /* Participate in error tracing. */ chkin_c ( "surfnm_c"); /* Call the f2c'd surfpt. */ surfnm_( (doublereal *) &a, (doublereal *) &b, (doublereal *) &c, (doublereal *) point, (doublereal *) normal ); chkout_c ( "surfnm_c" ); } /* End surfnm_c */