[Spice_discussion] ITOKAWA plate model

Naru HIRATA narunaru at kobe-u.ac.jp
Sat Jun 25 01:14:23 PDT 2005


I have two problems on the platelib of SPICE.

I found that the routine 'PLBORE' returns an error at the particular 
combination of a viewing positon and a LOS vector, i.e.

>Toolkit version: N0058
>Ray origin not in voxel grid.
>A traceback follows.  The name of the highest level module is first.
>Oh, by the way:  The SPICELIB error handling actions are USER-TAILORABLE.  You
>can choose whether the Toolkit aborts or continues when errors occur, which
>error messages to output, and where to send the output.  Please read the ERROR
>"Required Reading" file, or see the routines ERRACT, ERRDEV, and ERRPRT.

I used this plate kernel of ITOKAWA:

attached is a simple source code that reproduces this situation. This tool 
just check whether a input LOS intersects the plate model or not with 

This is an example of parameters with which the error occurs.
>S/C Position [X]: -6.284127 
>S/C Position [Y]: -1.641772 
>S/C Position [Z]: 1.619403 
>LOS vector [X]: 0.11139436
>LOS vector [Y]: 0.03353800
>LOS vector [Z]: -0.0297569 

The expected result is "not found", but the 'NOTINGRID' error has ocuured 
with a parameters close to the above values. The problematic parameters 
seem to be limitted to narrow range (about 0.00000001 for LOS, 0.000001 for 

Another question is also related to the error.
I want to skip a parameter with that error, so set the error handling mode 
to "RETURN" with 

>    erract_c ("SET",STRLEN,"RETURN");

to return on the entry point and to continue a process.

However, the program doesn't return to the main function after error.
Am I misunderstanding something on error handling of SPICE?

Thank you,

Graduate School of Science and Technology,
Kobe University, Nada, Kobe 657-8501, Japan
tel: +81-78-803-6566, fax: +81-78-803-6483
e-mail: narunaru at kobe-u.ac.jp

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "SpiceUsr.h"
#define  STRLEN 32

extern  void rdplat_( SpiceChar [], SpiceInt);
extern  void plbore_( SpiceDouble [], SpiceDouble [], SpiceInt *, SpiceInt *, SpiceDouble [], SpiceBoolean *);
extern  void nthpun_( SpiceInt *, SpiceDouble []);

main(int argc, char *argv[]) {
    SpiceDouble SC_pos_bd[3];
    SpiceDouble      bsight_bd [3]; //boresight vector
    SpiceChar   instr[STRLEN];
    SpiceInt    PLID;
    SpiceInt    BODY;
    SpiceDouble point[3];
    SpiceBoolean found;
    erract_c ("SET",STRLEN,"RETURN");
    rdplat_( "itokawa_4092.bpm" , STRLEN);
    while (1) {
        //input a S/C position in the body-fixed frame
        prompt_c ( "S/C Position [X]: ", STRLEN, instr );
        SC_pos_bd[0] = atof(instr);
        prompt_c ( "S/C Position [Y]: ", STRLEN, instr );
        SC_pos_bd[1] = atof(instr);
        prompt_c ( "S/C Position [Z]: ", STRLEN, instr );
        SC_pos_bd[2] = atof(instr);
        //input a camera LOS vector in the body-fixed frame
        prompt_c ( "LOS vector [X]: ", STRLEN, instr );
        bsight_bd[0] = atof(instr);
        prompt_c ( "LOS vector [Y]: ", STRLEN, instr );
        bsight_bd[1] = atof(instr);
        prompt_c ( "LOS vector [Z]: ", STRLEN, instr );
        bsight_bd[2] = atof(instr);
        plbore_ ( SC_pos_bd, bsight_bd, &PLID, &BODY, point, &found );
        if ( found ) {
            printf ( "PLID : %d  \n", PLID );      
            printf ( "BODY : %d  \n", BODY);      
            printf ("Intercept point %f %f %f\n", point[0],point[1],point[2]);
        else {
            printf ( "No Intercept point.\n" );

More information about the Spice_discussion mailing list