//=========================================================================== // GoTools Core - SINTEF Geometry Tools Core library, version 2.0.1 // // Copyright (C) 2000-2007, 2010 SINTEF ICT, Applied Mathematics, Norway. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // Contact information: E-mail: tor.dokken@sintef.no // SINTEF ICT, Department of Applied Mathematics, // P.O. Box 124 Blindern, // 0314 Oslo, Norway. // // Other licenses are also available for this software, notably licenses // for: // - Building commercial software. // - Building software whose source code you wish to keep private. //=========================================================================== 00015 #ifndef _SISL_CODE_H 00016 #define _SISL_CODE_H 00017 00018 //=========================================================================== 00019 // SISL DEFINEs 00020 //=========================================================================== 00022 /* Name of geometry objects. Used in branching. */ 00023 #define SISLPOINT 0 00024 #define SISLCURVE 1 00025 #define SISLSURFACE 2 00026 00027 00028 //=========================================================================== 00029 // SISL structs 00030 //=========================================================================== 00031 00032 //=========================================================================== 00033 typedef struct SISLdir 00034 //=========================================================================== 00035 { 00036 int igtpi; /* 0 - The direction of the surface or curve 00037 is not greater than pi in any 00038 parameter direction. 00039 1 - The direction of the surface or curve 00040 is greater than pi in the first 00041 parameter direction. 00042 2 - The direction of the surface is greater 00043 than pi in the second parameter 00044 direction. */ 00045 double *ecoef; /* The coordinates to the center of the cone.*/ 00046 double aang; /* The angle from the center whice describe the 00047 cone. */ 00048 double *esmooth; /* Coordinates of object after smoothing. */ 00049 } SISLdir; 00050 /* The following structure contains 3 different boxes. The 00051 first box is the plain box given by the coefficients of the 00052 object. The second box is expanded with the half of a given 00053 tolerance. The third box is expanded with half the tolerance 00054 in the inner and for the vertices at the edges/endpoints 00055 a distance of half the tolerance is removed. The minimum and 00056 maximum values of the boxes are given by the arrays 00057 e2min[0] - e2min[2] and e2max[0] - e2max[2]. The tolerances used 00058 when making the boxes are stored in etol[0] - etol[2]. etol[0] 00059 will always be equal to zero. If a box is made, the pointers 00060 belonging to this box points to arrays, otherwise they point 00061 to SISL_NULL. */ 00062 00063 //=========================================================================== 00064 typedef struct SISLbox 00065 //=========================================================================== 00066 { 00067 double *emax; /* The minimum values to the boxes. */ 00068 double *emin; /* The maximum values to the boxes. */ 00069 int imin; /* The index of the min coeff (one-dim case) */ 00070 int imax; /* The index of the max coeff (one-dim case) */ 00071 00072 double *e2max[3]; /* The minimum values dependant on tolerance.*/ 00073 double *e2min[3]; /* The maximum values dependant on tolerance.*/ 00074 double etol[3]; /* Tolerances of the boxes. */ 00075 } SISLbox; 00076 00077 //=========================================================================== 00078 typedef struct SISLCurve 00079 //=========================================================================== 00080 { 00081 int ik; /* Order of curve. */ 00082 int in; /* Number of vertices. */ 00083 double *et; /* Pointer to the knotvector. */ 00084 double *ecoef; /* Pointer to the array containing vertices. */ 00085 double *rcoef; /*Pointer to the array of scaled vertices if 00086 rational. */ 00087 int ikind; /* Kind of curve 00088 = 1 : Polynomial B-spline curve. 00089 = 2 : Rational B-spline curve. 00090 = 3 : Polynomial Bezier curve. 00091 = 4 : Rational Bezier curve. */ 00092 int idim; /* Dimension of the space in which the curve 00093 lies. */ 00094 int icopy; /* Indicates whether the arrays of the curve 00095 are copied or referenced by creation of the 00096 curve. 00097 = 0 : Pointer set to input arrays. 00098 = 1 : Copied. 00099 = 2 : Pointer set to input arrays, 00100 but are to be treated as copied. */ 00101 SISLdir *pdir; /* Pointer to a structur to store curve 00102 direction. */ 00103 SISLbox *pbox; /* Pointer to a structur to store the 00104 surrounded boxes. */ 00105 int cuopen; /* Open/closed flag. */ 00106 } SISLCurve; 00107 00108 //=========================================================================== 00109 typedef struct SISLIntcurve 00110 //=========================================================================== 00111 { 00112 int ipoint; /* Number of points defining the curve. */ 00113 int ipar1; /* Number of parameter directions of first 00114 object. */ 00115 int ipar2; /* Number of parameter directions of second 00116 * object. */ 00117 double *epar1; /* Pointer to the parameter-values of the 00118 points 00119 in the first object. */ 00120 double *epar2; /* Pointer to the parameter-values of the 00121 points 00122 in the second object. If one of the objects 00123 is an analytic curve or surface epar2 points 00124 to nothing. */ 00125 SISLCurve *pgeom; /* Pointer to the intersection curve in the 00126 geometry space. If the curve is not 00127 computed, pgeom points to nothing. */ 00128 SISLCurve *ppar1; /* Pointer to the intersection curve in the 00129 parameter plane of the first object. If 00130 the curve is not computed, ppar1 points 00131 to nothing. */ 00132 SISLCurve *ppar2; /* Pointer to the intersection curve in the 00133 parameter plane of the second object. If 00134 the curve is not computed, ppar2 points 00135 to nothing. */ 00136 int itype; /* Kind of curve. 00137 = 1 : Straight line. 00138 = 2 : Closed loop. No singularities. 00139 = 3 : Closed loop. One singularity. 00140 Not used. 00141 = 4 : Open curve. No singularity. 00142 = 5 : Open curve. Singularity at the 00143 beginning of the curve. 00144 = 6 : Open curve. Singularity at the end 00145 of the curve. 00146 = 7 : Open curve. Singularity at the 00147 beginning and end of the curve. 00148 = 8 : An isolated singularity. Not used. 00149 = 9 : The curve is exact, pgeom and either 00150 ppar1 or ppar2 is set. */ 00151 00152 int pretop[4]; /* Pretopology */ 00153 } SISLIntcurve; 00154 00155 //=========================================================================== 00156 typedef struct SISLIntsurf 00157 //=========================================================================== 00158 { 00159 int ipoint; /* Number of points defining the curve. */ 00160 int ipar; /* Number of parameter directions of */ 00161 double *epar; /* Pointer to the parameter-values of the 00162 points, dimension: ipoint*ipar */ 00163 int *const_par; /* Constant parameter direction between 00164 two points in epar. */ 00165 } SISLIntsurf; 00166 00167 //=========================================================================== 00168 typedef struct SISLIntpt 00169 //=========================================================================== 00170 { 00171 int ipar; /* Number of parameter directions in 00172 * intersection problem. */ 00173 double *epar; /* Parametervalues of point, possibly in two 00174 * objects. */ 00175 double adist; /* Distance between the objects in this point. 00176 * tdist is used in closest point problems. */ 00177 struct SISLIntpt *pcurve; /* Not used, kept for compatibility with old 00178 version on the structure.*/ 00179 int iinter; /* = 1 ORDINARY MAIN POINT 00180 = 2 SINGULAR MAIN POINT 00181 = 3 TRIM MAIN POINT 00182 = -1 ORDINARY HELP POINT 00183 = -2 SINGULAR HELP POINT 00184 = -3 TRIM HELP POINT */ 00185 struct SISLIntpt **pnext; /* Pointers to next points in each curve 00186 * chain. */ 00187 int *curve_dir; /* An array of curve directions + from - to 00188 * this point. */ 00189 int no_of_curves; /* Number of curves containing this point. */ 00190 int no_of_curves_alloc; /* The size of the arrays allocated */ 00191 int *left_obj_1; /* Pretopology information, one for each 00192 * curve. */ 00193 int *left_obj_2; /* Pretopology information, one for each 00194 * curve. */ 00195 int *right_obj_1; /* Pretopology information, one for each 00196 curve. */ 00197 int *right_obj_2; /* Pretopology information, one for each 00198 curve. */ 00199 int size_1; /* Size of geo_data_1 */ 00200 int size_2; /* Size of geo_data_2 */ 00201 double *geo_data_1; /* Containing geometric info first object */ 00202 double *geo_data_2; /* Containing geometric info second object */ 00203 /* double geo_aux[3]; Containing auxiliary geo info, see sh6idput*/ 00204 double geo_track_3d[10]; /* To store intersection curve info */ 00205 double geo_track_2d_1[7]; 00206 double geo_track_2d_2[7]; 00207 int edge_1; /* Edge flag for topology */ 00208 int edge_2; 00209 int marker; /* Help attribute when creating lists */ 00210 int evaluated; /* Help attribute when creating tracks */ 00211 struct SISLTrimpar *trim[2]; /* Used if pt is in trim curve. */ 00212 int iside_1; /* Left/right evaluator flag. -1,0+ */ 00213 int iside_2; /* Left/right evaluator flag. -1,0+*/ 00214 } SISLIntpt; 00215 00216 //=========================================================================== 00217 typedef struct SISLIntlist 00218 //=========================================================================== 00219 { 00220 SISLIntpt *pfirst; /* Pointer to first point in list. */ 00221 SISLIntpt *plast; /* Pointer to last point in list. */ 00222 int ind_first; /* Index pointer in pfirst */ 00223 int ind_last; /* Index pointer in plast */ 00224 int itype; /* Status of curve-segment. 00225 = 0 : open curve, no singularities. 00226 = 1 : closed curve, no singularities. 00227 = 2 : more than two curves meet at start point. 00228 = 3 : more than two curves meet at end point. 00229 = 4 : more than two curves meet at start 00230 and end point. 00231 = 5 : isolated singularity. 00232 = 6 : touching area of surface. */ 00233 int inumb; /* Number of points in the list. */ 00234 int pretop[4]; /* Pretopology */ 00235 } SISLIntlist; 00236 00237 00238 00239 //=========================================================================== 00240 typedef struct SISLIntdat 00241 //=========================================================================== 00242 { 00243 SISLIntpt **vpoint; 00244 int ipoint; 00245 int ipmax; 00246 SISLIntlist **vlist; 00247 int ilist; 00248 int ilmax; 00249 } SISLIntdat; 00250 00251 00252 00253 //=========================================================================== 00254 typedef struct SISLSurf 00255 //=========================================================================== 00256 { 00257 int ik1; /* Order of surface in first parameter 00258 direction. */ 00259 int ik2; /* Order of surface in second parameter 00260 direction. */ 00261 int in1; /* Number of vertices in first parameter 00262 direction. */ 00263 int in2; /* Number of vertices in second parameter 00264 direction. */ 00265 double *et1; /* Pointer to knotvector in first parameter 00266 direction. */ 00267 double *et2; /* Pointer to knotvector in second parameter 00268 direction. */ 00269 double *ecoef; /* Pointer to array of vertices of surface. */ 00270 double *rcoef; /* Pointer to the array of scaled vertices 00271 if surface is rational. */ 00272 int ikind; /* Kind of surface 00273 = 1 : Polynomial B-spline tensor-product 00274 surface. 00275 = 2 : Rational B-spline tensor-product 00276 surface. 00277 = 3 : Polynomial Bezier tensor-product 00278 surface. 00279 = 4 : Rational Bezier tensor-product 00280 surface. */ 00281 int idim; /* Dimension of the space in which the surface 00282 lies. */ 00283 int icopy; /* Indicates whether the arrays of the surface 00284 are copied or referenced by creation of 00285 the surface. 00286 = 0 : Pointer set to input arrays. 00287 = 1 : Copied. 00288 = 2 : Pointer set to input arrays, 00289 but are to be treated as copied. */ 00290 SISLdir *pdir; /* Pointer to a structur to store surface 00291 direction. */ 00292 SISLbox *pbox; /* Pointer to a structur to store the 00293 surrounded boxes. */ 00294 int use_count; /* use count so that several tracks can share 00295 surfaces, no internal use */ 00296 int cuopen_1; /* Open/closed flag, 1. par directiion */ 00297 int cuopen_2; /* Open/closed flag. 2. par direction */ 00298 } SISLSurf; 00299 00300 typedef struct SISLTrack 00301 { 00302 SISLSurf *psurf_1; /* Pointer to first surface in intersection */ 00303 SISLSurf *psurf_2; /* Pointer to second surface in intersection */ 00304 SISLCurve *pcurve_3d; /* Pointer to 3D support curve. */ 00305 SISLCurve *pcurve_2d_1; /* Pointer to 2D support curve in first 00306 parameter space. */ 00307 SISLCurve *pcurve_2d_2; /* Pointer to 2D support curve in second 00308 parameter space. */ 00309 int ideg; /* Type of track. 00310 = 0, Bspline vs Bspline 00311 = 1, Bspline vs Plane 00312 = 2, Bspline vs Quadric surface 00313 = 1001 Bspline vs Torus surface 00314 = 1003 Bspline silhouette line, parallel 00315 projection 00316 = 1004 Bspline silhouette line, perspective 00317 projection 00318 = 1005 Bspline silhouette line, circular 00319 projection */ 00320 00321 double eimpli[16]; /* Description of the implicit surface */ 00322 int turned; /* Connection between the direction of the 00323 support curve and the cross product 00324 between the two surface normals. 00325 = 0, same direction 00326 = 1, oposite direction */ 00327 int exact; /* Flag if curve is exact */ 00328 int pretop[4]; /* Pretopology */ 00329 int sing_start; /* Singular start end point markers */ 00330 int sing_end; 00331 } SISLTrack; 00332 00333 //=========================================================================== 00334 typedef struct SISLPoint 00335 //=========================================================================== 00336 { 00337 double ec[3]; 00338 int idim; /* The dimension the point lies in */ 00339 double *ecoef; /* Pointer to the array containing the 00340 coordinates */ 00341 int icopy; /* Indicates whether the arrays of the point 00342 are copied or referenced by creation of 00343 the point. 00344 = 0 : Pointer set to input arrays. 00345 = 1 : Copied. 00346 = 2 : Pointer set to input arrays, 00347 but are to be treated as copied. */ 00348 00349 SISLbox *pbox; /*Pointer to a structur to store the boxes. */ 00350 } SISLPoint; 00351 00352 //=========================================================================== 00353 typedef struct SISLObject 00354 //=========================================================================== 00355 { 00356 int iobj; /* Integer indicates which kind of geometric 00357 object is contained in a particular 00358 instance of the structure. 00359 = 1 (SISLCurve) - curve. 00360 = 2 (SURFACE) - tensor-product surface. */ 00361 SISLPoint *p1; /* Pointer to a point (instance of Point). */ 00362 SISLCurve *c1; /* Pointer to a curve 00363 * (instance of SISLCurve). */ 00364 SISLSurf *s1; /* Pointer to a surface 00365 * (instance of SISLSurf). */ 00366 struct SISLObject *o1; /* Pointer to parent object 00367 * (instance of Object). */ 00368 struct SISLObject *edg[4]; /* Pointer to objects edges 00369 * (instance of Object). */ 00370 struct SISLObject *psimple; /* Indicates if object/object intersection 00371 * is simple case. */ 00372 } SISLObject; 00373 00374 //=========================================================================== 00375 typedef struct SISLPtedge 00376 //=========================================================================== 00377 { 00378 SISLIntpt *ppt; /* Pointer to intersection points. */ 00379 struct SISLPtedge *pnext; /* Pointer to next element in the list. */ 00380 } SISLPtedge; 00381 00382 //=========================================================================== 00383 typedef struct SISLEdge 00384 //=========================================================================== 00385 { 00386 int iedge; /* Number of edges/endpoints of object. */ 00387 int ipoint; /* Number of intersection points found on 00388 * the edges. */ 00389 SISLPtedge **prpt; /* Array containing lists of pointers to the 00390 * intersections at the edges. */ 00391 } SISLEdge; 00392 00393 00394 00395 //=========================================================================== 00396 // SISL constructors/destructors 00397 //=========================================================================== 00398 SISLObject *newObject(int); 00399 SISLCurve *newCurve(int,int,double *,double *,int,int,int); 00400 void freeCurve(SISLCurve *); 00401 void freeObject(SISLObject *); 00402 void freeIntdat(SISLIntdat *pintdat); 00403 void sh1761 (SISLObject * po1, SISLObject * po2, double aepsge, 00404 SISLIntdat ** pintdat, int *jstat); 00405 SISLPoint *newPoint (double *ecoef, int idim, int icopy); 00406 SISLSurf *newSurf(int,int,int,int,double *,double *,double *,int,int,int); 00407 void freeIntcrvlist(SISLIntcurve **,int); 00408 void freeIntcurve(SISLIntcurve *pintc); 00409 void freeSurf(SISLSurf *); 00410 00411 //=========================================================================== 00412 // SISL functions directly used by 'sisl_dependent' 00413 //=========================================================================== 00414 00415 void s1220(double *et,int ik,int in,int *ileft, 00416 double ax,int ider,double ebder[],int *jstat); 00417 void s1310(SISLSurf *,SISLSurf *,SISLIntcurve *,double,double,int,int,int *); 00418 void s1314(SISLSurf *,double *,double *,int,double,double,double, 00419 SISLIntcurve *,int,int,int *); 00420 void s1421(SISLSurf *,int,double [],int *,int *,double [],double [],int *); 00421 void s1770(SISLCurve *,SISLCurve *,double,double,double,double,double, 00422 double,double,double *,double *,int *); 00423 void s1851(SISLSurf *,double [],double [],int,double,double, 00424 int *,double **,int *,SISLIntcurve ***,int *); 00425 void s1859(SISLSurf *,SISLSurf *,double,double, 00426 int *,double **,double **,int *,SISLIntcurve ***,int *); 00427 00428 void sh1857(SISLCurve *,SISLCurve *,double,double,int,int *,SISLTrack ***, 00429 int *,double **,double **,int **,int *,SISLIntcurve ***,int *); 00430 00431 00432 void 00433 s1871(SISLCurve *pc1, double *pt1, int idim, double aepsge, 00434 int *jpt,double **gpar1,int *jcrv,SISLIntcurve ***wcurve,int *jstat); 00435 double s6scpr(double e1[],double e2[],int idim); 00436 void s6err(const char *,int,int); 00437 00439 00440 #endif // _SISL_CODE_H 00441