00001 //=========================================================================== 00002 // GoTools - SINTEF Geometry Tools 00003 // 00004 // GoTools module: Intersections, version 1.0 00005 // 00006 // Copyright (C) 2000-2007 SINTEF ICT, Applied Mathematics, Norway. 00007 // 00008 // This program is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU General Public License 00010 // as published by the Free Software Foundation version 2 of the License. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with this program; if not, write to the Free Software 00019 // Foundation, Inc., 00020 // 59 Temple Place - Suite 330, 00021 // Boston, MA 02111-1307, USA. 00022 // 00023 // Contact information: E-mail: tor.dokken@sintef.no 00024 // SINTEF ICT, Department of Applied Mathematics, 00025 // P.O. Box 124 Blindern, 00026 // 0314 Oslo, Norway. 00027 // 00028 // Other licenses are also available for this software, notably licenses 00029 // for: 00030 // - Building commercial software. 00031 // - Building software whose source code you wish to keep private. 00032 //=========================================================================== 00033 #ifndef _INTERSECTIONUTILS_H 00034 #define _INTERSECTIONUTILS_H 00035 00036 00037 #include "SplineCurve.h" 00038 #include "AlgObj2DInt.h" 00039 #include "AlgObj3DInt.h" 00040 #include "SplineSurface.h" 00041 #include "BernsteinMulti.h" 00042 #include "boost/smart_ptr.hpp" 00043 #include <vector> 00044 00045 00046 namespace Go { 00049 00050 00051 00054 namespace IntersectionUtils { 00057 00058 00059 00060 // Extract 1-dim part of the cv (dim_id == 0 => implies extract 00061 // x-coord part etc). 00062 boost::shared_ptr<SplineCurve> 00063 create1DSplineCurve(const SplineCurve& cv, int dim_id); 00064 00065 boost::shared_ptr<SplineSurface> 00066 create1DSplineSurface(const SplineSurface& sf, int dim_id); 00067 00068 // Return the splinecurve as 1d product of it's nth degree 00069 // dimensional parts (x^(nx)*y^(ny)*z^(nz)) 00070 boost::shared_ptr<SplineCurve> 00071 splineCurveProduct(std::vector<boost::shared_ptr<SplineCurve> >& cv, 00072 Alg2DElem term); 00073 00074 boost::shared_ptr<SplineSurface> 00075 splineSurfaceProduct(std::vector<boost::shared_ptr<SplineSurface> >& sf, 00076 Alg3DElem term); 00077 00078 boost::shared_ptr<SplineCurve> 00079 insertCvInAlgcv(const SplineCurve& cv, AlgObj2DInt* alg_obj2d_int); 00080 00081 // In this first version we transform to BernsteinMulti, for which 00082 // multiplication is believed to be faster and more accurate. 00083 boost::shared_ptr<SplineSurface> 00084 insertSfInAlgsf(const SplineSurface& sf, AlgObj3DInt* alg_obj3d_int); 00085 00086 // Outdated version using multiplication between SplineSurface 00087 // objects. Probably to be removed. 00088 boost::shared_ptr<SplineSurface> 00089 insertSfInAlgsf2(const SplineSurface& sf, AlgObj3DInt* alg_obj3d_int); 00090 00091 // In order to insert the spline-sf into the equation we first put 00092 // it on the input barycentric coordinate system. The return sf 00093 // is the 1D-surface resulting from converting (x,y,z) to 00094 // barycentric coordinated and evaluating in the impl function. 00095 boost::shared_ptr<SplineSurface> 00096 insertSfInImplObj(const SplineSurface& spline_sf, 00097 const BernsteinTetrahedralPoly& impl, 00098 const BaryCoordSystem3D& bc); 00099 00100 // Compute the distance between the original component 00101 // representation to the composite representation. @@sbr Remove 00102 // when stable. comp_1d_sf = impl(spline_sf_x, spline_sf_y, 00103 // spline_sf_z); 00104 double 00105 distImplRepresentationCompFunction(const SplineSurface& spline_sf, 00106 const BernsteinTetrahedralPoly& impl, 00107 const BaryCoordSystem3D& bc, 00108 const SplineSurface& comp_1d_sf, 00109 double upar, double vpar); 00110 00111 00113 } // end namespace IntersectionUtils 00116 00117 00118 00120 } // end namespace Go 00121 00122 00123 #endif // _INTERSECTIONUTILS_H 00124 00125