Index of Functions: A B C D E F G H I J K L M N O P Q R S T U V W X
Index Page pltnrm_c

Table of contents

Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input | Detailed_Output Parameters Exceptions Files Particulars Examples | Restrictions Literature_References Author_and_Institution Version Index_Entries

#### Procedure

       pltnrm_c ( DSK, compute outward normal of plate )

       void pltnrm_c ( ConstSpiceDouble    v1[3],
                       ConstSpiceDouble    v2[3],
                       ConstSpiceDouble    v3[3],
                       SpiceDouble         normal[3] )

#### Abstract

       Compute an outward normal vector of a triangular plate.
       The vector does not necessarily have unit length.

#### Required_Reading

       DSK

#### Keywords

       DSK
       FILES
       TOPOGRAPHY

#### Brief_I/O

       VARIABLE  I/O  DESCRIPTION
       --------  ---  --------------------------------------------------
       v1,
       v2,
       v3         I   Vertices of a plate.
       normal     O   Plate's outward normal vector.

#### Detailed_Input

       v1,
       v2,
       v3          are vertices of a triangular plate.

#### Detailed_Output

       normal      is an outward normal vector of the plate defined by
                   the input vertices. The order of the vertices is
                   used to determine the choice of normal direction:
                   the normal vector is

                      ( v2 - v1 ) x ( v3 - v2 )

#### Parameters

       None.

#### Exceptions

       1)  The input plate may be degenerate: it may be a line segment
           or a point. These are not considered to be erroneous inputs.

#### Files

       None.

#### Particulars

       This routine saves computation time by not scaling the output
       vector to unit length. The caller can scale the vector using
       the routine vhat_c.

#### Examples

       The numerical results shown for this example may differ across
       platforms. The results depend on the SPICE kernels used as input
       (if any), the compiler and supporting libraries, and the machine
       specific arithmetic implementation.

       1) Compute an upward normal of an equilateral triangle lying
          in the X-Y plane and centered at the origin.

          Example code begins here.

          /.
             Program pltnrm_ex1
          ./

          #include <stdio.h>
          #include <math.h>
          #include "SpiceUsr.h"

          int main()
          {
             /.
             Local variables
             ./
             SpiceDouble             normal[3];
             SpiceDouble             s;
             SpiceDouble             v1[3];
             SpiceDouble             v2[3];
             SpiceDouble             v3[3];

             s = sqrt(3.0)/2;

             vpack_c (   s,  -0.5,  0.0, v1 );
             vpack_c ( 0.0,   1.0,  0.0, v2 );
             vpack_c (  -s,  -0.5,  0.0, v3 );

             pltnrm_c ( v1, v2, v3, normal );

             printf ( "NORMAL = %18.14f %18.14f %18.14f\n",
                      normal[0], normal[1], normal[2]      );

             return ( 0 );
          }

          When this program was executed on a Mac/Intel/cc/64-bit
          platform, the output was:

          NORMAL =   0.00000000000000   0.00000000000000   2.59807621135332

#### Restrictions

       None.

#### Literature_References

       None.

#### Author_and_Institution

       N.J. Bachman        (JPL)
       J. Diaz del Rio     (ODC Space)

#### Version

       -CSPICE Version 1.0.1, 10-AUG-2021 (JDR)

           Edited header to comply with NAIF standard.

           Changed code example output format for the solution to fit
           within the -Examples section without modifications.

       -CSPICE Version 1.0.0, 26-JAN-2016 (NJB)

#### Index_Entries

       compute normal vector of triangular plate from vertices

#### Link to routine pltnrm_c source file pltnrm_c.c

    Fri Dec 31 18:41:10 2021