//=========================================================================== // 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. //=========================================================================== 00013 #ifndef _GEOMETRYTOOLS_H 00014 #define _GEOMETRYTOOLS_H 00015 00016 #include "GoTools/geometry/SplineCurve.h" 00017 #include "GoTools/geometry/SplineSurface.h" 00018 #include "GoTools/geometry/LineCloud.h" 00019 #include "GoTools/utils/Array.h" 00020 #include <boost/smart_ptr.hpp> 00021 #include <vector> 00022 #include "GoTools/utils/config.h" 00023 00030 00031 00032 namespace Go 00033 { 00034 00035 //----------------------------------------------------------------------- 00036 // 00037 // Tool functions in alphabetical order. 00038 // 00039 //----------------------------------------------------------------------- 00040 00041 00052 int GO_API 00053 analyzePeriodicity(const SplineCurve& cv, double knot_tol = 1e-12); 00054 00069 int GO_API 00070 analyzePeriodicity(const SplineSurface& sf, int direction, 00071 double knot_tol = 1e-12); 00072 00084 int GO_API analyzePeriodicity(const BsplineBasis& basis, 00085 double knot_tol = 1e-12); 00086 00101 int GO_API analyzePeriodicityDerivs(const ParamCurve& cv, 00102 int max_derivs, 00103 double tol = 1e-14); 00104 00122 int GO_API analyzePeriodicityDerivs(const SplineSurface& sf, 00123 int direction, 00124 int max_derivs, 00125 double tol = 1e-14); 00126 00139 boost::shared_ptr<SplineCurve> GO_API 00140 curveSum(const SplineCurve& crv1, double fac1, 00141 const SplineCurve& crv2, double fac2, 00142 double num_tol = 1e-05); 00143 00144 // The same requirements as in curveSum(). 00145 boost::shared_ptr<SplineSurface> GO_API 00146 surfaceSum(const SplineSurface& sf1, double fac1, 00147 const SplineSurface& sf2, double fac2, 00148 double num_tol = 1e-05); 00149 00156 void GO_API estimateSurfaceSize(const ParamSurface& srf, double& length_u, 00157 double& length_v, double *area=NULL); 00158 00165 void GO_API estimateIsoCurveLength(const SplineSurface& srf, bool dir_u, 00166 double par, double& length); 00167 00170 bool GO_API degenerateToCurve(const SplineSurface& srf, bool dir_u, 00171 double tol); 00172 00174 void GO_API makeBdDegenerate(SplineSurface& srf, int bd_idx); // left, right, bottom, top 00175 00177 void GO_API makeUnionKnots(std::vector<BsplineBasis>& bbasis, 00178 double tol, std::vector<double>& union_knots); 00179 00182 bool GO_API checkConstantCoef(SplineCurve& cv, int idx, double val, 00183 double max_dist, double tol); 00184 00187 void GO_API setSfBdCoefToConst(SplineSurface& srf, int bd_idx, int idx_d, 00188 double val, double deg_tol); 00189 00196 void GO_API findDominant(const SplineSurface& surface, 00197 Vector3D& dominant_u, 00198 Vector3D& dominant_v); 00199 00210 void GO_API getGnJoints(const ParamCurve& curve, 00211 const std::vector<double>& cont, 00212 std::vector<double>& gn_joints); 00213 00232 void GO_API getGnJoints(const CurveLoop& loop, 00233 const std::vector<double>& cont, 00234 std::vector<std::vector<double> >& gn_joints); 00235 00246 bool GO_API isCoincident(const ParamCurve& cv1, const ParamCurve& cv2, 00247 double epsge); 00248 00259 bool GO_API negativeProj(const SplineSurface& surface, 00260 const Array<Vector3D, 2>& refvector, 00261 const double eps = 0.0); 00262 00263 boost::shared_ptr<ParamCurve> GO_API 00264 projectCurve(boost::shared_ptr<ParamCurve> incurve, 00265 const Point& normal, 00266 bool planar); 00267 00277 boost::shared_ptr<SplineCurve> GO_API 00278 projectCurve(const SplineCurve& incurve, 00279 const Point& normal, 00280 bool planar); 00281 00282 // /// Project the input pt onto space defined by leg1 & leg2. 00283 // /// The projected pt is given as: proj_pt = coef1*leg1 + coef2*leg2. 00284 // void projectPoint(Point pt, Point leg1, Point leg2, 00285 // double& coef1, double& coef2); 00286 00299 boost::shared_ptr<SplineCurve> GO_API 00300 representSurfaceAsCurve(const SplineSurface& surface, 00301 int cv_dir); 00302 00306 00319 boost::shared_ptr<SplineSurface> GO_API 00320 representCurveAsSurface(const SplineCurve& curve, 00321 int cv_dir, 00322 const BsplineBasis& other_bas, 00323 bool rational); 00324 00332 std::vector<double> GO_API getRotationMatrix(const Point& unit_axis_dir, 00333 double alpha); 00334 00340 void GO_API rotateSplineSurf(Point rot_axis, double alpha, 00341 SplineSurface& sf); 00342 00348 void GO_API rotateSplineCurve(Point rot_axis, double alpha, 00349 SplineCurve& cv); 00350 00356 void GO_API rotateLineCloud(Point rot_axis, double alpha, LineCloud& lc); 00357 00365 void GO_API rotatePoint(Point rot_axis, double alpha, double* space_pt); 00372 void GO_API rotatePoint(Point rot_axis, double alpha, Point& space_pt); 00373 00374 00376 void GO_API splitCurveIntoSegments(const SplineCurve& cv, 00377 std::vector<SplineCurve>& seg); 00378 00379 00381 std::vector<boost::shared_ptr<SplineSurface> > GO_API 00382 splitInKinks(const SplineSurface& sf, 00383 const std::vector<double>& u_kinks, 00384 const std::vector<double>& v_kinks); 00385 00386 00388 void GO_API splitSurfaceIntoPatches(const SplineSurface& sf, 00389 std::vector<SplineSurface>& pat); 00390 00391 00394 void GO_API surfaceKinks(const SplineSurface& sf, double max_normal_angle, 00395 std::vector<double>& g1_disc_u, 00396 std::vector<double>& g1_disc_v, 00397 bool compute_g1_disc = true); 00398 00400 void GO_API curveKinks(const SplineCurve& cv, double tol, double ang_tol, 00401 std::vector<double>& c1_disconts, 00402 std::vector<double>& g1_disconts); 00403 00405 void GO_API translateSplineSurf(const Point& trans_vec, SplineSurface& sf); 00406 00408 void GO_API translateSplineCurve(const Point& trans_vec, SplineCurve& cv); 00409 00411 void GO_API translateLineCloud(const Point& trans_vec, LineCloud& lc); 00412 00415 void GO_API 00416 averageBoundaryCoefs(boost::shared_ptr<SplineSurface>& srf1, int bd1, 00417 bool keep_first, 00418 boost::shared_ptr<SplineSurface>& srf2, int bd2, 00419 bool keep_second, bool found_corner1, Point corner1, 00420 bool found_corner2, Point corner2, bool opposite); 00421 00424 void GO_API 00425 unifyCurveSplineSpace(std::vector<boost::shared_ptr<SplineCurve> >& curves, 00426 double tol); 00427 00431 void GO_API 00432 unifySurfaceSplineSpace(std::vector<boost:: 00433 shared_ptr<SplineSurface> >& surfaces, 00434 double tol, int dir = 0); 00435 00448 void GO_API 00449 unifySurfaceSplineSpaceOneDir(std::vector<boost::shared_ptr<SplineSurface> >& surfaces, 00450 double tol, bool unify_u_dir); 00451 00456 boost::shared_ptr<SplineSurface> GO_API 00457 joinPatches(const std::vector<boost::shared_ptr<SplineSurface> >& patches, 00458 const SplineSurface& spline_space); 00459 00460 void GO_API insertKnotsEvenly(BsplineBasis& basis, int num_knots); 00461 void GO_API insertKnotsEvenly(BsplineBasis& basis, double tmin, double tmax, 00462 int num_knots, double knot_diff_tol = 1e-05); 00463 00464 double GO_API getKnotAtLargestInterval(const BsplineBasis& basis); 00465 00466 std::pair<double, double> GO_API 00467 getLargestParameterInterval(const BsplineBasis& basis); 00468 00469 00470 } // namespace Go 00471 00472 00473 00474 00475 00476 #endif // _GEOMETRYTOOLS_H 00477
Generated on Tue Sep 21 15:44:17 2010 for GoTools Core by  doxygen 1.6.3