00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef _GOAPPROXSURF_H_
00034 #define _GOAPPROXSURF_H_
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #include "SplineSurface.h"
00053 #include "SplineCurve.h"
00054 #include <vector>
00055
00056
00057
00058 class SmoothSurf;
00059
00060 namespace Go
00061 {
00064
00067 class ApproxSurf
00068 {
00069 public:
00098 ApproxSurf(std::vector<boost::shared_ptr<SplineCurve> > & crvs,
00099 const std::vector<double>& points,
00100 const std::vector<double>& parvals,
00101 double domain[],
00102 int dim,
00103 double aepsge,
00104 int constdir = 0);
00105
00129 ApproxSurf(boost::shared_ptr<SplineSurface>& srf,
00130 const std::vector<double>& points,
00131 const std::vector<double>& parvals,
00132 int dim, double aepsge, int constdir = 0);
00133
00134
00136 ~ApproxSurf();
00137
00141 void setSmoothingWeight(double smooth)
00142 {
00143 ASSERT(smoothweight_ >= 0.0 && smoothweight_ <= 1.0);
00144 smoothweight_ = smooth;
00145 }
00146
00153 void setFixBoundary(bool fix_boundary)
00154 {
00155 int fix = (fix_boundary) ? 1 : 0;
00156 edge_derivs_[0] = edge_derivs_[1] = edge_derivs_[2] = edge_derivs_[3] = fix;
00157 }
00158
00170 void edgeFix(int edge_fix[])
00171 {
00172 for (int ki=0; ki<4; ki++)
00173 edge_derivs_[ki] = edge_fix[ki];
00174 }
00175
00182 void setNormalConditions(const std::vector<double>& points,
00183 const std::vector<double>& parvals)
00184 {
00185 use_normals_ = true;
00186 norm_points_ = points;
00187 norm_parvals_ = parvals;
00188 }
00189
00191
00204 boost::shared_ptr<SplineSurface> getApproxSurf(double& maxdist,
00205 double& avdist,
00206 int& nmb_out_eps,
00207 int max_iter=4);
00208
00211 int reParam();
00212
00213
00214 protected:
00216 ApproxSurf();
00217
00218 private:
00219 boost::shared_ptr<SplineSurface> curr_srf_;
00220 double maxdist_;
00221 double avdist_;
00222 int outsideeps_;
00223 double aepsge_;
00224 double smoothweight_;
00225 double smoothfac_;
00226 bool use_normals_;
00227 int edge_derivs_[4];
00228
00229 int dim_;
00230 std::vector<double> points_;
00231 std::vector<double> parvals_;
00232 std::vector<double> norm_points_;
00233 std::vector<double> norm_parvals_;
00234 int constdir_;
00235
00237 int makeInitSurf(std::vector<boost::shared_ptr<SplineCurve> > &crvs,
00238 double domain[]);
00239
00241 int makeSmoothSurf();
00242
00244 int checkAccuracy();
00245
00247 int doApprox(int max_iter);
00248
00249
00250 };
00251
00253 }
00254
00255 #endif
00256
00257
00258
00259
00260
00261
00262