00001 /* LIBGUL - Geometry Utility Library 00002 * Copyright (C) 1998-1999 Norbert Irmer 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Library General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this library; if not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef GUAR_INTERSECT_H 00021 #define GUAR_INTERSECT_H 00022 00023 namespace guar { 00024 00025 /*----------------------------------------------------------------------- 00026 Estimate the (u,v) parameter values of a point P for a NURBS surface F, 00027 assuming that A = F(0,0), B = F(1,0), C = F(0,1) 00028 ------------------------------------------------------------------------*/ 00029 template< class T > 00030 GULAPI void BarycentricCoordinates( 00031 const gul::point<T>& P1, const gul::point<T>& P2, 00032 const gul::point<T>& P3, const gul::point<T>& Pin, 00033 T *w, T *u, T *v ); 00034 00035 /*----------------------------------------------------------------------- 00036 Estimate the (u,v) parameter values of a point P for a NURBS surface F, 00037 assuming that A = F(0,0), B = F(1,0), C = F(0,1) 00038 (remark: same as above for the case that the calculation of some 00039 intermediate results is not necessary) 00040 ------------------------------------------------------------------------*/ 00041 template< class T > 00042 GULAPI void BarycentricCoordinates( 00043 const gul::point<T>& P1, const gul::point<T>& P2, 00044 const gul::point<T>& P3, const gul::point<T>& P12, 00045 const gul::point<T>& P13, const gul::point<T>& P23, 00046 const gul::point<T>& N, const gul::point<T>& Pin, 00047 T *w, T *u, T *v ); 00048 00049 /*---------------------------------------------------------------- 00050 calculates the endpoints of the intersection line segment of two 00051 triangles (the cases with both triangles being coplanar is not 00052 handled). 00053 it also checks if the two halves of the triangles left and right 00054 of the intersection line are lying above or below the other 00055 triangle 00056 ----------------------------------------------------------------*/ 00057 GULAPI int IntersectTriangles( 00058 const gul::triangle<rational>& tri0, 00059 const gul::triangle<rational>& tri1, 00060 gul::Ptr<gul::point<rational> >& retP ); 00061 00062 /*---------------------------------------------------------------- 00063 calculates the endpoints of the intersection line segment of two 00064 triangles (the cases with both triangles being coplanar or just 00065 touching in one point is not handled). 00066 it also checks if the two halves of the triangles left and right 00067 of the intersection line are lying above or below the other 00068 triangle 00069 ----------------------------------------------------------------*/ 00070 GULAPI bool IntersectTrianglesUV( 00071 const gul::triangle<rational>& tri1, const gul::triangle2<rational>& tri1uv, 00072 const gul::triangle<rational>& tri2, const gul::triangle2<rational>& tri2uv, 00073 gul::point2<rational> *S1uv, int *S1flag, 00074 gul::point2<rational> *S2uv, int *S2flag, 00075 gul::point<rational> *S ); 00076 00077 } 00078 00079 #endif