1 /*
2 
3 -Procedure wndifd_c ( Difference two DP windows )
4 
5 -Abstract
6 
7    Place the difference of two double precision windows into
8    a third window.
9 
10 -Disclaimer
11 
12    THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE
13    CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S.
14    GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE
15    ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE
16    PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS"
17    TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY
18    WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A
19    PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC
20    SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
21    SOFTWARE AND RELATED MATERIALS, HOWEVER USED.
22 
23    IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA
24    BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT
25    LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND,
26    INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS,
27    REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE
28    REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY.
29 
30    RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF
31    THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY
32    CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE
33    ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE.
34 
35 -Required_Reading
36 
37    WINDOWS
38 
39 -Keywords
40 
41    WINDOWS
42 
43 */
44 
45    #include "SpiceUsr.h"
46    #include "SpiceZfc.h"
47    #include "SpiceZmc.h"
48 
wndifd_c(SpiceCell * a,SpiceCell * b,SpiceCell * c)49    void wndifd_c (  SpiceCell   * a,
50                     SpiceCell   * b,
51                     SpiceCell   * c  )
52 
53 /*
54 
55 -Brief_I/O
56 
57    VARIABLE  I/O  DESCRIPTION
58    --------  ---  --------------------------------------------------
59    a,
60    b          I   Input windows.
61    c          O   Difference of a and b.
62 
63 -Detailed_Input
64 
65    a,
66    b           are CSPICE windows, each of which contains zero or more
67                intervals.
68 
69                a and b must be declared as double precision
70                SpiceCells.
71 
72 -Detailed_Output
73 
74    c           is the output CSPICE window, containing the difference
75                of a and b---every point contained in a, but not
76                contained in b.
77 
78                c must be declared as a double precision SpiceCell.
79 
80                c must be distinct from both a and b.
81 -Parameters
82 
83    None.
84 
85 -Exceptions
86 
87    1) If any of the function arguments are SpiceCells of type
88       other than double precision, the error SPICE(TYPEMISMATCH)
89       is signaled.
90 
91    2) If the difference of the two windows results in an excess of
92       elements, the error SPICE(WINDOWEXCESS) is signaled.
93 
94 -Files
95 
96    None.
97 
98 -Particulars
99 
100    Mathematically, the difference of two windows contains every
101    point contained in the first window but not contained in the
102    second window.
103 
104    Fortran offers no satisfactory floating point representation
105    of open intervals. Thus, for floating point windows we must
106    return the closure of the set theoretical difference.
107 
108 -Examples
109 
110    Let a contain the intervals
111 
112       [ 1, 3 ]  [ 7, 11 ]  [ 23, 27 ]
113 
114    and b contain the intervals
115 
116       [ 2, 4 ]  [ 8, 10 ]  [ 16, 18 ]
117 
118    Then the difference of a and b contains the intervals
119 
120       [ 1, 2 ]  [ 7, 8 ]  [ 10, 11 ]  [ 23, 27 ]
121 
122 -Restrictions
123 
124    None.
125 
126 -Literature_References
127 
128    None.
129 
130 -Author_and_Institution
131 
132    N.J. Bachman    (JPL)
133    H.A. Neilan     (JPL)
134    B.V. Semenov    (JPL)
135    W.L. Taber      (JPL)
136    I.M. Underwood  (JPL)
137 
138 -Version
139 
140    -CSPICE Version 1.0.1, 11-FEB-2013 (BVS)
141 
142        Corrected typo in Brief I/O section.
143 
144    -CSPICE Version 1.0.0, 29-JUL-2002 (NJB) (HAN) (WLT) (IMU)
145 
146 -Index_Entries
147 
148    difference two d.p. windows
149 
150 -&
151 */
152 
153 { /* Begin wndifd_c */
154 
155    /*
156    Local constants
157    */
158 
159 
160    /*
161    Participate in error tracing.
162    */
163    if ( return_c() )
164    {
165       return;
166    }
167    chkin_c ( "wndifd_c" );
168 
169 
170    /*
171    Make sure cell data types are d.p.
172    */
173    CELLTYPECHK3 ( CHK_STANDARD, "wndifd_c", SPICE_DP, a, b, c );
174 
175 
176    /*
177    Initialize the cells if necessary.
178    */
179    CELLINIT3 ( a, b, c );
180 
181 
182    /*
183    Let the f2c'd routine do the work.
184    */
185    wndifd_ ( (doublereal * ) (a->base),
186              (doublereal * ) (b->base),
187              (doublereal * ) (c->base)  );
188 
189    /*
190    Sync the output cell.
191    */
192    if ( !failed_c() )
193    {
194       zzsynccl_c ( F2C, c );
195    }
196 
197 
198    chkout_c ( "wndifd_c" );
199 
200 } /* End wndifd_c */
201