Table of contents
CSPICE_WNDIFD places the difference of two double precision
windows into a third window.
Given:
a,
b two SPICE windows, each of which contains zero or more
intervals.
help, a
STRUCT = cspice_celld(2*N)
help, b
STRUCT = cspice_celld(2*M)
The user must create `a' and `b' using cspice_celld.
the call:
cspice_wndifd, a, b, c
returns:
c the output SPICE window, containing the difference of `a' and
`b' --- every point contained in `a', but not contained in `b'.
help, c
STRUCT = cspice_celld(2*R)
`c' must be distinct from both `a' and `b'.
The user must create `c' using cspice_celld.
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) Let `a' contain the intervals
[ 1, 3 ] [ 7, 11 ] [ 23, 27 ]
and `b' contain the intervals
[ 2, 4 ] [ 8, 10 ] [ 16, 18 ]
Then the difference of `a' and `b' contains the intervals
[ 1, 2 ] [ 7, 8 ] [ 10, 11 ] [ 23, 27 ]
The following code example demonstrates how to compute the
difference of `a' and `b' using SPICE.
Example code begins here.
PRO wndifd_ex1
;;
;; Create three cells each containing a double precision
;; 8-vector.
;;
win1 = cspice_celld( 8 )
win2 = cspice_celld( 8 )
win3 = cspice_celld( 8 )
;;
;; Define two windows 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
darray2 = [ [ 2.d, 6.0], [ 8.0, 10.0], [16.0, 18.0] ]
;;
;; Add the window data to the cell.
;;
for i=0, 2 do begin
cspice_wninsd, darray2[0,i], darray2[1,i], win2
endfor
;;
;; Do the difference.
;;
cspice_wndifd, win1, win2, win3
;;
;; Calculate the number of intervals in the
;; return window 'win1'.
;;
no_intervals = cspice_wncard(win3)
;;
;; Output the intervals.
;;
for i= 0, (no_intervals -1 ) do begin
cspice_wnfetd, win3, 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:
1.0000000 2.0000000
7.0000000 8.0000000
10.000000 11.000000
23.000000 27.000000
Mathematically, the difference of two windows contains every
point contained in the first window but not contained in the
second window.
IDL offers no satisfactory floating point representation
of open intervals. Thus, for floating point windows we must
return the closure of the set theoretical difference: that is,
the difference plus the endpoints of the first window that are
contained in the second window.
1) If the difference of the two windows results in an excess of
elements, the error SPICE(WINDOWEXCESS) is signaled by a
routine in the call tree of this routine.
2) The cardinality of the input windows 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, `a', `b' or `c', is undefined,
an error is signaled by the IDL error handling system.
4) If any of the input arguments, `a', `b' or `c', 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, 24-AUG-2021 (JDR)
Added arguments' type and size information in the -I/O section.
Edited the header to comply with NAIF standard. Added
example's problem statement.
Improved -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.
-Icy Version 1.0.2, 26-NOV-2007 (EDW)
Implemented use of cspice_wncard function 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)
difference two d.p. windows
|