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