1 /* 2 3 -Procedure illum_plid_pl02 (illumination angles using type 2 DSK) 4 5 -Abstract 6 7 Deprecated: This routine has been superseded by the CSPICE routine 8 illumf_c. This routine is supported for purposes of backward 9 compatibility only. 10 11 Compute the illumination angles---phase, solar incidence, and 12 emission---at a specified point on a target body at a particular 13 epoch, optionally corrected for light time and stellar aberration. 14 Return logical flags indicating whether the surface point is 15 shadowed or occulted by the target body. 16 17 The target body's surface is represented by a triangular plate model 18 contained in a type 2 DSK segment. The ID of the plate on which the 19 point is located must be provided by the caller. 20 21 -Disclaimer 22 23 THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE 24 CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. 25 GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE 26 ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE 27 PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" 28 TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY 29 WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A 30 PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC 31 SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE 32 SOFTWARE AND RELATED MATERIALS, HOWEVER USED. 33 34 IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA 35 BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT 36 LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, 37 INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, 38 REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE 39 REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. 40 41 RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF 42 THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY 43 CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE 44 ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. 45 46 -Required_Reading 47 48 FRAMES 49 PCK 50 SPK 51 TIME 52 53 -Keywords 54 55 GEOMETRY 56 57 */ 58 59 #include "SpiceUsr.h" 60 #include "SpiceZfc.h" 61 #include "SpiceZmc.h" 62 63 illum_plid_pl02(SpiceInt handle,ConstSpiceDLADescr * dladsc,ConstSpiceChar * target,SpiceDouble et,ConstSpiceChar * abcorr,ConstSpiceChar * obsrvr,SpiceDouble spoint[3],SpiceInt plid,SpiceDouble * trgepc,SpiceDouble srfvec[3],SpiceDouble * phase,SpiceDouble * solar,SpiceDouble * emissn,SpiceBoolean * visible,SpiceBoolean * lit)64 void illum_plid_pl02 ( SpiceInt handle, 65 ConstSpiceDLADescr * dladsc, 66 ConstSpiceChar * target, 67 SpiceDouble et, 68 ConstSpiceChar * abcorr, 69 ConstSpiceChar * obsrvr, 70 SpiceDouble spoint [3], 71 SpiceInt plid, 72 SpiceDouble * trgepc, 73 SpiceDouble srfvec [3], 74 SpiceDouble * phase, 75 SpiceDouble * solar, 76 SpiceDouble * emissn, 77 SpiceBoolean * visible, 78 SpiceBoolean * lit ) 79 /* 80 81 -Brief_I/O 82 83 Variable I/O Description 84 -------- --- -------------------------------------------------- 85 handle I DSK handle. 86 dlasdc I DLA descriptor of target body segment. 87 target I Name of target body. 88 et I Epoch in ephemeris seconds past J2000 TDB. 89 abcorr I Aberration correction. 90 obsrvr I Name of observing body. 91 spoint I Body-fixed coordinates of a target surface point. 92 plid I ID of plate on which surface point is located. 93 trgepc O Target surface point epoch. 94 srfvec O Vector from observer to target surface point. 95 phase O Phase angle at the surface point. 96 solar O Solar incidence angle at the surface point. 97 emissn O Emission angle at the surface point. 98 visible O Visibility flag (SPICETRUE = visible). 99 lit O Illumination flag (SPICETRUE = illuminated). 100 101 -Detailed_Input 102 103 handle is the DAS file handle of a DSK file open for read 104 access. This kernel must contain a type 2 segment 105 that provides a plate model representing the entire 106 surface of the target body. 107 108 109 dladsc is the DLA descriptor of a DSK segment representing 110 the surface of the target body. 111 112 113 target is the name of the target body. `target' is 114 case-insensitive, and leading and trailing blanks in 115 `target' are not significant. Optionally, you may supply 116 a string containing the integer ID code for the object. 117 For example both "MOON" and "301" are legitimate strings 118 that indicate the moon is the target body. 119 120 This routine assumes that the target body's surface is 121 represented using a plate model, and that a DSK file 122 containing the plate model has been loaded via dasopr_c. 123 124 125 et is the epoch, represented as seconds past J2000 TDB, at 126 which the illumination angles are to be computed. When 127 aberration corrections are used, `et' refers to the 128 epoch at which radiation is received at the observer. 129 130 abcorr indicates the aberration corrections to be applied to 131 the position and orientation of the target body and the 132 position of the Sun to account for one-way light time 133 and stellar aberration. See the discussion in the 134 Particulars section for recommendations on how to choose 135 aberration corrections. 136 137 `abcorr' may be any of the following: 138 139 "NONE" Apply no correction. Use the geometric 140 positions of the Sun and target body 141 relative to the observer; evaluate the 142 target body's orientation at `et'. 143 144 The following values of `abcorr' apply to the 145 "reception" case in which photons depart from the 146 target's location at the light-time corrected epoch 147 et-lt and *arrive* at the observer's location at 148 `et': 149 150 "LT" Correct for one-way light time (also 151 called "planetary aberration") using a 152 Newtonian formulation. This correction 153 uses the position and orientation of the 154 target at the moment it emitted photons 155 arriving at the observer at `et'. The 156 position of the Sun relative to the 157 target is corrected for the one-way light 158 time from the Sun to the target. 159 160 The light time correction uses an 161 iterative solution of the light time 162 equation (see Particulars for details). 163 The solution invoked by the "LT" option 164 uses one iteration. 165 166 "LT+S" Correct for one-way light time and stellar 167 aberration using a Newtonian formulation. 168 This option modifies the positions 169 obtained with the "LT" option to account 170 for the observer's velocity relative to 171 the solar system barycenter (note the 172 target plays the role of "observer" in the 173 computation of the aberration-corrected 174 target-Sun vector). The result is that the 175 illumination angles are computed using 176 apparent position and orientation of the 177 target as seen by the observer and the 178 apparent position of the Sun as seen by 179 the target. 180 181 "CN" Converged Newtonian light time correction. 182 In solving the light time equation, the 183 "CN" correction iterates until the 184 solution converges (three iterations on 185 all supported platforms). 186 187 The "CN" correction typically does not 188 substantially improve accuracy because the 189 errors made by ignoring relativistic 190 effects may be larger than the improvement 191 afforded by obtaining convergence of the 192 light time solution. The "CN" correction 193 computation also requires a significantly 194 greater number of CPU cycles than does the 195 one-iteration light time correction. 196 197 "CN+S" Converged Newtonian light time 198 and stellar aberration corrections. 199 200 obsrvr is the name of the observing body. This is typically a 201 spacecraft, the earth, or a surface point on the earth. 202 `obsrvr' is case-insensitive, and leading and trailing 203 blanks in `obsrvr' are not significant. Optionally, you 204 may supply a string containing the integer ID code for 205 the object. For example both "EARTH" and "399" are 206 legitimate strings that indicate the earth is the 207 observer. 208 209 spoint is a surface point on the target body, expressed in 210 rectangular body-fixed (body equator and prime meridian) 211 coordinates. `spoint' need not be visible from the 212 observer's location at time `et'. 213 214 215 plid is the integer ID of the plate on which `spoint' is 216 located. If `spoint' was found by calling any of the 217 routines 218 219 dskx02_c 220 subpt_pl02 221 subsol_pl02 222 223 `plid' is the plate ID returned by the called routine. 224 225 226 -Detailed_Output 227 228 229 All outputs are computed using the body-fixed, body-centered 230 reference frame of the DSK segment identified by `handle' and 231 `dladsc'. This frame is referred to below as `fixref'. The 232 frame ID of `fixref' may be obtained by calling dskgd_c, as 233 is shown in the Examples section below. 234 235 The orientation of the frame `fixref' is evaluated at the 236 epoch `trgepc'. 237 238 239 trgepc is the "surface point epoch." `trgepc' is defined as 240 follows: letting `lt' be the one-way light time between 241 the observer and the input surface point `spoint', 242 `trgepc' is either the epoch et-lt or `et' depending on 243 whether the requested aberration correction is, 244 respectively, for received radiation or omitted. `lt' is 245 computed using the method indicated by `abcorr'. 246 247 `trgepc' is expressed as seconds past J2000 TDB. 248 249 250 srfvec is the vector from the observer's position at `et' to 251 the aberration-corrected (or optionally, geometric) 252 position of `spoint', where the aberration corrections 253 are specified by `abcorr'. `srfvec' is expressed in the 254 target body-fixed reference frame designated by 255 `fixref', evaluated at `trgepc'. 256 257 The components of `srfvec' are given in units of km. 258 259 One can use the CSPICE function vnorm_c to obtain the 260 distance between the observer and `spoint': 261 262 dist = vnorm_c ( srfvec ); 263 264 The observer's position `obspos', relative to the 265 target body's center, where the center's position is 266 corrected for aberration effects as indicated by 267 `abcorr', can be computed via the call: 268 269 vsub_c ( spoint, srfvec, obspos ); 270 271 To transform the vector `srfvec' from a reference frame 272 `fixref' at time `trgepc' to a time-dependent reference 273 frame `ref' at time `et', the routine pxfrm2_c should be 274 called. Let `xform' be the 3x3 matrix representing the 275 rotation from the reference frame `fixref' at time 276 `trgepc' to the reference frame `ref' at time `et'. Then 277 `srfvec' can be transformed to the result `refvec' as 278 follows: 279 280 pxfrm2_c ( fixref, ref, trgepc, et, xform ); 281 mxv_c ( xform, srfvec, refvec ); 282 283 284 phase is the phase angle at `spoint', as seen from `obsrvr' at 285 time `et'. This is the angle between the spoint-obsrvr 286 vector and the spoint-sun vector. Units are radians. The 287 range of `phase' is [0, pi]. 288 289 290 solar is the solar incidence angle at `spoint', as seen from 291 `obsrvr' at time `et'. This is the angle between the 292 surface normal vector at `spoint' and the spoint-sun 293 vector. Units are radians. The range of `solar' is [0, 294 pi]. 295 296 Note that if the target surface is non-convex, a solar 297 incidence angle less than pi/2 radians does not imply 298 the surface point is illuminated. See the description of 299 `lit' below. 300 301 302 emissn is the emission angle at `spoint', as seen from `obsrvr' 303 at time `et'. This is the angle between the surface 304 normal vector at `spoint' and the spoint-observer 305 vector. Units are radians. The range of `emissn' is 306 is [0, pi]. 307 308 See Particulars below for a detailed discussion of the 309 definitions of these angles. 310 311 Note that if the target surface is non-convex, an emission 312 angle less than pi/2 radians does not imply the surface 313 point is visible to the observer. See the description of 314 `visible' below. 315 316 317 visible is a logical flag indicating whether the surface point 318 is visible to the observer. `visible' takes into account 319 whether the target surface occults `spoint', regardless 320 of the emission angle at `spoint'. `visible' is returned 321 with the value SPICETRUE if `spoint' is visible; 322 otherwise it is SPICEFALSE. 323 324 325 lit is a logical flag indicating whether the surface point 326 is illuminated; the point is considered to be 327 illuminated if the vector from the point to the center 328 of the sun doesn't intersect the target surface. `lit' 329 takes into account whether the target surface casts a 330 shadow on `spoint', regardless of the solar incidence 331 angle at `spoint'. `lit' is returned with the value 332 SPICETRUE if `spoint' is illuminated; otherwise it is 333 SPICEFALSE. 334 335 336 337 -Parameters 338 339 None. 340 341 -Exceptions 342 343 If any of the listed errors occur, the output arguments are 344 left unchanged. 345 346 347 348 1) If `plid' is not a valid plate ID, the error will be diagnosed 349 by a routine in the call tree of this routine. 350 351 2) If either of the input body names `target' or `obsrvr' cannot be 352 mapped to NAIF integer codes, the error SPICE(IDCODENOTFOUND) 353 is signaled. 354 355 3) If `obsrvr' and `target' map to the same NAIF integer ID codes, the 356 error SPICE(BODIESNOTDISTINCT) is signaled. 357 358 4) If frame definition data enabling the evaluation of the state 359 of the target relative to the observer in the target body-fixed 360 frame have not been loaded prior to calling illum_plid_pl02, the 361 error will be diagnosed and signaled by a routine in the call 362 tree of this routine. 363 364 5) If the specified aberration correction is not recognized, the 365 error will be diagnosed and signaled by a routine in the call 366 tree of this routine. 367 368 6) If insufficient ephemeris data have been loaded prior to 369 calling illum_plid_pl02, the error will be diagnosed and signaled by a 370 routine in the call tree of this routine. 371 372 7) If a DSK providing a DSK type 2 plate model has not been 373 loaded prior to calling illum_plid_pl02, the error will be 374 diagnosed and signaled by a routine in the call tree of this 375 routine. 376 377 8) If PCK data supplying a rotation model for the target body have 378 not been loaded prior to calling illum_plid_pl02, the error will be 379 diagnosed and signaled by a routine in the call tree of this 380 routine. 381 382 9) If the segment associated with the input DLA descriptor does not 383 contain data for the designated target, the error 384 SPICE(TARGETMISMATCH) is signaled. The target body of the DSK 385 segment is determined from the `center' member of the segment's 386 DSK descriptor. 387 388 10) If the segment associated with the input DLA descriptor is not 389 of data type 2, the error SPICE(WRONGDATATYPE) is signaled. 390 391 11) Use of transmission-style aberration corrections is not 392 permitted. If abcorr specified such a correction, the 393 error SPICE(NOTSUPPORTED) is signaled. 394 395 12) The observer is presumed to be outside the target body; no 396 checks are made to verify this. 397 398 13) If any input string pointer is null, the error SPICE(NULLPOINTER) 399 will be signaled. 400 401 14) If any input string has length zero, the error SPICE(EMPTYSTRING) 402 will be signaled. 403 404 15) If the DSK segment's coordinate system is not latitudinal 405 (aka planetocentric), the error SPICE(BADCOORDSYSTEM) is signaled. 406 407 -Files 408 409 Appropriate DSK, SPK, PCK, and frame data must be available to 410 the calling program before this routine is called. Typically 411 the data are made available by loading kernels; however the 412 data may be supplied via subroutine interfaces if applicable. 413 414 The following data are required: 415 416 - DSK data: a DSK file containing a plate model representing the 417 target body's surface must be loaded. This kernel must contain 418 a type 2 segment that contains data for the entire surface of 419 the target body. 420 421 - SPK data: ephemeris data for target, observer, and Sun must be 422 loaded. If aberration corrections are used, the states of 423 target and observer relative to the solar system barycenter 424 must be calculable from the available ephemeris data. Typically 425 ephemeris data are made available by loading one or more SPK 426 files via furnsh_c. 427 428 - PCK data: rotation data for the target body must 429 be loaded. These may be provided in a text or binary PCK file. 430 Either type of file may be loaded via furnsh_c. 431 432 - Frame data: if a frame definition is required to convert 433 the observer and target states to the body-fixed frame of 434 the target, that definition must be available in the kernel 435 pool. Typically the definition is supplied by loading a 436 frame kernel via furnsh_c. 437 438 In all cases, kernel data are normally loaded once per program 439 run, NOT every time this routine is called. 440 441 442 -Particulars 443 444 445 The term "illumination angles" refers to following set of 446 angles: 447 448 449 solar incidence angle Angle between the surface normal at the 450 specified surface point and the vector 451 from the surface point to the Sun. 452 453 emission angle Angle between the surface normal at the 454 specified surface point and the vector 455 from the surface point to the observer. 456 457 phase angle Angle between the vectors from the 458 surface point to the observing body and 459 from the surface point to the Sun. 460 461 462 The diagram below illustrates the geometric relationships defining 463 these angles. The labels for the solar incidence, emission, and 464 phase angles are "s.i.", "e.", and "phase". 465 466 467 * 468 Sun 469 470 surface normal vector 471 ._ _. 472 |\ /| Sun vector 473 \ phase / 474 \ . . / 475 . . 476 \ ___ / 477 . \/ \/ 478 _\ s.i./ 479 . / \ / 480 . | e. \ / 481 * <--------------- * surface point on 482 viewing vector target body 483 location to viewing 484 (observer) location 485 486 487 Note that if the target-observer vector, the target normal vector 488 at the surface point, and the target-sun vector are coplanar, then 489 phase is the sum of incidence and emission. This is rarely true; 490 usually 491 492 phase angle < solar incidence angle + emission angle 493 494 495 All of the above angles can be computed using light time 496 corrections, light time and stellar aberration corrections, or 497 no aberration corrections. The way aberration corrections 498 are used is described below. 499 500 Care must be used in computing light time corrections. The 501 guiding principle used here is "describe what appears in 502 an image." 503 504 505 Observer-target body surface point vector 506 ----------------------------------------- 507 508 Let `et' be the epoch at which an observation or remote 509 sensing measurement is made, and let et - lt ("lt" stands 510 for "light time") be the epoch at which the photons received 511 at `et' were emitted from the body (we use the term "emitted" 512 loosely here). 513 514 The correct observer-target vector points from the observer's 515 location at `et' to the surface point location at et - lt. 516 The target-observer vector points in the opposite direction. 517 518 Since light time corrections are not anti-symmetric, the correct 519 target-observer vector CANNOT be found by negating the light 520 time corrected position of the observer as seen from the 521 target body. 522 523 524 Target body's orientation 525 ------------------------- 526 527 Using the definitions of `et' and `lt' above, the target 528 body's orientation at et-lt is used. The surface 529 normal is dependent on the target body's orientation, so 530 the body's orientation model must be evaluated for the correct 531 epoch. 532 533 534 Target body -- Sun vector 535 ------------------------- 536 537 All surface features on the target body will appear in a 538 measurement made at `et' as they were at the target at epoch 539 et-lt. In particular, lighting on the target body is dependent 540 on the apparent location of the Sun as seen from the target body 541 at et-lt. So, a second light time correction is used in finding 542 the apparent location of the Sun. 543 544 545 Stellar aberration corrections, when used, are applied as follows: 546 547 548 Observer-target body vector 549 --------------------------- 550 551 In addition to light time correction, stellar aberration is used 552 in computing the apparent target surface point position as seen 553 from the observer's location at time `et'. This apparent position 554 defines the observer-target surface point vector. 555 556 557 Target body-Sun vector 558 ---------------------- 559 560 The target body-Sun vector is the apparent position of the Sun, 561 corrected for light time and stellar aberration, as seen from 562 the target body at time et-lt. Note that the target body's 563 position is not affected by the stellar aberration correction 564 applied in finding its apparent position as seen by the 565 observer. 566 567 Once all of the vectors, as well as the target body's orientation, 568 have been computed with the proper aberration corrections, the 569 element of time is eliminated from the computation. The problem 570 becomes a purely geometric one and is described by the diagram above. 571 572 573 -Examples 574 575 The numerical results shown for this example may differ across 576 platforms. The results depend on the SPICE kernels used as input, 577 the compiler and supporting libraries, and the machine specific 578 arithmetic implementation. 579 580 1) Find the illumination angles at both the sub-observer point and 581 sub-solar point on Phobos as seen from Mars for a specified 582 sequence of times. Perform each computation twice, using both the 583 "intercept" and "ellipsoid near point" options for the sub-observer 584 point and sub-solar point computations. Compute the corresponding 585 illumination angles using an ellipsoidal surface for comparison. 586 (Note that the surface points on the plate model generally will 587 not lie on the ellipsoid's surface, so the emission and solar 588 incidence angles won't generally be zero at the sub-observer 589 and sub-solar points, respectively.) 590 591 In the following example program, the file 592 593 phobos_3_3.bds 594 595 is a DSK file containing a type 2 segment that provides a plate model 596 representation of the surface of Phobos. The file 597 598 mar097.bsp 599 600 is a binary SPK file containing data for Phobos, Mars, and the 601 Sun for a time interval starting at the date 602 603 2000 JAN 1 12:00:00 TDB. 604 605 pck00010.tpc is a planetary constants kernel file containing radii 606 and rotation model constants. naif0010.tls is a leapseconds kernel. 607 608 All of the kernels other than the DSK file should be loaded via 609 a meta-kernel. An example of the contents of such a kernel is: 610 611 KPL/MK 612 613 File name: illum.tm 614 615 \begindata 616 617 KERNELS_TO_LOAD = ( 'naif0010.tls' 618 'pck00010.tpc' 619 'mar097.bsp' ) 620 \begintext 621 622 623 Example code begins here: 624 625 /. 626 Find the illumination angles at both the sub-observer point and 627 sub-solar point on Phobos as seen from Mars for a specified 628 sequence of times. Perform each computation twice, using both the 629 "intercept" and "ellipsoid near point" options for the sub-observer 630 point and sub-solar point computations. Compute the corresponding 631 illumination angles using an ellipsoidal surface for comparison. 632 ./ 633 634 #include <stdio.h> 635 #include <math.h> 636 #include "SpiceUsr.h" 637 638 int main() 639 { 640 /. 641 Local parameters 642 ./ 643 #define FILSIZ 256 644 #define NCORR 2 645 #define NSAMP 3 646 #define NMETHOD 2 647 #define TOL ( 1.e-12 ) 648 #define CORLEN 15 649 #define METHLEN 81 650 #define TIMLEN 41 651 #define FRNMLN 33 652 653 /. 654 Local variables 655 ./ 656 SpiceBoolean found; 657 SpiceBoolean lit; 658 SpiceBoolean visible; 659 660 SpiceChar * abcorr; 661 SpiceChar * abcorrs[ NCORR ] = 662 { 663 "NONE", 664 "CN+S" 665 }; 666 667 SpiceChar dsk [ FILSIZ ]; 668 669 SpiceChar * emethod; 670 SpiceChar * emethods[ NMETHOD ] = 671 { 672 "Intercept", 673 "Near point" 674 }; 675 676 SpiceChar fixref [ FRNMLN ]; 677 SpiceChar meta [ FILSIZ ]; 678 SpiceChar * method; 679 SpiceChar * methods [ NMETHOD ] = 680 { 681 "Intercept", 682 "Ellipsoid near point" 683 }; 684 685 SpiceChar * obsrvr = "Mars"; 686 SpiceChar * target = "Phobos"; 687 SpiceChar timstr [ TIMLEN ]; 688 689 SpiceDLADescr dladsc; 690 SpiceDSKDescr dskdsc; 691 692 SpiceDouble alt; 693 SpiceDouble dist; 694 SpiceDouble emissn; 695 SpiceDouble esrfvc [3]; 696 SpiceDouble et0; 697 SpiceDouble etrgep; 698 SpiceDouble et; 699 SpiceDouble phase; 700 SpiceDouble solar; 701 SpiceDouble srfvec [3]; 702 SpiceDouble stepsize; 703 SpiceDouble trgepc; 704 SpiceDouble xlat; 705 SpiceDouble xlon; 706 SpiceDouble xpt [3]; 707 SpiceDouble xr; 708 709 SpiceInt coridx; 710 SpiceInt handle; 711 SpiceInt i; 712 SpiceInt midx; 713 SpiceInt plid; 714 715 /. 716 Prompt for the name of a meta-kernel specifying 717 all of the other kernels we need. Load the 718 metakernel. 719 ./ 720 prompt_c ( "Enter meta-kernel name > ", FILSIZ, meta ); 721 furnsh_c ( meta ); 722 723 /. 724 Prompt for the name of the DSK to read. 725 ./ 726 prompt_c ( "Enter DSK name > ", FILSIZ, dsk ); 727 728 /. 729 Open the DSK file for read access. 730 We use the DAS-level interface for 731 this function. 732 ./ 733 dasopr_c ( dsk, &handle ); 734 735 /. 736 Begin a forward search through the 737 kernel, treating the file as a DLA. 738 In this example, it's a very short 739 search. 740 ./ 741 dlabfs_c ( handle, &dladsc, &found ); 742 743 if ( !found ) 744 { 745 /. 746 We arrive here only if the kernel 747 contains no segments. This is 748 unexpected, but we're prepared for it. 749 ./ 750 setmsg_c ( "No segments found in DSK file #."); 751 errch_c ( "#", dsk ); 752 sigerr_c ( "SPICE(NODATA)" ); 753 } 754 755 /. 756 If we made it this far, `dladsc' is the 757 DLA descriptor of the first segment. 758 759 Get the DSK descriptor of the segment; from this 760 descriptor we can obtain the ID of body-fixed frame 761 associated with the segment. We'll need this frame 762 later to compute illumination angles on the target 763 body's reference ellipsoid. 764 ./ 765 dskgd_c ( handle, &dladsc, &dskdsc ); 766 767 frmnam_c ( dskdsc.frmcde, FRNMLN, fixref ); 768 769 if ( eqstr_c(fixref, " ") ) 770 { 771 setmsg_c ( "Frame ID code # could not be mapped to " 772 "a frame name." ); 773 errint_c ( "#", dskdsc.frmcde ); 774 sigerr_c ( "SPICE(UNKNOWNFRAME)" ); 775 } 776 777 /. 778 Now compute sub-points using both computation 779 methods. We'll vary the aberration corrections 780 and the epochs. 781 ./ 782 et0 = 0.0; 783 stepsize = 1.e6; 784 785 for ( i = 0; i < NSAMP; i++ ) 786 { 787 /. 788 Set the computation time for the ith 789 sample. 790 ./ 791 et = et0 + i*stepsize; 792 793 timout_c ( et, 794 "YYYY-MON-DD " 795 "HR:MN:SC.### ::TDB(TDB)", 796 TIMLEN, 797 timstr ); 798 799 printf ( "\n\nObservation epoch: %s\n", 800 timstr ); 801 802 for ( coridx = 0; coridx < NCORR; coridx++ ) 803 { 804 /. 805 Select the aberration correction. 806 ./ 807 abcorr = abcorrs[coridx]; 808 printf ( "\n" 809 " abcorr = %s\n", abcorr ); 810 811 for ( midx = 0; midx < NMETHOD; midx++ ) 812 { 813 /. 814 Select the computation method. 815 ./ 816 method = methods [midx]; 817 emethod = emethods[midx]; 818 819 printf ( "\n" 820 " Method = %s\n", method ); 821 822 /. 823 Compute the sub-observer point using a plate model 824 representation of the target's surface. 825 ./ 826 subpt_pl02 ( handle, &dladsc, method, 827 target, et, abcorr, 828 obsrvr, xpt, &alt, &plid ); 829 830 /. 831 Compute the illumination angles at the sub-observer 832 point. Also compute the light-of-sight visibility and 833 shadowing flags. 834 ./ 835 illum_plid_pl02 ( handle, &dladsc, target, et, 836 abcorr, obsrvr, xpt, plid, 837 &trgepc, srfvec, &phase, &solar, 838 &emissn, &visible, &lit ); 839 840 /. 841 Represent the intercept in latitudinal 842 coordinates. 843 ./ 844 reclat_c ( xpt, &xr, &xlon, &xlat ); 845 846 printf ( "\n" 847 " Sub-observer point on plate model surface:\n" 848 " Planetocentric Longitude (deg): %f\n" 849 " Planetocentric Latitude (deg): %f\n" 850 "\n" 851 " Illumination angles derived using a\n" 852 " plate model surface:\n" 853 " Phase angle (deg): %f\n" 854 " Solar incidence angle (deg): %f\n" 855 " Illumination flag : %ld\n" 856 " Emission angle (deg): %f\n" 857 " Visibility flag : %ld\n" 858 " Range to surface point (km): %15.9e\n", 859 xlon * dpr_c(), 860 xlat * dpr_c(), 861 phase * dpr_c(), 862 solar * dpr_c(), 863 (long) lit, 864 emissn * dpr_c(), 865 (long) visible, 866 vnorm_c( srfvec ) ); 867 868 /. 869 Compute the illumination angles using an ellipsoidal 870 representation of the target's surface. The role of 871 this representation is to provide an outward surface 872 normal. 873 ./ 874 ilumin_c ( "Ellipsoid", target, et, fixref, 875 abcorr, obsrvr, xpt, &etrgep, 876 esrfvc, &phase, &solar, &emissn ); 877 878 printf ( 879 " Illumination angles derived using an\n" 880 " ellipsoidal reference surface:\n" 881 " Phase angle (deg): %f\n" 882 " Solar incidence angle (deg): %f\n" 883 " Emission angle (deg): %f\n", 884 phase * dpr_c(), 885 solar * dpr_c(), 886 emissn * dpr_c() ); 887 888 /. 889 Now repeat our computations using the sub-solar point. 890 891 Compute the sub-solar point using a plate model 892 representation of the target's surface. 893 ./ 894 subsol_pl02 ( handle, &dladsc, method, 895 target, et, abcorr, 896 obsrvr, xpt, &dist, &plid ); 897 898 /. 899 Compute the illumination angles at the sub-solar point. 900 Also compute the light-of-sight visibility and 901 shadowing flags. 902 ./ 903 illum_plid_pl02 ( handle, &dladsc, target, et, 904 abcorr, obsrvr, xpt, plid, 905 &trgepc, srfvec, &phase, &solar, 906 &emissn, &visible, &lit ); 907 908 /. 909 Represent the intercept in latitudinal coordinates. 910 ./ 911 reclat_c ( xpt, &xr, &xlon, &xlat ); 912 913 printf ( "\n" 914 " Sub-solar point on plate model surface:\n" 915 " Planetocentric Longitude (deg): %f\n" 916 " Planetocentric Latitude (deg): %f\n" 917 "\n" 918 " Illumination angles derived using a\n" 919 " plate model surface:\n" 920 " Phase angle (deg): %f\n" 921 " Solar incidence angle (deg): %f\n" 922 " Illumination flag : %ld\n" 923 " Emission angle (deg): %f\n" 924 " Visibility flag : %ld\n" 925 " Range to surface point (km): %15.9e\n", 926 xlon * dpr_c(), 927 xlat * dpr_c(), 928 phase * dpr_c(), 929 solar * dpr_c(), 930 (long) lit, 931 emissn * dpr_c(), 932 (long) visible, 933 vnorm_c( srfvec ) ); 934 935 /. 936 Compute the illumination angles using an ellipsoidal 937 representation of the target's surface. The role of 938 this representation is to provide an outward surface 939 normal. 940 ./ 941 ilumin_c ( "Ellipsoid", target, et, fixref, 942 abcorr, obsrvr, xpt, &etrgep, 943 esrfvc, &phase, &solar, &emissn ); 944 945 printf ( 946 " Illumination angles derived using an\n" 947 " ellipsoidal reference surface:\n" 948 " Phase angle (deg): %f\n" 949 " Solar incidence angle (deg): %f\n" 950 " Emission angle (deg): %f\n", 951 phase * dpr_c(), 952 solar * dpr_c(), 953 emissn * dpr_c() ); 954 } 955 } 956 } 957 958 /. 959 Close the kernel. This isn't necessary in a stand- 960 alone program, but it's good practice in subroutines 961 because it frees program and system resources. 962 ./ 963 dascls_c ( handle ); 964 965 return ( 0 ); 966 } 967 968 969 When this program was executed on a PC/Linux/gcc platform, 970 the output for the first epoch (the rest of the output 971 is not shown due to its large volume) was: 972 973 Enter meta-kernel name > illum.tm 974 Enter DSK name > phobos_3_3.bds 975 976 977 Observation epoch: 2000-JAN-01 12:00:00.000 (TDB) 978 979 abcorr = NONE 980 981 Method = Intercept 982 983 Sub-observer point on plate model surface: 984 Planetocentric Longitude (deg): -0.348118 985 Planetocentric Latitude (deg): 0.008861 986 987 Illumination angles derived using a 988 plate model surface: 989 Phase angle (deg): 101.596824 990 Solar incidence angle (deg): 98.376877 991 Illumination flag : 0 992 Emission angle (deg): 9.812914 993 Visibility flag : 1 994 Range to surface point (km): 9.501835727e+03 995 Illumination angles derived using an 996 ellipsoidal reference surface: 997 Phase angle (deg): 101.596824 998 Solar incidence angle (deg): 101.695444 999 Emission angle (deg): 0.104977 1000 1001 Sub-solar point on plate model surface: 1002 Planetocentric Longitude (deg): 102.413905 1003 Planetocentric Latitude (deg): -24.533127 1004 1005 Illumination angles derived using a 1006 plate model surface: 1007 Phase angle (deg): 101.665306 1008 Solar incidence angle (deg): 13.068798 1009 Illumination flag : 1 1010 Emission angle (deg): 98.408735 1011 Visibility flag : 0 1012 Range to surface point (km): 9.516720964e+03 1013 Illumination angles derived using an 1014 ellipsoidal reference surface: 1015 Phase angle (deg): 101.665306 1016 Solar incidence angle (deg): 11.594741 1017 Emission angle (deg): 98.125499 1018 1019 Method = Ellipsoid near point 1020 1021 Sub-observer point on plate model surface: 1022 Planetocentric Longitude (deg): -0.264850 1023 Planetocentric Latitude (deg): 0.004180 1024 1025 Illumination angles derived using a 1026 plate model surface: 1027 Phase angle (deg): 101.596926 1028 Solar incidence angle (deg): 98.376877 1029 Illumination flag : 0 1030 Emission angle (deg): 9.812985 1031 Visibility flag : 1 1032 Range to surface point (km): 9.501837763e+03 1033 Illumination angles derived using an 1034 ellipsoidal reference surface: 1035 Phase angle (deg): 101.596926 1036 Solar incidence angle (deg): 101.593324 1037 Emission angle (deg): 0.003834 1038 1039 Sub-solar point on plate model surface: 1040 Planetocentric Longitude (deg): 105.857346 1041 Planetocentric Latitude (deg): -16.270558 1042 1043 Illumination angles derived using a 1044 plate model surface: 1045 Phase angle (deg): 101.663675 1046 Solar incidence angle (deg): 16.476730 1047 Illumination flag : 1 1048 Emission angle (deg): 118.124981 1049 Visibility flag : 0 1050 Range to surface point (km): 9.517506732e+03 1051 Illumination angles derived using an 1052 ellipsoidal reference surface: 1053 Phase angle (deg): 101.663675 1054 Solar incidence angle (deg): 0.422781 1055 Emission angle (deg): 101.541470 1056 1057 abcorr = CN+S 1058 1059 Method = Intercept 1060 1061 Sub-observer point on plate model surface: 1062 Planetocentric Longitude (deg): -0.348101 1063 Planetocentric Latitude (deg): 0.008861 1064 1065 Illumination angles derived using a 1066 plate model surface: 1067 Phase angle (deg): 101.592246 1068 Solar incidence angle (deg): 98.372348 1069 Illumination flag : 0 1070 Emission angle (deg): 9.812902 1071 Visibility flag : 1 1072 Range to surface point (km): 9.502655917e+03 1073 Illumination angles derived using an 1074 ellipsoidal reference surface: 1075 Phase angle (deg): 101.592246 1076 Solar incidence angle (deg): 101.690861 1077 Emission angle (deg): 0.104971 1078 1079 Sub-solar point on plate model surface: 1080 Planetocentric Longitude (deg): 102.408894 1081 Planetocentric Latitude (deg): -24.533381 1082 1083 Illumination angles derived using a 1084 plate model surface: 1085 Phase angle (deg): 101.660730 1086 Solar incidence angle (deg): 13.067923 1087 Illumination flag : 1 1088 Emission angle (deg): 98.408722 1089 Visibility flag : 0 1090 Range to surface point (km): 9.517541354e+03 1091 Illumination angles derived using an 1092 ellipsoidal reference surface: 1093 Phase angle (deg): 101.660730 1094 Solar incidence angle (deg): 11.594406 1095 Emission angle (deg): 98.122308 1096 1097 Method = Ellipsoid near point 1098 1099 Sub-observer point on plate model surface: 1100 Planetocentric Longitude (deg): -0.264837 1101 Planetocentric Latitude (deg): 0.004180 1102 1103 Illumination angles derived using a 1104 plate model surface: 1105 Phase angle (deg): 101.592348 1106 Solar incidence angle (deg): 98.372348 1107 Illumination flag : 0 1108 Emission angle (deg): 9.812973 1109 Visibility flag : 1 1110 Range to surface point (km): 9.502657952e+03 1111 Illumination angles derived using an 1112 ellipsoidal reference surface: 1113 Phase angle (deg): 101.592348 1114 Solar incidence angle (deg): 101.588746 1115 Emission angle (deg): 0.003834 1116 1117 Sub-solar point on plate model surface: 1118 Planetocentric Longitude (deg): 105.850972 1119 Planetocentric Latitude (deg): -16.271178 1120 1121 Illumination angles derived using a 1122 plate model surface: 1123 Phase angle (deg): 101.659102 1124 Solar incidence angle (deg): 16.481294 1125 Illumination flag : 1 1126 Emission angle (deg): 118.124969 1127 Visibility flag : 0 1128 Range to surface point (km): 9.518326968e+03 1129 Illumination angles derived using an 1130 ellipsoidal reference surface: 1131 Phase angle (deg): 101.659102 1132 Solar incidence angle (deg): 0.423140 1133 Emission angle (deg): 101.536837 1134 1135 1136 1137 -Restrictions 1138 1139 1) The solar illumination state indicated by the output argument `lit' 1140 is computed treating the sun as a point light source. Surface 1141 points that are illuminated by part of the sun's disc are 1142 classified as "lit" or not depending on whether the center of the 1143 sun is visible from those points. 1144 1145 -Literature_References 1146 1147 None. 1148 1149 -Author_and_Institution 1150 1151 N.J. Bachman (JPL) 1152 1153 -Version 1154 1155 -CSPICE Version 1.0.0, 22-FEB-2017 (NJB) 1156 1157 Bug fix: the DSK segment's surface ID code is no longer 1158 required to match that of the target. The segment's 1159 center ID must match. 1160 1161 Include file references have been updated. 1162 1163 Added failed_c calls. 1164 1165 02-SEP-2014 (NJB) 1166 1167 Based on illum_pl02 Beta Version 1.3.0, 30-APR-2014 (NJB) (BVS) 1168 1169 1170 -Index_Entries 1171 1172 plate model surface point visibility and shadowing 1173 illumination angles using DSK type 2 plate model 1174 lighting angles using DSK type 2 plate model 1175 phase angle using DSK type 2 plate model 1176 emission angle using DSK type 2 plate model 1177 solar incidence angle using DSK type 2 plate model 1178 1179 -& 1180 */ 1181 1182 { /* Begin illum_plid_pl02 */ 1183 1184 1185 /* 1186 Prototypes 1187 */ 1188 int dskgd_(integer *handle, integer *dladsc, doublereal *dskdsc); 1189 1190 1191 /* 1192 Local parameters 1193 */ 1194 #define FRNMLN 33 1195 #define CORLEN 16 1196 #define TOLSCL 1.e-10 1197 1198 /* 1199 Local variables 1200 */ 1201 SpiceBoolean found; 1202 1203 SpiceChar loccor [ CORLEN ]; 1204 SpiceChar fixref [ FRNMLN ]; 1205 1206 SpiceDSKDescr dskdsc; 1207 1208 SpiceDouble ltsun; 1209 SpiceDouble lttarg; 1210 SpiceDouble maxrad; 1211 SpiceDouble normal [ 3 ]; 1212 SpiceDouble obsvec [ 3 ]; 1213 SpiceDouble shiftpt [ 3 ] ; 1214 SpiceDouble sunsta [ 6 ]; 1215 SpiceDouble tol; 1216 SpiceDouble trgsta [ 6 ]; 1217 SpiceDouble xpt [ 3 ]; 1218 1219 SpiceInt centerID; 1220 SpiceInt dataType; 1221 SpiceInt frcode; 1222 SpiceInt obscde; 1223 SpiceInt trgcde; 1224 SpiceInt xplid; 1225 1226 1227 /* 1228 Participate in error tracing. 1229 */ 1230 if ( return_c() ) 1231 { 1232 return; 1233 } 1234 chkin_c ( "illum_plid_pl02" ); 1235 1236 1237 /* 1238 Check the input strings: method, target, abcorr, and obsrvr. Make 1239 sure none of the pointers are null and that each string contains at 1240 least one non-null character. 1241 */ 1242 CHKFSTR ( CHK_STANDARD, "illum_plid_pl02", target ); 1243 CHKFSTR ( CHK_STANDARD, "illum_plid_pl02", abcorr ); 1244 CHKFSTR ( CHK_STANDARD, "illum_plid_pl02", obsrvr ); 1245 1246 /* 1247 Check the aberration correction string: reject transmission 1248 corrections. 1249 */ 1250 ljust_ ( ( char * ) abcorr, 1251 ( char * ) loccor, 1252 ( ftnlen ) strlen(abcorr), 1253 ( ftnlen ) CORLEN-1 ); 1254 1255 if ( matchi_c( loccor, "X*", '*', '?' ) ) 1256 { 1257 setmsg_c ( "Input aberration correction specification # " 1258 "calls for transmission-style corrections." ); 1259 errch_c ( "#", abcorr ); 1260 sigerr_c ( "SPICE(NOTSUPPORTED)" ); 1261 chkout_c ( "illum_plid_pl02" ); 1262 return; 1263 } 1264 1265 1266 1267 /* 1268 Obtain integer codes for the target and observer. 1269 */ 1270 bods2c_c ( target, &trgcde, &found ); 1271 1272 if ( failed_c() ) 1273 { 1274 chkout_c ( "illum_plid_pl02" ); 1275 return; 1276 } 1277 1278 if ( !found ) 1279 { 1280 setmsg_c ( "The target, '#', is not a recognized name for an " 1281 "ephemeris object. The cause of this problem may be " 1282 "that you need an updated version of the SPICE " 1283 "Toolkit." ); 1284 errch_c ( "#", target ); 1285 sigerr_c ( "SPICE(IDCODENOTFOUND)" ); 1286 chkout_c ( "illum_plid_pl02" ); 1287 return; 1288 } 1289 1290 bods2c_c ( obsrvr, &obscde, &found ); 1291 1292 if ( failed_c() ) 1293 { 1294 chkout_c ( "illum_plid_pl02" ); 1295 return; 1296 } 1297 1298 if ( !found ) 1299 { 1300 setmsg_c ( "The observer, '#', is not a recognized name for an " 1301 "ephemeris object. The cause of this problem may be " 1302 "that you need an updated version of the SPICE " 1303 "Toolkit." ); 1304 errch_c ( "#", obsrvr ); 1305 sigerr_c ( "SPICE(IDCODENOTFOUND)" ); 1306 chkout_c ( "illum_plid_pl02" ); 1307 return; 1308 } 1309 1310 /* 1311 Make sure target and observer don't coincide. 1312 */ 1313 if ( trgcde == obscde ) 1314 { 1315 setmsg_c ( "Both target and observer have the same integer " 1316 "ID code #. These objects must be distinct." ); 1317 errint_c ( "#", obscde ); 1318 sigerr_c ( "SPICE(BODIESNOTDISTINCT)" ); 1319 chkout_c ( "illum_plid_pl02" ); 1320 return; 1321 } 1322 1323 1324 /* 1325 Fetch and examine the DSK descriptor of the segment from which we're 1326 getting the shape data. Make sure this is a type 2 segment for the 1327 specified target. Since we don't know a priori that the segment 1328 has type 2, we can't use the type 2 fetch routine for this operation. 1329 */ 1330 1331 dskgd_c ( handle, dladsc, &dskdsc ); 1332 1333 if ( failed_c() ) 1334 { 1335 chkout_c ( "illum_plid_pl02" ); 1336 return; 1337 } 1338 1339 /* 1340 Extract object ID and DSK data type from the DSK descriptor. 1341 */ 1342 centerID = dskdsc.center; 1343 dataType = dskdsc.dtype; 1344 1345 if ( centerID != trgcde ) 1346 { 1347 setmsg_c ( "Input segment is for object with integer ID " 1348 "code #, which does not match target ID code #." ); 1349 errint_c ( "#", centerID ); 1350 errint_c ( "#", trgcde ); 1351 sigerr_c ( "SPICE(TARGETMISMATCH)" ); 1352 chkout_c ( "illum_plid_pl02" ); 1353 return; 1354 } 1355 1356 if ( dataType != 2 ) 1357 { 1358 setmsg_c ( "Input segment has DSK data type #. A segment of " 1359 "type 2 is required." ); 1360 errint_c ( "#", dataType ); 1361 sigerr_c ( "SPICE(WRONGDATATYPE)" ); 1362 chkout_c ( "illum_plid_pl02" ); 1363 return; 1364 } 1365 1366 1367 /* 1368 Extract frame ID from the DSK descriptor; get the name of the 1369 default body-fixed reference frame associated with the target body. 1370 */ 1371 frcode = dskdsc.frmcde; 1372 1373 frmnam_c ( frcode, FRNMLN, fixref ); 1374 1375 if ( eqstr_c( fixref, " " ) ) 1376 { 1377 setmsg_c ( "No body-fixed frame name is associated with " 1378 "frame ID code #; a frame kernel must be " 1379 "loaded to make this association. Consult " 1380 "the FRAMES Required Reading for details." ); 1381 errint_c ( "#", frcode ); 1382 sigerr_c ( "SPICE(FRAMENAMENOTFOUND)" ); 1383 chkout_c ( "illum_plid_pl02" ); 1384 return; 1385 } 1386 1387 1388 /* 1389 Check the segment's coordinate system. This routine handles 1390 only latitudinal coordinates: they're used to provide the 1391 segment's maximum radius value. 1392 */ 1393 if ( dskdsc.corsys != SPICE_DSK_LATSYS ) 1394 { 1395 setmsg_c ( "The input DSK segment's coordinate system code # " 1396 "designates a system not currently supported by " 1397 "this routine. The system must be latitudinal. " 1398 "See the header file SpiceDSK.h for coordinate " 1399 "system codes." ); 1400 errint_c ( "#", dskdsc.corsys ); 1401 sigerr_c ( "SPICE(FRAMENAMENOTFOUND)" ); 1402 chkout_c ( "illum_plid_pl02" ); 1403 return; 1404 } 1405 1406 1407 /* 1408 We're done with error checks on our inputs. 1409 1410 Get the outward normal vector at the input plate. 1411 */ 1412 dskn02_c ( handle, dladsc, plid, normal ); 1413 1414 if ( failed_c() ) 1415 { 1416 chkout_c ( "illum_plid_pl02" ); 1417 return; 1418 } 1419 1420 /* 1421 Compute the aberration-corrected position of the surface point 1422 `spoint' as seen from the observer. Use the aberration-corrected 1423 target body-fixed reference frame. Negate the target position to obtain 1424 the target-observer vector. Let `trgepc' be the epoch associated with 1425 the target. 1426 */ 1427 spkcpt_c ( spoint, target, fixref, et, fixref, 1428 "TARGET", abcorr, obsrvr, trgsta, <targ ); 1429 1430 if ( failed_c() ) 1431 { 1432 chkout_c ( "illum_plid_pl02" ); 1433 return; 1434 } 1435 1436 vequ_c ( trgsta, srfvec ); 1437 vminus_c ( srfvec, obsvec ); 1438 1439 zzcorepc_ ( ( char * ) abcorr, 1440 ( doublereal * ) &et, 1441 ( doublereal * ) <targ, 1442 ( doublereal * ) trgepc, 1443 ( ftnlen ) strlen(abcorr) ); 1444 1445 /* 1446 Now find the apparent position of the Sun as seen from the 1447 target center at `trgepc'. 1448 */ 1449 spkcpo_c ( "Sun", *trgepc, fixref, "OBSERVER", abcorr, 1450 spoint, target, fixref, sunsta, <sun ); 1451 1452 if ( failed_c() ) 1453 { 1454 chkout_c ( "illum_plid_pl02" ); 1455 return; 1456 } 1457 1458 /* 1459 Find the illumination angles. vsep_c will give us angular 1460 separation in radians. 1461 */ 1462 1463 *phase = vsep_c ( sunsta, obsvec ); 1464 *solar = vsep_c ( normal, sunsta ); 1465 *emissn = vsep_c ( normal, obsvec ); 1466 1467 1468 /* 1469 Determine whether the observer-target vector intercepts the surface 1470 before reaching the surface point. We'll use the negative of this 1471 vector for the computation, and we'll shift the surface point "up" 1472 (in the outward normal direction) in order to be able do detect 1473 an intersection with the plate on which `spoint' lies. 1474 */ 1475 maxrad = dskdsc.co3max; 1476 tol = TOLSCL * maxrad; 1477 1478 vlcom_c ( 1.0, spoint, tol, normal, shiftpt ); 1479 1480 dskx02_c ( handle, dladsc, shiftpt, obsvec, &xplid, xpt, &found ); 1481 1482 if ( failed_c() ) 1483 { 1484 chkout_c ( "illum_plid_pl02" ); 1485 return; 1486 } 1487 1488 /* 1489 If this ray hits the surface, the line of sight between observer 1490 and target is blocked. To avoid contradictions in outputs due to 1491 numerical errors, take the emission angle into account. 1492 */ 1493 1494 *visible = ( !found ) && ( *emissn < halfpi_c() ); 1495 1496 1497 /* 1498 Perform the analogous computation for the surface point to sun 1499 vector. 1500 */ 1501 dskx02_c ( handle, dladsc, shiftpt, sunsta, &xplid, xpt, &found ); 1502 1503 if ( failed_c() ) 1504 { 1505 chkout_c ( "illum_plid_pl02" ); 1506 return; 1507 } 1508 1509 1510 *lit = ( !found ) && ( *solar < halfpi_c() ); 1511 1512 1513 chkout_c ( "illum_plid_pl02" ); 1514 1515 } /* End illum_plid_pl02 */ 1516