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