1 /*
2 * Copyright (C) 1998, 2000-2007, 2010, 2011, 2012, 2013 SINTEF ICT,
3 * Applied Mathematics, Norway.
4 *
5 * Contact information: E-mail: tor.dokken@sintef.no
6 * SINTEF ICT, Department of Applied Mathematics,
7 * P.O. Box 124 Blindern,
8 * 0314 Oslo, Norway.
9 *
10 * This file is part of SISL.
11 *
12 * SISL is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Affero General Public License as
14 * published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * SISL is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Affero General Public License for more details.
21 *
22 * You should have received a copy of the GNU Affero General Public
23 * License along with SISL. If not, see
24 * <http://www.gnu.org/licenses/>.
25 *
26 * In accordance with Section 7(b) of the GNU Affero General Public
27 * License, a covered work must retain the producer line in every data
28 * file that is created or manipulated using SISL.
29 *
30 * Other Usage
31 * You can be released from the requirements of the license by purchasing
32 * a commercial license. Buying such a license is mandatory as soon as you
33 * develop commercial activities involving the SISL library without
34 * disclosing the source code of your own applications.
35 *
36 * This file may be used in accordance with the terms contained in a
37 * written agreement between you and SINTEF ICT.
38 */
39
40 #include "sisl-copyright.h"
41
42 #define S1987
43
44 #include "sislP.h"
45
46
47 #if defined(SISLNEEDPROTOTYPES)
s1987(SISLSurf * ps,double aepsge,int * jgtpi,double ** gaxis,double * cang,int * jstat)48 void s1987(SISLSurf *ps, double aepsge, int *jgtpi, double **gaxis,
49 double *cang,int *jstat)
50 #else
51 void s1987(ps,aepsge,jgtpi,gaxis,cang,jstat)
52 SISLSurf *ps;
53 double aepsge;
54 int *jgtpi;
55 double **gaxis;
56 double *cang;
57 int *jstat;
58 #endif
59 /*
60 *********************************************************************
61 *
62 *********************************************************************
63 *
64 * PURPOSE : Find the direction cone of a surface.
65 *
66 *
67 * INPUT : ps - Surface to treat.
68 * aepsge - Geometry tolerance.
69 *
70 * OUTPUT : jgtpi - To mark if the angle of the direction cone is
71 * greater than pi.
72 * 0 - The direction cone of the surface
73 * is not greater than pi in any
74 * parameter direction.
75 * 1 - The direction cone of the surface
76 * is greater than pi in the first
77 * parameter direction.
78 * 2 - The direction cone of the surface is greater
79 * than pi in the second parameter direction.
80 * 10 - The direction cone of a boundary curve of
81 * the surface is greater than pi in the first
82 * parameter direction.
83 * 20 - The direction cone of a boundary curve of
84 * the surface is greater than pi in the second
85 * parameter direction.
86 * gaxis - Allocated array containing the coordinates of the
87 * center of the cone. It is only computed if
88 * *jgtpi = 0.
89 * cang - The angle from the center to the boundary of the
90 * cone. It is only computed if *jgtpi = 0.
91 * jstat - status messages
92 * > 0 : warning
93 * = 0 : ok
94 * < 0 : error
95 *
96 *
97 *
98 * METHOD :
99 *
100 *
101 * REFERENCES :
102 *
103 * CALLS :
104 *
105 * WRITTEN BY : Vibeke Skytt, SINTEF, 9403.
106 *
107 *********************************************************************
108 */
109 {
110 int kstat = 0; /* Local status variable. */
111 int kpos = 0;
112 int kdim = ps->idim;
113
114 /* Allocate scratch for the output array. */
115
116 if ((*gaxis = newarray(kdim, DOUBLE)) == SISL_NULL) goto err101;
117
118 /* Let s1990 compute the cone. */
119
120 s1990(ps, aepsge, &kstat);
121 if (kstat < 0) goto error;
122
123 /* Copy the resulting cone to output parameters. */
124
125 *jgtpi = ps->pdir->igtpi;
126 *cang = ps->pdir->aang;
127 memcopy(*gaxis, ps->pdir->ecoef, kdim, DOUBLE);
128
129 /* Success ! */
130
131 *jstat = 0;
132 goto out;
133
134
135 /* Error in space allocation. */
136
137 err101:
138 *jstat = -101;
139 s6err("s1987",*jstat,kpos);
140 goto out;
141
142 /* Error in lower level routine. */
143
144 error:
145 *jstat = kstat;
146 s6err("s1987",*jstat,kpos);
147 goto out;
148
149 out:
150 return;
151 }
152