/* -Procedure putfov_pdt ( Place Cassini FOV definitions into the pool ) -Abstract Update or replace Cassini FOV definitions to the kernel pool data structure. -Copyright Copyright (2001), California Institute of Technology. U.S. Government sponsorship acknowledged. -Required_Reading KERNEL */ #include "SpiceUsr.h" void putfov_pdt ( ConstSpiceChar * name, SpiceChar * frame, SpiceChar * shape, SpiceDouble bsight [3], SpiceDouble second [3], SpiceDouble secang, SpiceDouble crsang ) /* -Brief_I/O Variable I/O Description -------- --- -------------------------------------------------- name I instrument name. frame I instrument FOV frame. shape I instrument FOV shape. bsight I boresight vector in instrument frame coordinates. second I FOV secondary axis in instrument frame coordinates. secang I FOV secondary axis half angle in milliradians. crsang I cross axis half angle in milliradians. -Detailed Input name is the name of the instrument or FOV of interest. frame is a properly null-terminated string that contains the name of the frame the instrument FOV vectors are defined. shape is a properly null-terminated string that contains the "shape" of the field of view. Acceptable values are: "RECTANGULAR" "CIRCULAR" "ELLIPTICAL" bsight is the FOV boresight vector in the instrument coordinate frame specified by the input argument frame. second is the FOV secondary axis vector in the instrument coordinate frame specified by the input argument frame. secang is the half angle that describes the angular extent of the detector's field of view that is along the secondary axis specified by the input argument second. crsang is the half angle that describes the angular extent of the detector's field of view that lies along the direction determined by the cross product of the FOV secondary axis with the boresight. For circular FOVs this input argument is ignored. -Detailed Output None. -Exceptions 1) If an ID code is not found for name, then this routine signals the error SPICE(IDCODENOTFOUND). 2) If the ID code associated with name is found, but not in the range [-82999, -82000] then the error SPICE(INVALIDIDCODE) is signalled. This routine functions only with Cassini instrument kernels. 3) If the FOV that is being updated or replaced by this module already exists and is using a specification other than ANGLES, this routine will change the specification to ANGLES. Any surplus keywords and their values associated with the FOV are left in the kernel pool. 4) SPICE(UNSUPPORTEDSHAPE) -Files None. -Particulars -Examples -Restrictions 1) The name of the instrument must be associated with an ID code that is connected with the Cassini orbiter. The association must exist prior to attempting to update the FOV specification. -Literature_References 1) Kernel Required Reading -Author_and_Institution F.S. Turner (JPL) -Version -putfov_pdt Version 1.0.0, 12-APR-2001 (FST) */ { /* Begin putfov_pdt */ /* Local Parameters */ #define MAXKEYSIZE 32 #define MAXSHPSIZE 60 /* Local Variables */ SpiceBoolean gotit = SPICEFALSE; SpiceChar keyword [ MAXKEYSIZE ]; SpiceChar circle [ MAXSHPSIZE ] = "CIRCLE"; SpiceChar ellipse [ MAXSHPSIZE ] = "ELLIPSE"; SpiceChar rectangle [ MAXSHPSIZE ] = "RECTANGLE"; SpiceDouble dpval; SpiceInt idcode; SpiceInt length; /* Participate in tracing. */ chkin_c ( "putfov_pdt" ); /* Fetch the instrument ID code. */ bodn2c_c ( name, &idcode, &gotit ); if ( gotit == SPICEFALSE ) { setmsg_c ( "Unable to locate ID code for instrument, #." ); errch_c ( "#", name ); sigerr_c ( "SPICE(IDCODENOTFOUND)" ); chkout_c ( "getvects_pdt" ); return; } /* Now verify that this ID code is associated with the Cassini orbiter. */ if ( ( idcode < -89999 ) || ( idcode > -82000 ) ) { setmsg_c ( "The instrument, #, with ID code, #, is not " "associated with the Cassini orbiter. This " "module only functions with Cassini based " "detectors." ); errch_c ( "#", name ); errint_c ( "#", idcode ); sigerr_c ( "SPICE(INVALIDIDCODE)" ); chkout_c ( "getvects_pdt" ); return; } /* Record the FOV class specification associated with the values we are loading into the kernel. Remember to account for the terminating null in the string length argument. */ sprintf ( keyword, "INS%ld_FOV_CLASS_SPEC", idcode ); pcpool_c ( keyword, 1, 7, "ANGLES" ); /* Place the name of the FOV frame into the kernel pool. */ sprintf ( keyword, "INS%ld_FOV_FRAME", idcode ); /* Get the length of the frame string. */ length = strlen ( frame ); /* Since pcpool_c wants the length to include the terminating null. */ length++; pcpool_c ( keyword, 1, length, frame ); /* Place the name of the FOV shape into the kernel pool. */ sprintf ( keyword, "INS%ld_FOV_SHAPE", idcode ); if ( eqstr_c ( shape, "CIRCULAR" ) == SPICETRUE ) { length = strlen ( circle ); length++; pcpool_c ( keyword, 1, length, circle ); } else if ( eqstr_c ( shape, "ELLIPTICAL" ) == SPICETRUE ) { length = strlen ( ellipse ); length++; pcpool_c ( keyword, 1, length, ellipse ); } else if ( eqstr_c ( shape, "RECTANGULAR" ) == SPICETRUE ) { length = strlen ( rectangle ); length++; pcpool_c ( keyword, 1, length, rectangle ); } else { setmsg_c ( "The shape, #, specified for the FOV of " "instrument #, is not currently supported." ); errch_c ( "#", shape ); errch_c ( "#", name ); sigerr_c ( "SPICE(UNSUPPORTEDSHAPE)" ); chkout_c ( "putfov_pdt" ); return; } /* Store the boresight vector. */ sprintf ( keyword, "INS%ld_BORESIGHT", idcode ); pdpool_c ( keyword, 3, bsight ); /* Store the FOV reference vector. */ sprintf ( keyword, "INS%ld_FOV_REF_VECTOR", idcode ); pdpool_c ( keyword, 3, second ); /* Store the FOV angular extents. */ sprintf ( keyword, "INS%ld_FOV_ANGLE_UNITS", idcode ); pcpool_c ( keyword, 1, 8, "RADIANS" ); dpval = secang/1000.0; sprintf ( keyword, "INS%ld_FOV_REF_ANGLE", idcode ); pdpool_c ( keyword, 1, &dpval ); dpval = crsang/1000.0; sprintf ( keyword, "INS%ld_FOV_CROSS_ANGLE", idcode ); pdpool_c ( keyword, 1, &dpval ); chkout_c ( "putfov_pdt" ); return; } /* End putfov_pdt */