diff --git a/Fltk/GUI_Projection.cpp b/Fltk/GUI_Projection.cpp index 19213ea8b2e48c1132523d73e9ebe0f17c884f80..d71544ac42c07d98424e377900cd6f06041ceed6 100644 --- a/Fltk/GUI_Projection.cpp +++ b/Fltk/GUI_Projection.cpp @@ -9,6 +9,8 @@ extern Context_T CTX; #if defined(HAVE_FOURIER_MODEL) +#define HARDCODED + uvPlot::uvPlot(int x, int y, int w, int h, const char *l) : Fl_Window(x, y, w, h, l), _dmin(0.), _dmax(0.) { @@ -115,6 +117,9 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i } else if(i < 6){ //rotation currentParams[i] = 0.; +#if defined HARDCODED + currentParams[5] = 90.; +#endif v->maximum(-180.); v->minimum(180.); v->step(0.1); @@ -124,6 +129,11 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i } else if(i < 9){ // translation currentParams[i] = bounds.center()[i - 6]; +#if defined HARDCODED + currentParams[6] = 10.97; + currentParams[7] = 0.301; + currentParams[8] = 1.745; +#endif v->maximum(bounds.max()[i] + 10. * CTX.lc); v->minimum(bounds.min()[i] - 10. * CTX.lc); v->step(CTX.lc / 100.); @@ -133,6 +143,11 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i } else{ // other parameters currentParams[i] = ps->GetParameter(i - 9); +#if defined HARDCODED + currentParams[9] = .35; + currentParams[10] = .39; + currentParams[11] = 3.55; +#endif v->maximum(10. * CTX.lc); v->minimum(-10. * CTX.lc); v->step(CTX.lc / 100.); @@ -211,11 +226,15 @@ projectionEditor::projectionEditor(std::vector<FProjectionFace*> &faces) _uvPlot->end(); modes[0] = new Fl_Value_Input(WB, height - 3 * WB - 3 * BH, BB / 2, BH); + modes[0]->tooltip("Number of Fourier modes along u"); modes[1] = new Fl_Value_Input(WB + BB / 2, height - 3 * WB - 3 * BH, BB / 2, BH, - "Fourier modes along u and v"); + "Fourier modes"); + modes[1]->tooltip("Number of Fourier modes along v"); modes[2] = new Fl_Value_Input(WB, height - 3 * WB - 2 * BH, BB / 2, BH); + modes[2]->tooltip("Number of Chebyshev modes along u"); modes[3] = new Fl_Value_Input(WB + BB / 2, height - 3 * WB - 2 * BH, BB / 2, BH, - "Chebychev modes along u and v"); + "Chebyshev modes"); + modes[3]->tooltip("Number of Chebyshev modes along v"); for(int i = 0; i < 4; i++){ modes[i]->value(8); modes[i]->maximum(128); @@ -224,10 +243,13 @@ projectionEditor::projectionEditor(std::vector<FProjectionFace*> &faces) modes[i]->align(FL_ALIGN_RIGHT); } - Fl_Button *b3 = new Fl_Button(width - 2 * WB - 2 * BB, height - WB - BH, - BB, BH, "Compute"); + Fl_Button *b3 = new Fl_Button(width - WB - BB, height - 3 * WB - 3 * BH, + BB, 2 * BH, "Generate\nPatch"); b3->callback(compute_cb, this); + + + Fl_Button *b4 = new Fl_Button(width - WB - BB, height - WB - BH, BB, BH, "Cancel"); b4->callback(close_cb, _window); @@ -266,6 +288,7 @@ void browse_cb(Fl_Widget *w, void *data) projection *p = e->getCurrentProjection(); if(p){ + /* if(!GMODEL->faceByTag(p->face->tag())){ // the projection face is not in the model: add it and reset all // selections @@ -273,6 +296,7 @@ void browse_cb(Fl_Widget *w, void *data) e->getEntities().clear(); e->getElements().clear(); } + */ p->face->setVisibility(true); p->group->show(); } @@ -491,10 +515,11 @@ void compute_cb(Fl_Widget *w, void *data) if (ps->IsUPeriodic()) { Patch* patchL = - new FPatch(0,ps,u,v,f,3,(int)(e->modes[0]->value()), + new FPatch(0,ps->clone(),u,v,f,3,(int)(e->modes[0]->value()), (int)(e->modes[1]->value()),(int)(e->modes[2]->value()), - (int)(e->modes[3]->value()), e->hardEdges[0]->value(), e->hardEdges[1]->value(), - e->hardEdges[2]->value(), e->hardEdges[3]->value()); + (int)(e->modes[3]->value()), e->hardEdges[0]->value(), + e->hardEdges[1]->value(), e->hardEdges[2]->value(), + e->hardEdges[3]->value()); patchL->SetMinU(-0.35); patchL->SetMaxU(0.35); @@ -559,10 +584,11 @@ void compute_cb(Fl_Widget *w, void *data) GMODEL->add(new FFace(GMODEL,faceL,faceL->GetTag(),l_edgesL)); Patch* patchR = - new FPatch(0,ps,u,v,f,3,(int)(e->modes[0]->value()), + new FPatch(0,ps->clone(),u,v,f,3,(int)(e->modes[0]->value()), (int)(e->modes[1]->value()),(int)(e->modes[2]->value()), - (int)(e->modes[3]->value()), e->hardEdges[0]->value(), e->hardEdges[1]->value(), - e->hardEdges[2]->value(), e->hardEdges[3]->value()); + (int)(e->modes[3]->value()), e->hardEdges[0]->value(), + e->hardEdges[1]->value(), e->hardEdges[2]->value(), + e->hardEdges[3]->value()); patchR->SetMinU(0.15); patchR->SetMaxU(0.85); @@ -619,10 +645,11 @@ void compute_cb(Fl_Widget *w, void *data) } else if (ps->IsVPeriodic()) { Patch* patchL = - new FPatch(0,ps,u,v,f,3,(int)(e->modes[0]->value()), + new FPatch(0,ps->clone(),u,v,f,3,(int)(e->modes[0]->value()), (int)(e->modes[1]->value()),(int)(e->modes[2]->value()), - (int)(e->modes[3]->value()), e->hardEdges[0]->value(), e->hardEdges[1]->value(), - e->hardEdges[2]->value(), e->hardEdges[3]->value()); + (int)(e->modes[3]->value()), e->hardEdges[0]->value(), + e->hardEdges[1]->value(), e->hardEdges[2]->value(), + e->hardEdges[3]->value()); patchL->SetMinV(-0.35); patchL->SetMaxV(0.35); @@ -687,10 +714,11 @@ void compute_cb(Fl_Widget *w, void *data) GMODEL->add(new FFace(GMODEL,faceL,faceL->GetTag(),l_edgesL)); Patch* patchR = - new FPatch(0,ps,u,v,f,3,(int)(e->modes[0]->value()), + new FPatch(0,ps->clone(),u,v,f,3,(int)(e->modes[0]->value()), (int)(e->modes[1]->value()),(int)(e->modes[2]->value()), - (int)(e->modes[3]->value()), e->hardEdges[0]->value(), e->hardEdges[1]->value(), - e->hardEdges[2]->value(), e->hardEdges[3]->value()); + (int)(e->modes[3]->value()), e->hardEdges[0]->value(), + e->hardEdges[1]->value(), e->hardEdges[2]->value(), + e->hardEdges[3]->value()); patchR->SetMinV(0.15); patchR->SetMaxV(0.85); @@ -747,10 +775,11 @@ void compute_cb(Fl_Widget *w, void *data) } else { Patch* patch = - new FPatch(0,ps,u,v,f,3,(int)(e->modes[0]->value()), + new FPatch(0,ps->clone(),u,v,f,3,(int)(e->modes[0]->value()), (int)(e->modes[1]->value()),(int)(e->modes[2]->value()), - (int)(e->modes[3]->value()), e->hardEdges[0]->value(), e->hardEdges[1]->value(), - e->hardEdges[2]->value(), e->hardEdges[3]->value()); + (int)(e->modes[3]->value()), e->hardEdges[0]->value(), + e->hardEdges[1]->value(), e->hardEdges[2]->value(), + e->hardEdges[3]->value()); double LL[2], LR[2], UL[2], UR[2]; LL[0] = 0.0; LL[1] = 0.0; @@ -832,6 +861,11 @@ void mesh_parameterize_cb(Fl_Widget* w, void* data) faces.push_back(new FProjectionFace(GMODEL, ++tag, new RevolvedParabolaProjectionSurface(tag))); editor = new projectionEditor(faces); + + for(unsigned int i = 0; i < faces.size(); i++){ + faces[i]->setVisibility(false); + GMODEL->add(faces[i]); + } } editor->show(); } diff --git a/contrib/FourierModel/CylindricalProjectionSurface.h b/contrib/FourierModel/CylindricalProjectionSurface.h index 627142e9b49aec2fc632d75fac0ed00ef4b54e2c..da41071604df8745cd2e768d7b5093da96b5f12b 100755 --- a/contrib/FourierModel/CylindricalProjectionSurface.h +++ b/contrib/FourierModel/CylindricalProjectionSurface.h @@ -13,10 +13,22 @@ class CylindricalProjectionSurface : public ProjectionSurface { (int tag); CylindricalProjectionSurface (int tag, double O[3], double E0[3], double E1[3], double scale[3]); + CylindricalProjectionSurface(CylindricalProjectionSurface *ps) + : ProjectionSurface(ps) + { + twoPi_ = ps->twoPi_; + R_ = ps->R_; + Z_ = ps->Z_; + } virtual ~CylindricalProjectionSurface () {} + virtual ProjectionSurface *clone() + { + return new CylindricalProjectionSurface(this); + } + // Abstract methods of ProjectionSurface virtual void F diff --git a/contrib/FourierModel/FPatch.cpp b/contrib/FourierModel/FPatch.cpp index 3038160737d45e184f18f33fc7051dbfaedb7f81..dfb2f5ac2d54a40b1b457624e6fba71914afbe0a 100644 --- a/contrib/FourierModel/FPatch.cpp +++ b/contrib/FourierModel/FPatch.cpp @@ -32,8 +32,6 @@ FPatch::FPatch(int tag, ProjectionSurface* ps, if (_ps->IsVPeriodic()) _vM++; - printf("%d %d\n",_uM,_vM); - _hardEdge[0] = hardEdge0; _hardEdge[1] = hardEdge1; _hardEdge[2] = hardEdge2; diff --git a/contrib/FourierModel/ProjectionSurface.h b/contrib/FourierModel/ProjectionSurface.h index b6cebd29e5ac18d390aadc4bc9739d842e781777..32e2afff3ea7aa7efa399bea4466174bd7e90ad8 100755 --- a/contrib/FourierModel/ProjectionSurface.h +++ b/contrib/FourierModel/ProjectionSurface.h @@ -16,6 +16,26 @@ class ProjectionSurface { ProjectionSurface (double uPeriod = -1., double vPeriod = -1.); + ProjectionSurface(ProjectionSurface *ps) + { + tag_ = ps->tag_; + name_ = ps->name_; + numParameters_ = ps->numParameters_; + uPeriod_ = ps->uPeriod_; + vPeriod_ = ps->vPeriod_; + uPeriodic_ = ps->uPeriodic_; + vPeriodic_ = ps->vPeriodic_; + for(int i = 0; i < 3; i++){ + O_[i] = ps->O_[i]; + E0_[i] = ps->E0_[i]; + E1_[i] = ps->E1_[i]; + E2_[i] = ps->E2_[i]; + scale_[i] = ps->scale_[i]; + } + } + + virtual ProjectionSurface *clone() = 0; + virtual ~ProjectionSurface() {} inline int GetTag() { return tag_; } diff --git a/contrib/FourierModel/RevolvedParabolaProjectionSurface.h b/contrib/FourierModel/RevolvedParabolaProjectionSurface.h index a8d720b5447ae4739ed6ba0b87b723b5a8b09255..94a37ba6ad830f909dc66b812ac1c952d7ea81eb 100755 --- a/contrib/FourierModel/RevolvedParabolaProjectionSurface.h +++ b/contrib/FourierModel/RevolvedParabolaProjectionSurface.h @@ -16,10 +16,23 @@ class RevolvedParabolaProjectionSurface : public ProjectionSurface { RevolvedParabolaProjectionSurface (int tag, double O[3], double E0[3], double E1[3], double scale[3], double R, double K[2]); + RevolvedParabolaProjectionSurface(RevolvedParabolaProjectionSurface *ps) + : ProjectionSurface(ps) + { + twoPi_ = ps->twoPi_; + R_ = ps->R_; + K_[0] = ps->K_[0]; + K_[1] = ps->K_[1]; + } virtual ~RevolvedParabolaProjectionSurface () {} + virtual ProjectionSurface *clone() + { + return new RevolvedParabolaProjectionSurface(this); + } + // Abstract methods of ProjectionSurface virtual void F