Table of contents
CSPICE_WNCOMD determines the complement of a double
precision window with respect to a specified interval.
Given:
left,
right the scalar, double precision left and right endpoints of the
complement interval.
help, left
DOUBLE = Scalar
help, right
DOUBLE = Scalar
window the scalar window to be complemented.
help, window
STRUCT = cspice_celld(2*N)
`window' must be created as a window structure via a
cspice_celld call.
the call:
cspice_wncomd, left, right, window, result
returns:
result the scalar output window, containing the complement of `window'
with respect to the interval from `left' to `right'.
help, result
STRUCT = cspice_celld(2*N)
If `result' is not large enough to contain the result, as many
intervals as will fit are returned.
The user must create `result' using cspice_celld.
`result' must be distinct from `window'.
None.
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.
1) Given a double precision window, containing the following three
intervals:
[ 1.0, 3.0 ], [ 7.0, 11.0 ], [ 23.0, 27.0 ]
compute its complement with respect to the intervals [2.0, 20.0]
and [0.0, 100.0].
Example code begins here.
PRO wncomd_ex1
;;
;; Create two cells each containing a double
;; precision 8-vector.
;;
win1 = cspice_celld( 8 )
win2 = cspice_celld( 8 )
;;
;; Define a window with three intervals.
;;
darray = [ [ 1.d, 3.0], [ 7.0, 11.0], [23.0, 27.0] ]
;;
;; Add the window data to the cell.
;;
for i=0,2 do begin
cspice_wninsd, darray[0,i], darray[1,i], win1
endfor
;;
;; Do the complement with respect to [2.0, 20.0]
;;
left = 2.d
right = 20.d
cspice_wncomd, left, right, win1, win2
;;
;; Calculate the number of intervals in the
;; return window 'win2'.
;;
no_intervals = cspice_wncard(win2)
;;
;; Output the intervals.
;;
print, 'Complement window with respect to [2.0, 20.0]'
for i= 0, (no_intervals -1 ) do begin
cspice_wnfetd, win2, i, left, right
print, left, right
endfor
;;
;; Do the complement with respect to [0.0, 100.0]
;;
cspice_wncomd, 0.d, 100.d, win1, win2
print
print, 'Complement window with respect to [0.0, 100.0]'
for i= 0, (cspice_wncard(win2) -1 ) do begin
cspice_wnfetd, win2, i, left, right
print, left, right
endfor
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Complement window with respect to [2.0, 20.0]
3.0000000 7.0000000
11.000000 20.000000
Complement window with respect to [0.0, 100.0]
0.0000000 1.0000000
3.0000000 7.0000000
11.000000 23.000000
27.000000 100.00000
The user must create any needed window structures with
cspice_celld prior to use regardless of whether the routine
uses the window as input or returns it as output.
Mathematically, the complement of a window contains those
points that are not contained in the window. That is, the
complement of the set of closed intervals
[ a(0), b(0) ], [ a(1), b(1) ], ..., [ a(n), b(n) ]
is the set of open intervals
( -inf, a(0) ), ( b(0), a(1) ), ..., ( b(n), +inf )
Because IDL offers no satisfactory representation of
infinity, we must take the complement with respect to a
finite interval.
In addition, IDL offers no satisfactory floating point
representation of open intervals. Therefore, the complement
of a floating point window is closure of the set theoretical
complement. In short, the floating point complement of the
window
[ a(0), b(0) ], [ a(1), b(1) ], ..., [ a(n), b(n) ]
with respect to the interval from left to right is the
intersection of the windows
( -inf, a(0) ), ( b(0), a(1) ), ..., ( b(n), +inf )
and
[ left, right ]
Note that floating point intervals of measure zero (singleton
intervals) in the original window are replaced by gaps of
measure zero, which are filled. Thus, complementing a floating
point window twice does not necessarily yield the original window.
1) If `left' is greater than `right', the error SPICE(BADENDPOINTS)
is signaled by a routine in the call tree of this routine.
2) The cardinality of the input `window' must be even. Left
endpoints of stored intervals must be strictly greater than
preceding right endpoints. Right endpoints must be greater
than or equal to corresponding left endpoints. Invalid window
data are not diagnosed by this routine and may lead to
unpredictable results.
3) If any of the input arguments, `left', `right', `window' or
`result', is undefined, an error is signaled by the IDL error
handling system.
4) If any of the input arguments, `left', `right', `window' or
`result', is not of the expected type, or it does not have the
expected dimensions and size, an error is signaled by the Icy
interface.
None.
None.
ICY.REQ
CELLS.REQ
WINDOWS.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.3, 10-AUG-2021 (JDR)
Edited the header to comply with NAIF standard. Added
example's problem statement and extended example.
Extended -Particulars section.
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, 26-NOV-2007 (EDW)
Implemented use of cspice_wncard function in example code to
return window cardinality.
-Icy Version 1.0.1, 12-SEP-2006 (EDW)
Correct Required Reading citation cell.req to cells.req.
-Icy Version 1.0.0, 08-AUG-2004 (EDW)
complement a d.p. window
|