1 /*
2 
3 -Procedure wnexpd_c ( Expand the intervals of a DP window )
4 
5 -Abstract
6 
7    Expand each of the intervals of a double precision window.
8 
9 -Disclaimer
10 
11    THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE
12    CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S.
13    GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE
14    ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE
15    PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS"
16    TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY
17    WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A
18    PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC
19    SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
20    SOFTWARE AND RELATED MATERIALS, HOWEVER USED.
21 
22    IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA
23    BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT
24    LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND,
25    INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS,
26    REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE
27    REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY.
28 
29    RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF
30    THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY
31    CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE
32    ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE.
33 
34 -Required_Reading
35 
36    WINDOWS
37 
38 -Keywords
39 
40    WINDOWS
41 
42 */
43 
44    #include "SpiceUsr.h"
45    #include "SpiceZfc.h"
46    #include "SpiceZmc.h"
47 
48 
wnexpd_c(SpiceDouble left,SpiceDouble right,SpiceCell * window)49    void wnexpd_c ( SpiceDouble    left,
50                    SpiceDouble    right,
51                    SpiceCell    * window )
52 
53 /*
54 
55 -Brief_I/O
56 
57    VARIABLE  I/O  DESCRIPTION
58    --------  ---  --------------------------------------------------
59    left       I   Amount subtracted from each left endpoint.
60    right      I   Amount added to each right endpoint.
61    window    I,O  Window to be expanded.
62 
63 -Detailed_Input
64 
65    left        is the amount to be subtracted from the left
66                endpoint of each interval in the input window.
67 
68    right       is the amount to be added to the right endpoint
69                of each interval in the window.
70 
71    window      on input, is a window containing zero or more
72                intervals.
73 
74                window must be declared as a double precision
75                SpiceCell.
76 
77 -Detailed_Output
78 
79    window      on output, is the original window with each of its
80                intervals expanded by left units on the left and
81                right units on the right.
82 
83 -Parameters
84 
85    None.
86 
87 -Exceptions
88 
89    1) If the input window does not have double precision type,
90       the error SPICE(TYPEMISMATCH) is signaled.
91 
92 -Files
93 
94    None.
95 
96 -Particulars
97 
98    This routine expands (lengthens) each of the intervals in
99    the input window. The adjustments are not necessarily symmetric.
100    That is, left units are subtracted from the left endpoint of
101    each interval, and right units are added to the right endpoint
102    of each interval, where left and right may be different.
103 
104    Intervals are merged when expansion causes them to overlap.
105 
106 -Examples
107 
108    Let window contain the intervals
109 
110       [ 1, 3 ]  [ 7, 11 ]  [ 23, 27 ]  [ 29, 29 ]
111 
112    Then the following series of calls
113 
114       wnexpd_c (  2.0,  1.0, &window );              (1)
115       wnexpd_c ( -2.0,  2.0, &window );              (2)
116       wnexpd_c ( -2.0, -1.0, &window );              (3)
117 
118    produces the following series of windows
119 
120       [ -1, 4 ]  [ 5, 12 ]  [ 21, 30 ]               (1)
121       [  1, 6 ]  [ 7, 14 ]  [ 23, 32 ]               (2)
122       [  3, 5 ]  [ 9, 13 ]  [ 25, 31 ]               (3)
123 
124    Note that intervals may be "expanded" by negative amounts.
125    In the example above, the second call shifts each interval to
126    the right, while the third call undoes the effect of the first
127    call (without restoring the merged intervals).
128 
129    Note also that the third call is exactly equivalent to the
130    call
131 
132       wncond_c ( 2, 1, &window );
133 
134 
135 -Restrictions
136 
137    None.
138 
139 -Literature_References
140 
141    None.
142 
143 -Author_and_Institution
144 
145    N.J. Bachman    (JPL)
146    H.A. Neilan     (JPL)
147    W.L. Taber      (JPL)
148    I.M. Underwood  (JPL)
149 
150 -Version
151 
152    -CSPICE Version 1.0.0, 29-JUL-2002 (NJB) (HAN) (WLT) (IMU)
153 
154 -Index_Entries
155 
156    expand the intervals of a d.p. window
157 
158 -&
159 */
160 
161 { /* Begin wnexpd_c */
162 
163 
164    /*
165    Use discovery check-in.
166 
167    Make sure cell data type is d.p.
168    */
169    CELLTYPECHK ( CHK_DISCOVER, "wnexpd_c", SPICE_DP, window );
170 
171 
172    /*
173    Initialize the cell if necessary.
174    */
175    CELLINIT ( window );
176 
177 
178    /*
179    Let the f2c'd routine do the work.
180    */
181    wnexpd_ ( (doublereal * )  &left,
182              (doublereal * )  &right,
183              (doublereal * )  (window->base) );
184 
185    /*
186    Sync the output cell.
187    */
188    zzsynccl_c ( F2C, window );
189 
190 
191 } /* End wnexpd_c */
192