Table of contents
CSPICE_PL2NVC returns a unit normal vector and constant that define a
specified plane.
Given:
plane a SPICE plane.
help, plane
STRUCT = CSPICE_PLANE
The structure has the fields:
normal: [3-array double]
constant: [scalar double]
the call:
cspice_pl2nvc, plane, normal, konst
returns:
normal,
konst respectively, a unit normal vector and constant that
define the geometric plane represented by `plane'.
help, normal
DOUBLE = Array[3]
help, konst
DOUBLE = Scalar
Let the symbol < a, b > indicate the inner product of vectors
`a' and `b'; then the geometric plane is the set of vectors
`x' in three-dimensional space that satisfy
< x, normal > = konst.
`normal' is a unit vector. `konst' is the distance of
the plane from the origin;
konst * normal
is the closest point in the plane to the origin.
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) Determine the distance of a plane from the origin, and
confirm the result by calculating the dot product (inner
product) of a vector from the origin to the plane and a
vector in that plane.
The dot product between these two vectors should be zero,
to double precision round-off, so orthogonal to that
precision.
Example code begins here.
PRO pl2nvc_ex1
;;
;; A simple task, determine the distance of a plane
;; from the origin.
;;
;; Define the plane with a vector normal to the plan
;; and a point in the plane.
;;
normal = [ -1.d, 5.d , -3.5d ]
point = [ 9.d, -0.65d, -12.d ]
;;
;; create the SPICE plane from the normal and point.
;;
cspice_nvp2pl, normal, point, plane
;;
;; Calculate the normal vector and constant defining
;; the plane. The constant value is the distance from
;; the origin to the plane.
;;
cspice_pl2nvc, plane, normal, konst
print, FORMAT='("Distance to the plane:",F12.7)', konst
;;
;; Confirm the results. Calculate a vector
;; from the origin to the plane.
;;
vec = konst * normal
print, FORMAT='("Vector from origin :",3F12.7)', vec
print, ''
;;
;; Now calculate a vector in the plane from the
;; location in the plane defined by 'vec'.
;;
plane_vec = vec - point
;;
;; These vectors should be orthogonal.
;;
print, FORMAT='("dot product :",F12.7)', $
cspice_vdot( plane_vec, vec )
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Distance to the plane: 4.8102899
Vector from origin : -0.7777778 3.8888889 -2.7222222
dot product : -0.0000000
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 pl2nvc_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 routine 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 )
1) The input plane MUST have been created by one of the Icy
routines
cspice_nvc2pl ( Normal vector and constant to plane )
cspice_nvp2pl ( Normal vector and point to plane )
cspice_psv2pl ( Point and spanning vectors to plane )
Otherwise, the results of this routine are unpredictable.
2) If the input argument `plane' is undefined, an error is
signaled by the IDL error handling system.
3) If the input argument `plane' 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 any of the output arguments, `normal' or `konst', is not a
named variable, an error is signaled by the Icy interface.
None.
None.
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, 13-AUG-2021 (JDR)
Changed the output argument name "constant" to "konst" for
consistency with other routines.
Edited the header to comply with NAIF standard. Added example's
problem statement, reformatted example's output and added a
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.1, 16-AUG-2010 (EDW)
Improved the -I/O section. The section now meets NAIF standard
for Icy headers. Improved and -Particulars section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
plane to normal vector and constant
|