CSPICE_PLTNRM computes an outward normal vector of a triangular plate.
The vector does not necessarily have unit length.
v3 are 3-vectors constituting the vertices of
a triangular plate.
[3,1] = size(v1); double = class(v1)
[3,1] = size(v2); double = class(v2)
[3,1] = size(v3); double = class(v3)
[normal] = cspice_pltnrm(v1, v2, v3,)
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 )
[3,1] = size(normal); double = class(normal)
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
Compute an outward normal of an equilateral triangle lying
in the X-Y plane and centered at the origin.
s = sqrt(3.0)/2;
v1 = [ s, -0.5, 0.0]';
v2 = [ 0.0, 1.0, 0.0]';
v3 = [ -s, -0.5, 0.0]';
normal = cspice_pltnrm( v1, v2, v3 );
fprintf ( 'NORMAL = %18.11e %18.11e %18.11e\n', ...
normal(1), normal(2), normal(3) );
NORMAL = 0.00000000000e+00 0.00000000000e+00 2.59807621135e+00
This routine saves computation time by not scaling the output
vector to unit length. The caller can scale the vector using
the routine cspice_vhat.
For important details concerning this module's function, please refer to
the CSPICE routine pltnrm_c.
-Mice Version 1.0.0, 17-MAR-2016, EDW (JPL), NJB (JPL)
compute normal vector of triangular plate from vertices