Table of contents
CSPICE_CGV2EL creates a CSPICE_ELLIPSE structure from a
center 3-vector and two generating 3-vectors.
Given:
center a double precision 3-vector defining the location for an ellipse
center.
help, center
DOUBLE = Array[3]
vec1,
vec2 two double precision 3-vectors defining the ellipse (the
generating vectors) with the `center' in three-dimensional
space.
help, vec1
DOUBLE = Array[3]
help, vec2
DOUBLE = Array[3]
The ellipse is the set of points
center + cos(theta) vec1 + sin(theta) vec2
where theta ranges over the interval (-pi, pi].
`vec1' and `vec2' need not be linearly independent.
the call:
cspice_cgv2el, center, vec1, vec2, ellips
returns:
ellips a structure describing a SPICE ellipse defined by the input
vectors.
help, ellips
STRUCT = CSPICE_ELLIPSE
The structure has the fields:
center: dblarr(3)
semimajor: dblarr(3)
semiminor: dblarr(3)
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) Create a SPICE ellipse given its center and two linearly independent
generating vectors of the ellipse.
Example code begins here.
PRO cgv2el_ex1
;;
;; Define the center and two linearly independent
;; generating vectors of an ellipse (the vectors need not
;; be linearly independent).
;;
center = [ -1.d, 1.d, -1.d ]
vec1 = [ 1.d, 1.d, 1.d ]
vec2 = [ 1.d, -1.d, 1.d ]
;;
;; Create the CSPICE_ELLIPSE structure.
;;
cspice_cgv2el, center, vec1, vec2, ellips
print, 'SPICE ellipse:'
print, FORMAT='(" Semi-minor axis:",3F10.6)', ellips.semiminor
print, FORMAT='(" Semi-major axis:",3F10.6)', ellips.semimajor
print, FORMAT='(" Center :",3F10.6)', ellips.center
print, ' '
;;
;; Obtain the center and generating vectors from the
;; `ellips'.
;;
cspice_el2cgv, ellips, ecentr, smajor, sminor
print, 'SPICE ellipse (using cspice_el2cgv):'
print, FORMAT='(" Semi-minor axis:",3F10.6)', sminor
print, FORMAT='(" Semi-major axis:",3F10.6)', smajor
print, FORMAT='(" Center :",3F10.6)', ecentr
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
SPICE ellipse:
Semi-minor axis: 0.000000 1.414214 0.000000
Semi-major axis: 1.414214 -0.000000 1.414214
Center : -1.000000 1.000000 -1.000000
SPICE ellipse (using cspice_el2cgv):
Semi-minor axis: 0.000000 1.414214 0.000000
Semi-major axis: 1.414214 -0.000000 1.414214
Center : -1.000000 1.000000 -1.000000
Note that the call to cspice_cgv2el has the same effect as:
cspice_saelgv, vec1, vec2, smajor, sminor
struct = {CSPICE_ELLIPSE, center:dblarr(3), $
semiMajor:dblarr(3),$
semiMinor:dblarr(3) }
ellips = {CSPICE_ELLIPSE}
ellips.center = center
ellips.semimajor = smajor
ellips.semiminor = sminor
2) Find the intersection of an ellipse with a plane.
Example code begins here.
PRO cgv2el_ex2
;;
;; Local variables.
;;
xpts = FLTARR(2,3)
;;
;; The ellipse is defined by the vectors `center', `vec1', and
;; `vec2'. The plane is defined by the normal vector `normal'
;; and the `center'.
;;
center = [0.0, 0.0, 0.0]
vec1 = [1.0, 7.0, 2.0]
vec2 = [-1.0, 1.0, 3.0]
normal = [0.0, 1.0, 0.0]
;;
;; Make a SPICE ellipse and a plane.
;;
cspice_cgv2el, center, vec1, vec2, ellips
cspice_nvp2pl, normal, center, plane
;;
;; Find the intersection of the ellipse and plane.
;; `nxpts' is the number of intersection points; `xpts'
;; are the points themselves.
;;
cspice_inelpl, ellips, plane, nxpts, xpt1, xpt2
xpts[0,*] = xpt1
xpts[1,*] = xpt2
print, format='(A,I2)', 'Number of intercept points:', nxpts
for i=0, nxpts - 1L do begin
print, format='(A,I2,A,3F10.6)', ' Point', i, ':', xpts[i,*]
endfor
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Number of intercept points: 2
Point 0: 1.131371 0.000000 -2.687006
Point 1: -1.131371 -0.000000 2.687006
SPICE ellipses serve to simplify calling sequences and reduce
the chance for error in declaring and describing argument lists
involving ellipses.
The set of ellipse conversion routines is
cspice_cgv2el ( Center and generating vectors to ellipse )
cspice_el2cgv ( Ellipse to center and generating vectors )
1) If `vec1' and `vec2' are linearly dependent, `ellips' will be
degenerate. SPICE ellipses are allowed to represent
degenerate geometric ellipses.
2) If any of the input arguments, `center', `vec1' or `vec2', is
undefined, an error is signaled by the IDL error handling
system.
3) If any of the input arguments, `center', `vec1' or `vec2', 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 `ellips' is not a named variable, an
error is signaled by the Icy interface.
None.
None.
ICY.REQ
ELLIPSES.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.1.0, 24-AUG-2021 (JDR)
Changed output argument name "ellipse" to "ellips" 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, and
completed -Particulars section.
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, 07-FEB-2012 (EDW)
Clarified description of 'ellipse' output argument: a 'SPICE ellipse'
not an Icy one.
-Icy Version 1.0.1, 07-MAY-2008 (EDW)
Expanded description of input and output variables.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
center and generating vectors to ellipse
|