Table of contents
CSPICE_EL2CGV converts a SPICE ellipse to a center vector and
two generating vectors. The selected generating vectors are
semi-axes of the ellipse.
Given:
ellips a structure describing a SPICE ellipse.
help, ellips
STRUCT = CSPICE_ELLIPSE
The structure has the fields:
center: dblarr(3)
semimajor: dblarr(3)
semiminor: dblarr(3)
the call:
cspice_el2cgv, ellips, center, smajor, sminor
returns:
center the double precision 3-vector defining the center of `ellips'.
help, center
DOUBLE = Array[3]
smajor the double precision 3-vector defining the semi-major axis of
`ellips'.
help, smajor
DOUBLE = Array[3]
sminor the double precision 3-vector defining the semi-minor axis of
`ellips'.
help, sminor
DOUBLE = Array[3]
This ellipse is the set of points
center + cos(theta)*smajor + sin(theta)*sminor
where `theta' ranges over the interval (-pi, pi].
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) Given a SPICE ellipse structure, extract its components into
independent variables.
Example code begins here.
PRO el2cgv_ex1
;;
;; Define two arbitrary, linearly independent vectors
;; and a center vector.
;;
vec1 = [ 1.d, 1.d, 1.d ]
vec2 = [ 1.d, -1.d, 1.d ]
center = [ 1.d, 1.d, 1.d ]
;;
;; Calculate the semi-major and semi-minor axes of
;; the ellipse as generated by 'vec1' and 'vec2'.
;; (The cspice_saelgv call determines the orthogonal axes
;; of an ellipse from two generating vectors.)
;;
cspice_saelgv, vec1, vec2, smajor, sminor
;;
;; Load the generating vectors into an ellipse structure.
;;
cspice_cgv2el, center, smajor, sminor, ellips
;;
;; Extract the CSPICE_ELLIPSE structure components into
;; variable.
;;
cspice_el2cgv, ellips, cent, smaj, smin
print, 'Semiminor axis: ', smin
print, 'Semimajor axis: ', smaj
print, 'Limb center : ', cent
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Semiminor axis: 4.9303807e-32 1.4142136 4.9303807e-32
Semimajor axis: 1.4142136 -4.9303807e-32 1.4142136
Limb center : 1.0000000 1.0000000 1.0000000
Note that the call does nothing but extract the 3-vector
components of the CSPICE_ELLIPSE structure into individual
3-vectors.
IDL native code to perform the same operation:
cent = ellips.center
smaj = ellips.semimajor
smin = ellips.semiminor
2) Given an ellipsoid and a viewpoint exterior to it, calculate
the limb ellipse as seen from that viewpoint.
Example code begins here.
PRO el2cgv_ex2
;;
;; Define an ellipsoid
;;
a = sqrt(2.d)
b = 2.d*sqrt(2.d)
c = sqrt(2.d)
;;
;; Locate a viewpoint exterior to the ellipsoid.
;;
viewpt = [ 2.d, 0.d, 0.d ]
;;
;; Calculate the limb ellipse as seen by from the
;; viewpoint.
;;
cspice_edlimb, a, b, c, viewpt, limb
;;
;; Output the structure components.
;;
print, 'Semiminor axis: ', limb.semiminor
print, 'Semimajor axis: ', limb.semimajor
print, 'Limb center : ', limb.center
;;
;; Check against expected values:
;;
;; Semiminor: 0.d, 0.d, -1.d
;; Semimajor: 0.d, 2.d, 0.d
;; Center : 1.d, 0.d, 0.d
;;
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Semiminor axis: 0.0000000 0.0000000 -1.0000000
Semimajor axis: 0.0000000 2.0000000 -0.0000000
Limb center : 1.0000000 0.0000000 0.0000000
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 )
A word about the output of this routine: the semi-major axis of
an ellipse is a vector of largest possible magnitude in the set
cos(theta)*vec1 + sin(theta)*vec2
where `theta' is in the interval (-pi, pi]. There are two such
vectors; they are additive inverses of each other. The semi-minor
axis is an analogous vector of smallest possible magnitude. The
semi-major and semi-minor axes are orthogonal to each other. If
`smajor' and `sminor' are choices of semi-major and semi-minor axes,
then the input ellipse can also be represented as the set of
points
center + cos(theta)*smajor + sin(theta)*sminor
where `theta' ranges over the interval (-pi, pi].
1) If the input argument `ellips' is undefined, an error is
signaled by the IDL error handling system.
2) If the input argument `ellips' is not of the expected type, or
it does not have the expected dimensions and size, an error is
signaled by the Icy interface.
3) If any of the output arguments, `center', `smajor' or
`sminor', 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 input 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 a 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 -Abstract, input, and output variables.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
ellipse to center and generating vectors
|