Index Page pltnrm_c

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

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

       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

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

          Example code begins here.

             #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.11e %18.11e %18.11e\n",
                         normal[0], normal[1], normal[2]      );

                return ( 0 );
             }

          When run on a PC/Linux/gcc/64-bit platform, the output
          from this program was:

       NORMAL =  0.000000000000E+00  0.000000000000E+00  0.259807621135E+01

#### Restrictions

       None.

#### Literature_References

       None.

#### Author_and_Institution

       N.J. Bachman    (JPL)

#### Version

       -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

    Wed Apr  5 17:54:40 2017