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 /*
43 *
44 * $Id: s1374.c,v 1.2 2001-03-19 15:58:48 afr Exp $
45 *
46 */
47
48
49 #define S1374
50
51 #include "sislP.h"
52
53 #if defined(SISLNEEDPROTOTYPES)
s1374(SISLCurve * pc1,double earray[],int idim,double aepsco,double aepsge,int * jpt,double ** gpar,int * jcrv,SISLIntcurve *** wcurve,int * jstat)54 void s1374(SISLCurve *pc1,double earray[],int idim,double aepsco,double aepsge,
55 int *jpt,double **gpar,int *jcrv,SISLIntcurve ***wcurve,int *jstat)
56 #else
57 void s1374(pc1,earray,idim,aepsco,aepsge,jpt,gpar,jcrv,wcurve,jstat)
58 SISLCurve *pc1;
59 double earray[];
60 int idim;
61 double aepsco;
62 double aepsge;
63 int *jpt;
64 double **gpar;
65 int *jcrv;
66 SISLIntcurve ***wcurve;
67 int *jstat;
68 #endif
69 /*
70 *********************************************************************
71 *
72 *********************************************************************
73 *
74 * PURPOSE : Find all intersections between a curve and a quadric
75 * curve if idim=2 and a quadric surface if idim=3.
76 *
77 *
78 *
79 * INPUT : pc1 - Pointer to the curve.
80 * earray - Matrix of dimension (idim+1)x(idim+1) describing
81 * the conic surface such for idim=2:
82 * T
83 * (x,y,1) A (x,y,1) = 0 is the implicit equation
84 * for the curve
85 *
86 * For idim=3:
87 * (x,y,z,1) A (x,y,z,1) = 0 is the implicit equation
88 * for the surface
89 *
90 * idim - Dimension of the space in which the plane/line
91 * lies. idim should be equal to two or three.
92 * aepsco - Computational resolution.
93 * aepsge - Geometry resolution.
94 *
95 *
96 *
97 * OUTPUT : *jpt - Number of single intersection points.
98 * gpar - Array containing the parameter values of the
99 * single intersection points in the parameter
100 * interval of the curve. The points lie continuous.
101 * Intersection curves are stored in wcurve.
102 * *jcrv - Number of intersection curves.
103 * wcurve - Array containing descriptions of the intersection
104 * curves. The curves are only described by points
105 * in the parameter interval. The curve-pointers points
106 * to nothing. (See description of Intcurve
107 * in intcurve.dcl).
108 * jstat - status messages
109 * > 0 : warning
110 * = 0 : ok
111 * < 0 : error
112 *
113 *
114 * METHOD : The vertices of the curve is put into the equation of the
115 * cone achieving a curve in the one-dimentional space.
116 * The zeroes of this curve is found.
117 *
118 *
119 * REFERENCES : Main routine written by Tor Dokken, SI, 1988.
120 *
121 * CALLS : sh1374, s6err.
122 *
123 * WRITTEN BY : Christophe Rene Birkeland, SINTEF, 93-06.
124 *
125 *********************************************************************
126 */
127 {
128 int kstat = 0; /* Local status variable. */
129 int kpos = 0; /* Position of error. */
130 int trackflag = 0;
131 int jtrack;
132 SISLTrack **wtrack=SISL_NULL;
133 int *pretop=SISL_NULL;
134
135 sh1374(pc1,earray,idim,aepsco,aepsge,
136 trackflag,&jtrack,&wtrack,jpt,gpar,&pretop,jcrv,wcurve,&kstat);
137 if(kstat < 0) goto error;
138
139 if(pretop != SISL_NULL) freearray(pretop);
140
141 /*
142 * Intersections found.
143 * --------------------
144 */
145
146 *jstat = 0;
147 goto out;
148
149 /* Error in lower level routine. */
150
151 error:
152 *jstat = kstat;
153 s6err("s1374",*jstat,kpos);
154 goto out;
155
156 out:
157 return;
158 }
159
160
161