Table of contents
CSPICE_NVC2PL constructs a SPICE plane from a normal vector and a constant.
Given:
normal,
konst are, respectively, a double precision normal 3-vector and double
precision constant defining a plane.
help, normal
DOUBLE = Array[3]
help, konst
DOUBLE = Scalar
`normal' need not be a unit vector.
Let the symbol < a, b > indicate the
inner product of vectors a and b; then the
then the geometric plane is the set of vectors x
in three-dimensional space that satisfy
< x, normal > = konst.
the call:
cspice_nvc2pl, normal, konst, plane
returns:
plane a structure representing the SPICE plane as defined by `normal'
and `konst'.
help, plane
STRUCT = CSPICE_PLANE
The structure has the fields:
plane.normal: [3-array double]
plane.constant: [scalar double]
None.
Any numerical results shown for these examples may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
1) Construct a SPICE plane from a normal vector and a constant.
Example code begins here.
PRO nvc2pl_ex1
;;
;; Define an arbitrary normal and constant...
;;
normal = [ 1.d, 1.d, 1.d ]
konst = 23.d
;;
;; ...then construct the SPICE plane.
;;
cspice_nvc2pl, normal, konst, plane
print, 'Plane:'
print, ' Constant:', plane.constant
print, ' Normal :', plane.normal
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Plane:
Constant: 13.279056
Normal : 0.57735027 0.57735027 0.57735027
2) Apply a linear transformation represented by a matrix to
a plane represented by a normal vector and a constant.
Find a normal vector and constant for the transformed plane.
Example code begins here.
PRO nvc2pl_ex2
;;
;; Set the normal vector and the constant defining the
;; initial plane.
;;
normal = [-0.1616904d, 0.8084521d, -0.5659165d]
konst = 4.8102899d
;;
;; Define a transformation matrix to the right-handed
;; reference frame having the +i unit vector as primary
;; axis, aligned to the original frame's +X axis, and
;; the -j unit vector as second axis, aligned to the +Y
;; axis.
;;
axdef = [1.0d, 0.0d, 0.0d]
plndef = [0.0d, -1.0d, 0.0d]
cspice_twovec, axdef, 1, plndef, 2, m
;;
;; Make a SPICE plane from `normal' and `konst', and then
;; find a point in the plane and spanning vectors for the
;; plane. `normal' need not be a unit vector.
;;
cspice_nvc2pl, normal, konst, plane
cspice_pl2psv, plane, point, span1, span2
;;
;; Apply the linear transformation to the point and
;; spanning vectors. All we need to do is multiply
;; these vectors by `m', since for any linear
;; transformation T,
;;
;; T ( point + t1 * span1 + t2 * span2 )
;;
;; = T (point) + t1 * T(span1) + t2 * T(span2),
;;
;; which means that T(point), T(span1), and T(span2)
;; are a point and spanning vectors for the transformed
;; plane.
;;
cspice_mxv, m, point, tpoint
cspice_mxv, m, span1, tspan1
cspice_mxv, m, span2, tspan2
;;
;; Make a new SPICE plane `tplane' from the
;; transformed point and spanning vectors, and find a
;; unit normal and constant for this new plane.
;;
cspice_psv2pl, tpoint, tspan1, tspan2, tplane
cspice_pl2nvc, tplane, tnorml, tkonst
;;
;; Print the results.
;;
print, format='(A,3F12.7)', 'Unit normal vector:', tnorml[0], $
tnorml[1], tnorml[2]
print, format='(A,F12.7)', 'Constant :', tkonst
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Unit normal vector: -0.1616904 -0.8084521 0.5659165
Constant : 4.8102897
Icy geometry routines that deal with planes use the `plane'
data type to represent input and output planes. This data type
makes the subroutine interfaces simpler and more uniform.
The Icy routines that produce SPICE planes from data that
define a plane are:
cspice_nvc2pl ( Normal vector and constant to plane )
cspice_nvp2pl ( Normal vector and point to plane )
cspice_psv2pl ( Point and spanning vectors to plane )
The Icy routines that convert SPICE planes to data that
define a plane are:
cspice_pl2nvc ( Plane to normal vector and constant )
cspice_pl2nvp ( Plane to normal vector and point )
cspice_pl2psv ( Plane to point and spanning vectors )
Any of these last three routines may be used to convert this
routine's output, 'plane', to another representation of a
geometric plane.
1) If the input vector `normal' is the zero vector, the error
SPICE(ZEROVECTOR) is signaled by a routine in the call tree of
this routine.
2) If any of the input arguments, `normal' or `konst', is
undefined, an error is signaled by the IDL error handling
system.
3) If any of the input arguments, `normal' or `konst', is not of
the expected type, or it does not have the expected dimensions
and size, an error is signaled by the Icy interface.
4) If the output argument `plane' is not a named variable, an
error is signaled by the Icy interface.
None.
1) No checking is done to prevent arithmetic overflow.
ICY.REQ
PLANES.REQ
[1] G. Thomas and R. Finney, "Calculus and Analytic Geometry,"
7th Edition, Addison Wesley, 1988.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.1.0, 24-AUG-2021 (JDR)
Changed the input argument name "constant" to "konst" for
consistency with other routines.
Edited the -Examples section to comply with NAIF standard. Added
example's problem statement, reformatted example's output and
added second example.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.2, 23-NOV-2010 (EDW)
Edits to -I/O section so as to parallel Mice version.
-Icy Version 1.0.1, 24-NOV-2008 (EDW)
Edited header section -I/O and -Particulars.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
normal vector and constant to plane
|