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: s1315.c,v 1.2 2001-03-19 15:58:44 afr Exp $ 45 * 46 */ 47 48 49 #define S1315 50 51 #include "sislP.h" 52 53 #if defined(SISLNEEDPROTOTYPES) 54 void s1315(SISLSurf * ps1,double * ecentr,double aradiu,int idim,double aepsco,double aepsge,double amax,SISLIntcurve * pintcr,int icur,int igraph,int * jstat)55 s1315(SISLSurf *ps1,double *ecentr,double aradiu,int idim, 56 double aepsco,double aepsge,double amax, 57 SISLIntcurve *pintcr,int icur,int igraph,int *jstat) 58 #else 59 void s1315(ps1,ecentr,aradiu,idim,aepsco,aepsge,amax,pintcr,icur,igraph,jstat) 60 SISLSurf *ps1; 61 double *ecentr; 62 double aradiu; 63 int idim; 64 double aepsco; 65 double aepsge; 66 double amax; 67 SISLIntcurve *pintcr; 68 int icur; 69 int igraph; 70 int *jstat; 71 #endif 72 /* 73 ********************************************************************* 74 * 75 ********************************************************************* 76 * 77 * PURPOSE : To march an intersection curve desribed by parameter pairs 78 * in an intersection curve object, a B-spline surface and 79 * a sphere. 80 * 81 * 82 * INPUT : ps1 - Pointer to surface. 83 * ecentr - Center of the sphere 84 * aradiu - Radius of sphere 85 * idim - Dimension of the space in which the plane lies. 86 * aepsco - Computational resolution. 87 * aepsge - Geometry resolution. 88 * amax - Maximal allowed step length. If amax <=aepsge 89 * amax is neglected. 90 * icur - Indicator telling if a 3-D curve is to be made 91 * 0 - Don't make 3-D curve 92 * 1 - Make 3-D curve 93 * 2 - Make 3-D curve and curves in parameter plane 94 * igraph - Indicator telling if the curve is to be outputted 95 * through function calls: 96 * 0 - don't output curve through function call 97 * 1 - output as straight line segments through 98 * s6move and s6line. 99 * 100 * 101 * 102 * INPUT/OUTPUT:pintcr - The intersection curve. When comming as input 103 * only parameter values it the parameter plane 104 * exist. When comming as output the 3-D geometry 105 * and possibly the curve in the parameter plane 106 * of the surface is added. 107 * 108 * OUTPUT: jstat - status messages 109 * = 3 : Iteration stopped due to singular 110 * point or degenerate surface. A part 111 * of intersection curve may have been 112 * traced out. If no curve is traced out 113 * the curve pointers in the Intcurve 114 * object point to SISL_NULL.* = 3 : Marching not succeded 115 * = 0 : ok 116 * < 0 : error 117 * 118 * 119 * METHOD : An implicit description of the sphere is made and then 120 * a routine for intersecting implicit represented geometry 121 * by a B-spline surface is used. 122 * 123 * REFERENCES : 124 * 125 *- 126 * CALLS : s6err, s1313, s1321 127 * WRITTEN BY : Tor Dokken, SI, Oslo, Norway, 2. July 1988 128 * 129 ********************************************************************* 130 */ 131 { 132 int kpos=0; /* Position of error */ 133 int kdeg=2; /* The degree of the implicit equation of the plane */ 134 int knumb=1; /* Number of implicit representations to be made */ 135 int kstat; /* Local status variable */ 136 double simpli[16]; /* Array containing the implicit description of sphere*/ 137 138 139 if (idim != 3) goto err104; 140 141 /* Make description of sphere */ 142 143 s1321(ecentr,aradiu,idim,knumb,simpli,&kstat); 144 if (kstat < 0) goto error; 145 146 /* Make intersection of implicit surface and B-spline surface */ 147 148 s1313(ps1,simpli,kdeg,aepsco,aepsge,amax,pintcr,icur,igraph,&kstat); 149 if (kstat == -185) goto err185; 150 if (kstat < 0) goto error; 151 152 *jstat = kstat; 153 goto out; 154 155 /* Dimension not 3 */ 156 157 err104: 158 *jstat = -104; 159 s6err("s1315",*jstat,kpos); 160 goto out; 161 162 /* Couldn't march */ 163 164 err185: 165 *jstat = -185; 166 goto out; 167 168 /* Error in lower level routine. */ 169 170 error: 171 *jstat = kstat; 172 s6err("s1315",*jstat,kpos); 173 goto out; 174 175 out: 176 return; 177 } 178