//=========================================================================== // 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. //=========================================================================== 00020 #ifndef _SMOOTHTRANSITION_H_ 00021 #define _SMOOTHTRANSITION_H_ 00022 00023 #include <boost/smart_ptr.hpp> 00024 00025 #include "GoTools/utils/Point.h" 00026 #include "GoTools/creators/EvalCurveSet.h" 00027 #include "GoTools/geometry/SplineCurve.h" 00028 #include "GoTools/geometry/SplineSurface.h" 00029 #include "GoTools/geometry/SISLconversion.h" 00030 00031 namespace Go 00032 { 00033 00040 00041 class SmoothTransition : public EvalCurveSet 00042 { 00043 public: 00044 00046 SmoothTransition(boost::shared_ptr<const SplineCurve>& inters_crv, 00047 boost::shared_ptr<const SplineCurve>& p_crv1, 00048 boost::shared_ptr<const SplineCurve>& p_crv2, 00049 boost::shared_ptr<const ParamSurface> surf1, 00050 boost::shared_ptr<const ParamSurface> surf2, 00051 double offset_dist1, double offset_dist2, 00052 double epsgeo); 00053 00054 // Inherited from EvalCurve 00055 00057 virtual ~SmoothTransition(); 00058 virtual std::vector<Point> eval( double t); // offset1, offset1p, offset1_cross_tan, 00059 // offset2, offset2p, offset2_cross_tan 00060 virtual void eval(double t, int n, std::vector<std::vector<Point> >& der); // Exact value. 00061 virtual double start(); 00062 virtual double end(); 00063 virtual int dim(); // Dimension of space, i.e. 3. 00064 virtual bool approximationOK(double par, const std::vector<Point>& approxpos, 00065 double tol1, double tol2); 00066 virtual int nmbCvs() 00067 { return 6; } 00068 00069 private: 00070 boost::shared_ptr<const SplineCurve> inters_crv_; 00071 // Param curves serve as seed generators for closest point eval. 00072 boost::shared_ptr<const SplineCurve> p_crv1_; 00073 boost::shared_ptr<const SplineCurve> p_crv2_; 00074 boost::shared_ptr<const ParamSurface> surf1_; 00075 boost::shared_ptr<const ParamSurface> surf2_; 00076 boost::shared_ptr<const SplineSurface> under_surf1_; 00077 boost::shared_ptr<const SplineSurface> under_surf2_; 00078 double offset_dist1_; // In direction normal to surf1_. 00079 double offset_dist2_; // In direction normal to surf2_. 00080 const double epsgeo_; 00081 const double kinktol_; 00082 std::vector<double> tangent_lengths_; // We set required lengths on the tangents (0, 1, 3, 4). 00083 00084 // Given space point, we project onto surface, returning parameter values. 00085 // If seed has size two, value is used in closest point evaluation. 00086 Point projectPoint(const Point& space_pt, const ParamSurface& surf, 00087 std::vector<double>& seed, bool boundary_pt, 00088 double epsgeo, double& dist); 00089 00090 // Given input we compute the point and tangent std::vector of the cross tangent curve. 00091 // space_pt must be of size 2, local_pt of size derivs+1 (derivs not larger than 1). 00092 std::vector<Point> computeCrosstangentValues(std::vector<Point>& space_pt, 00093 std::vector<Point>& local_pt, int derivs); 00094 00095 // We try to guess parameter values of intersection between sf1 & sf2 & plane defined by 00096 // inters_cv_pt and it's tangent. Tangent is not needed as it is defined by normal in sfs. 00097 void guessParameterPoints(const Point& inters_cv_pt, double t, 00098 const SplineCurve& inters_cv, 00099 const ParamSurface& sf1, const ParamSurface& sf2, 00100 const SplineCurve& p_inters_cv1, const SplineCurve& p_inters_cv2, 00101 double offset_dist1, double offset_dist2, 00102 Point& guess_pt1, Point& guess_pt2); 00103 00104 // param_cv may be parametrized in the opposite direction, as given by pcv_turned. 00105 std::vector<double> 00106 getSuggestedSurfaceParameter(const SplineCurve& space_cv, double t, 00107 const SplineCurve& param_cv, 00108 bool pcv_turned); 00109 00110 // Given a point in space, close to input surface point, we use partial derivatives in input 00111 // point to make a guess on parameter values of projection of space point. 00112 // surf_par_pt is of dimension 2, while space_pt shares dimension with surf. 00113 std::vector<double> getSuggestedSurfaceParameter(Point& surf_par_pt, const ParamSurface& surf, 00114 Point& space_pt, double tolerance); 00115 00116 void offsetIntersectionPoints(std::vector<Point>& ep, std::vector<Point>& eq, 00117 std::vector<Point>& eoffp, std::vector<Point>& eoffq, 00118 Point& eparp, Point& eparq, 00119 std::vector<Point>& espine, std::vector<Point>& egeobb1, 00120 std::vector<Point>& egeobb2, std::vector<Point>& ecrtan1, 00121 std::vector<Point>& ecrtan2, std::vector<Point>& egeop, 00122 std::vector<Point>& egeoq, std::vector<double>& curv_radis); 00123 00124 void offsetIntersectionIterate(double arad1, double arad2, std::vector<Point>& epoint, 00125 std::vector<Point>& epnt1, std::vector<Point>& epnt2, 00126 Point& epar1, Point& epar2, 00127 const SplineSurface& psurf1, const SplineSurface& psurf2, 00128 double astep, double aepsge, std::vector<Point>& gpnt1, 00129 std::vector<Point>& gpnt2, std::vector<Point>& goffpnt1, 00130 std::vector<Point>& goffpnt2, Point& gpar1, 00131 Point& gpar2p); 00132 00133 void blend_s1421(const SplineSurface* ps, double aoffset, int ider, 00134 const Point& epar, int& ilfs, int& ilft, 00135 std::vector<Point>& eoffpnt, std::vector<Point>& epnt, int* jstat); 00136 00137 00138 }; 00139 00140 } // namespace Go 00141 00142 #endif // _SMOOTHTRANSITION_H_
Generated on Tue Sep 21 15:44:16 2010 for GoTools Core by  doxygen 1.6.3