//=========================================================================== // 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 _BOUNDEDUTILS_H 00016 #define _BOUNDEDUTILS_H 00017 00018 00019 #include "BoundedSurface.h" 00020 #include "SplineSurface.h" 00021 #include "CurveOnSurface.h" 00022 #include "LoopUtils.h" 00023 #include "Plane.h" 00024 00025 #include <boost/smart_ptr.hpp> 00026 00027 // using std::vector; 00028 // using boost::shared_ptr; 00029 // using Go::SplineSurface; 00030 // using Go::BoundedSurface; 00031 // using Go::CurveOnSurface; 00032 // using Go::Point; 00033 // using Go::ParamCurve; 00034 00035 namespace Go { 00036 00039 namespace BoundedUtils { 00040 00049 std::vector<boost::shared_ptr<CurveOnSurface> > 00050 intersectWithSurface(CurveOnSurface& curve, 00051 BoundedSurface& bounded_surf, double epsge); 00052 00070 void intersectWithSurfaces(std::vector<boost::shared_ptr<CurveOnSurface> >& curves1, 00071 boost::shared_ptr<BoundedSurface>& bd_sf1, 00072 std::vector<boost::shared_ptr<CurveOnSurface> >& curves2, 00073 boost::shared_ptr<BoundedSurface>& bd_sf2, 00074 double epsge); 00075 00078 std::vector<boost::shared_ptr<CurveOnSurface> > 00079 getPlaneIntersections(const boost::shared_ptr<ParamSurface>& surf, 00080 Point point, Point normal, double epsge, 00081 boost::shared_ptr<BoundedSurface>& bounded_sf); 00082 00085 void 00086 getSurfaceIntersections(const boost::shared_ptr<ParamSurface>& surf1, 00087 const boost::shared_ptr<ParamSurface>& surf2, 00088 double epsge, 00089 std::vector<boost::shared_ptr<CurveOnSurface> >& int_cv1, 00090 boost::shared_ptr<BoundedSurface>& bounded_sf1, 00091 std::vector<boost::shared_ptr<CurveOnSurface> >& int_cv2, 00092 boost::shared_ptr<BoundedSurface>& bounded_sf2); 00093 00096 std::vector<boost::shared_ptr<BoundedSurface> > 00097 splitWithPlane(const boost::shared_ptr<ParamSurface>& surf, 00098 Point point, Point normal, double epsge); 00099 00101 std::vector<boost::shared_ptr<BoundedSurface> > 00102 splitBetweenParams(const boost::shared_ptr<ParamSurface>& surf, 00103 Point parval1, Point parval2, double epsge); 00104 00105 std::vector<boost::shared_ptr<BoundedSurface> > 00106 splitBetweenParPairs(const boost::shared_ptr<ParamSurface>& surf, 00107 std::vector<std::pair<Point,Point> > parvals, 00108 double epsge); 00109 00111 std::vector<boost::shared_ptr<CurveOnSurface> > 00112 getTrimCrvsParam(const boost::shared_ptr<ParamSurface>& surf, 00113 Point parval1, Point parval2, double epsge, 00114 boost::shared_ptr<BoundedSurface>& bounded_sf); 00115 00128 std::vector<boost::shared_ptr<BoundedSurface> > 00129 trimWithPlane(const boost::shared_ptr<ParamSurface>& surf, 00130 Point point, Point normal, double epsge); 00131 00134 00144 std::vector<boost::shared_ptr<BoundedSurface> > 00145 trimSurfWithSurf(const boost::shared_ptr<ParamSurface>& sf1, 00146 const boost::shared_ptr<ParamSurface>& sf2, double epsge); 00147 00148 00149 std::vector<std::vector<boost::shared_ptr<BoundedSurface> > > 00150 trimSurfsWithSurfs(const std::vector<boost::shared_ptr<ParamSurface> >& sfs1, 00151 const std::vector<boost::shared_ptr<ParamSurface> >& sfs2, double epsge); 00152 00153 00156 00163 BoundedSurface* convertToBoundedSurface(const SplineSurface& surf, 00164 double space_epsilon); 00165 00169 00177 std::vector< std::vector< boost::shared_ptr< CurveOnSurface > > > 00178 getBoundaryLoops(const BoundedSurface& sf, 00179 std::vector< boost::shared_ptr< CurveOnSurface > >& 00180 part_bnd_cvs, int last_split=-1); 00181 00186 00187 00203 std::vector<boost::shared_ptr<BoundedSurface> > 00204 createTrimmedSurfs(std::vector<std::vector<boost::shared_ptr<CurveOnSurface> > >& loops, 00205 boost::shared_ptr<ParamSurface> under_sf, 00206 double epsgeo); 00207 00212 std::vector<boost::shared_ptr<BoundedSurface> > 00213 splitWithTrimSegments(boost::shared_ptr<BoundedSurface> surf, 00214 std::vector< boost::shared_ptr< CurveOnSurface > >& bnd_cvs, 00215 double eps); 00216 00219 std::vector<boost::shared_ptr<BoundedSurface> > 00220 subtractSfPart(boost::shared_ptr<BoundedSurface> surf, 00221 std::vector< boost::shared_ptr< CurveOnSurface > >& bnd_cvs, 00222 double eps); 00223 00232 std::vector<boost::shared_ptr<CurveOnSurface> > 00233 intersectWithPlane(boost::shared_ptr<SplineSurface>& surf, 00234 Point pnt, Point normal, double geom_tol); 00235 00244 void getIntersectionCurve(boost::shared_ptr<SplineSurface>& sf1, 00245 boost::shared_ptr<SplineSurface>& sf2, 00246 std::vector<boost::shared_ptr<CurveOnSurface> >& int_segments1, 00247 std::vector<boost::shared_ptr<CurveOnSurface> >& int_segments2, 00248 double epsge); 00249 00250 00255 void translateBoundedSurf(Point trans_vec, BoundedSurface& bd_sf, 00256 double deg_eps); 00257 00258 // Rotate a given BoundedSurface 00263 void rotateBoundedSurf(Point rot_axis, double alpha, 00264 BoundedSurface& bf_sf, double deg_eps); 00265 00268 void trimSurfaceKinks(const BoundedSurface& sf, double max_normal_angle, 00269 std::vector<double>& g1_disc_u, 00270 std::vector<double>& g1_disc_v, 00271 bool compute_g1_disc = true); 00272 00277 int checkAndFixLoopOrientation(boost::shared_ptr<BoundedSurface> surf); 00278 00285 boost::shared_ptr<Go::SplineSurface> 00286 makeTrimmedPlane(boost::shared_ptr<Go::Plane>& plane, 00287 std::vector<boost::shared_ptr<Go::ParamCurve> >& 00288 space_crvs); 00289 00290 void translatePlaneToCurves(boost::shared_ptr<Go::Plane>& plane, 00291 std::vector<boost::shared_ptr<Go::ParamCurve> >& 00292 space_crvs); 00293 00294 void fixInvalidBoundedSurface(boost::shared_ptr<Go::BoundedSurface>& bd_sf); 00295 00296 00297 } // namespace Go 00298 } // namespace BoundedUtils 00299 00300 #endif // _BOUNDEDUTILS_H