Table of contents
CSPICE_WNDIFD returns the difference of two double precision
windows.
Given:
a SPICE window
[2l,1] = size(a); double = class(a)
b SPICE window
[2m,1] = size(b); double = class(b)
Two SPICE windows containing zero or more intervals.
the call:
c = cspice_wndifd( a, b )
returns:
c the window difference (in the SPICE sense) of 'a' and 'b', every
point contained in 'a', but not contained in 'b'.
[2n,1] = size(c); double = class(c)
'c' can overwrite 'a' or 'b'.
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 this
difference of `a' and `b' using SPICE.
Example code begins here.
function wndifd_ex1()
%
% Let 'a' contain the intervals
%
a = [ [ 1; 3 ]; [ 7; 11 ]; [ 23; 27 ]; ];
%
% and b contain the intervals
%
b = [ [ 2; 4 ]; [ 8; 10 ]; [ 16; 18 ]; ];
%
% Then the difference of`'a' and `b', `c':
%
c = cspice_wndifd(a, b);
%
% Output the difference `c'
%
for i=1:cspice_wncard(c)
[left, right] = cspice_wnfetd( c, i );
fprintf( '%16.6f %16.6f\n', left, right );
end
When this program was executed on a Mac/Intel/Octave6.x/64-bit
platform, the output was:
1.000000 2.000000
7.000000 8.000000
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.
Matlab 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) 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.
2) If any of the input arguments, `a' or `b', is undefined, an
error is signaled by the Matlab error handling system.
3) If any of the input arguments, `a' or `b', is not of the
expected type, or it does not have the expected dimensions and
size, an error is signaled by the Mice interface.
None.
None.
MICE.REQ
WINDOWS.REQ
None.
J. Diaz del Rio (ODC Space)
S.C. Krening (JPL)
E.D. Wright (JPL)
-Mice Version 1.1.0, 10-AUG-2021 (EDW) (JDR)
Edited the header to comply with NAIF standard. Added
example's problem statement and reformatted example's output.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections, and
completed -Particulars section.
Eliminated use of "lasterror" in rethrow.
Removed reference to the function's corresponding CSPICE header from
-Required_Reading section.
Improved -Particulars section.
-Mice Version 1.0.1, 12-MAR-2012 (EDW) (SCK)
Edited -I/O section to conform to NAIF standard for Mice
documentation.
-Mice Version 1.0.0, 23-JUL-2007 (EDW)
difference two d.p. windows
|