Skip to content
Snippets Groups Projects
Commit e8a87455 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

more fm work
parent f4e4fd12
Branches
Tags
No related merge requests found
...@@ -9,6 +9,8 @@ extern Context_T CTX; ...@@ -9,6 +9,8 @@ extern Context_T CTX;
#if defined(HAVE_FOURIER_MODEL) #if defined(HAVE_FOURIER_MODEL)
#define HARDCODED
uvPlot::uvPlot(int x, int y, int w, int h, const char *l) uvPlot::uvPlot(int x, int y, int w, int h, const char *l)
: Fl_Window(x, y, w, h, l), _dmin(0.), _dmax(0.) : 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 ...@@ -115,6 +117,9 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i
} }
else if(i < 6){ //rotation else if(i < 6){ //rotation
currentParams[i] = 0.; currentParams[i] = 0.;
#if defined HARDCODED
currentParams[5] = 90.;
#endif
v->maximum(-180.); v->maximum(-180.);
v->minimum(180.); v->minimum(180.);
v->step(0.1); v->step(0.1);
...@@ -124,6 +129,11 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i ...@@ -124,6 +129,11 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i
} }
else if(i < 9){ // translation else if(i < 9){ // translation
currentParams[i] = bounds.center()[i - 6]; 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->maximum(bounds.max()[i] + 10. * CTX.lc);
v->minimum(bounds.min()[i] - 10. * CTX.lc); v->minimum(bounds.min()[i] - 10. * CTX.lc);
v->step(CTX.lc / 100.); v->step(CTX.lc / 100.);
...@@ -133,6 +143,11 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i ...@@ -133,6 +143,11 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i
} }
else{ // other parameters else{ // other parameters
currentParams[i] = ps->GetParameter(i - 9); 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->maximum(10. * CTX.lc);
v->minimum(-10. * CTX.lc); v->minimum(-10. * CTX.lc);
v->step(CTX.lc / 100.); v->step(CTX.lc / 100.);
...@@ -211,11 +226,15 @@ projectionEditor::projectionEditor(std::vector<FProjectionFace*> &faces) ...@@ -211,11 +226,15 @@ projectionEditor::projectionEditor(std::vector<FProjectionFace*> &faces)
_uvPlot->end(); _uvPlot->end();
modes[0] = new Fl_Value_Input(WB, height - 3 * WB - 3 * BH, BB / 2, BH); 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, 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] = 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, 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++){ for(int i = 0; i < 4; i++){
modes[i]->value(8); modes[i]->value(8);
modes[i]->maximum(128); modes[i]->maximum(128);
...@@ -224,10 +243,13 @@ projectionEditor::projectionEditor(std::vector<FProjectionFace*> &faces) ...@@ -224,10 +243,13 @@ projectionEditor::projectionEditor(std::vector<FProjectionFace*> &faces)
modes[i]->align(FL_ALIGN_RIGHT); modes[i]->align(FL_ALIGN_RIGHT);
} }
Fl_Button *b3 = new Fl_Button(width - 2 * WB - 2 * BB, height - WB - BH, Fl_Button *b3 = new Fl_Button(width - WB - BB, height - 3 * WB - 3 * BH,
BB, BH, "Compute"); BB, 2 * BH, "Generate\nPatch");
b3->callback(compute_cb, this); b3->callback(compute_cb, this);
Fl_Button *b4 = new Fl_Button(width - WB - BB, height - WB - BH, Fl_Button *b4 = new Fl_Button(width - WB - BB, height - WB - BH,
BB, BH, "Cancel"); BB, BH, "Cancel");
b4->callback(close_cb, _window); b4->callback(close_cb, _window);
...@@ -266,6 +288,7 @@ void browse_cb(Fl_Widget *w, void *data) ...@@ -266,6 +288,7 @@ void browse_cb(Fl_Widget *w, void *data)
projection *p = e->getCurrentProjection(); projection *p = e->getCurrentProjection();
if(p){ if(p){
/*
if(!GMODEL->faceByTag(p->face->tag())){ if(!GMODEL->faceByTag(p->face->tag())){
// the projection face is not in the model: add it and reset all // the projection face is not in the model: add it and reset all
// selections // selections
...@@ -273,6 +296,7 @@ void browse_cb(Fl_Widget *w, void *data) ...@@ -273,6 +296,7 @@ void browse_cb(Fl_Widget *w, void *data)
e->getEntities().clear(); e->getEntities().clear();
e->getElements().clear(); e->getElements().clear();
} }
*/
p->face->setVisibility(true); p->face->setVisibility(true);
p->group->show(); p->group->show();
} }
...@@ -491,10 +515,11 @@ void compute_cb(Fl_Widget *w, void *data) ...@@ -491,10 +515,11 @@ void compute_cb(Fl_Widget *w, void *data)
if (ps->IsUPeriodic()) { if (ps->IsUPeriodic()) {
Patch* patchL = 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[1]->value()),(int)(e->modes[2]->value()),
(int)(e->modes[3]->value()), e->hardEdges[0]->value(), e->hardEdges[1]->value(), (int)(e->modes[3]->value()), e->hardEdges[0]->value(),
e->hardEdges[2]->value(), e->hardEdges[3]->value()); e->hardEdges[1]->value(), e->hardEdges[2]->value(),
e->hardEdges[3]->value());
patchL->SetMinU(-0.35); patchL->SetMinU(-0.35);
patchL->SetMaxU(0.35); patchL->SetMaxU(0.35);
...@@ -559,10 +584,11 @@ void compute_cb(Fl_Widget *w, void *data) ...@@ -559,10 +584,11 @@ void compute_cb(Fl_Widget *w, void *data)
GMODEL->add(new FFace(GMODEL,faceL,faceL->GetTag(),l_edgesL)); GMODEL->add(new FFace(GMODEL,faceL,faceL->GetTag(),l_edgesL));
Patch* patchR = 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[1]->value()),(int)(e->modes[2]->value()),
(int)(e->modes[3]->value()), e->hardEdges[0]->value(), e->hardEdges[1]->value(), (int)(e->modes[3]->value()), e->hardEdges[0]->value(),
e->hardEdges[2]->value(), e->hardEdges[3]->value()); e->hardEdges[1]->value(), e->hardEdges[2]->value(),
e->hardEdges[3]->value());
patchR->SetMinU(0.15); patchR->SetMinU(0.15);
patchR->SetMaxU(0.85); patchR->SetMaxU(0.85);
...@@ -619,10 +645,11 @@ void compute_cb(Fl_Widget *w, void *data) ...@@ -619,10 +645,11 @@ void compute_cb(Fl_Widget *w, void *data)
} }
else if (ps->IsVPeriodic()) { else if (ps->IsVPeriodic()) {
Patch* patchL = 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[1]->value()),(int)(e->modes[2]->value()),
(int)(e->modes[3]->value()), e->hardEdges[0]->value(), e->hardEdges[1]->value(), (int)(e->modes[3]->value()), e->hardEdges[0]->value(),
e->hardEdges[2]->value(), e->hardEdges[3]->value()); e->hardEdges[1]->value(), e->hardEdges[2]->value(),
e->hardEdges[3]->value());
patchL->SetMinV(-0.35); patchL->SetMinV(-0.35);
patchL->SetMaxV(0.35); patchL->SetMaxV(0.35);
...@@ -687,10 +714,11 @@ void compute_cb(Fl_Widget *w, void *data) ...@@ -687,10 +714,11 @@ void compute_cb(Fl_Widget *w, void *data)
GMODEL->add(new FFace(GMODEL,faceL,faceL->GetTag(),l_edgesL)); GMODEL->add(new FFace(GMODEL,faceL,faceL->GetTag(),l_edgesL));
Patch* patchR = 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[1]->value()),(int)(e->modes[2]->value()),
(int)(e->modes[3]->value()), e->hardEdges[0]->value(), e->hardEdges[1]->value(), (int)(e->modes[3]->value()), e->hardEdges[0]->value(),
e->hardEdges[2]->value(), e->hardEdges[3]->value()); e->hardEdges[1]->value(), e->hardEdges[2]->value(),
e->hardEdges[3]->value());
patchR->SetMinV(0.15); patchR->SetMinV(0.15);
patchR->SetMaxV(0.85); patchR->SetMaxV(0.85);
...@@ -747,10 +775,11 @@ void compute_cb(Fl_Widget *w, void *data) ...@@ -747,10 +775,11 @@ void compute_cb(Fl_Widget *w, void *data)
} }
else { else {
Patch* patch = 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[1]->value()),(int)(e->modes[2]->value()),
(int)(e->modes[3]->value()), e->hardEdges[0]->value(), e->hardEdges[1]->value(), (int)(e->modes[3]->value()), e->hardEdges[0]->value(),
e->hardEdges[2]->value(), e->hardEdges[3]->value()); e->hardEdges[1]->value(), e->hardEdges[2]->value(),
e->hardEdges[3]->value());
double LL[2], LR[2], UL[2], UR[2]; double LL[2], LR[2], UL[2], UR[2];
LL[0] = 0.0; LL[1] = 0.0; LL[0] = 0.0; LL[1] = 0.0;
...@@ -832,6 +861,11 @@ void mesh_parameterize_cb(Fl_Widget* w, void* data) ...@@ -832,6 +861,11 @@ void mesh_parameterize_cb(Fl_Widget* w, void* data)
faces.push_back(new FProjectionFace(GMODEL, ++tag, faces.push_back(new FProjectionFace(GMODEL, ++tag,
new RevolvedParabolaProjectionSurface(tag))); new RevolvedParabolaProjectionSurface(tag)));
editor = new projectionEditor(faces); editor = new projectionEditor(faces);
for(unsigned int i = 0; i < faces.size(); i++){
faces[i]->setVisibility(false);
GMODEL->add(faces[i]);
}
} }
editor->show(); editor->show();
} }
......
...@@ -13,10 +13,22 @@ class CylindricalProjectionSurface : public ProjectionSurface { ...@@ -13,10 +13,22 @@ class CylindricalProjectionSurface : public ProjectionSurface {
(int tag); (int tag);
CylindricalProjectionSurface CylindricalProjectionSurface
(int tag, double O[3], double E0[3], double E1[3], double scale[3]); (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 ~CylindricalProjectionSurface
() {} () {}
virtual ProjectionSurface *clone()
{
return new CylindricalProjectionSurface(this);
}
// Abstract methods of ProjectionSurface // Abstract methods of ProjectionSurface
virtual void F virtual void F
......
...@@ -32,8 +32,6 @@ FPatch::FPatch(int tag, ProjectionSurface* ps, ...@@ -32,8 +32,6 @@ FPatch::FPatch(int tag, ProjectionSurface* ps,
if (_ps->IsVPeriodic()) if (_ps->IsVPeriodic())
_vM++; _vM++;
printf("%d %d\n",_uM,_vM);
_hardEdge[0] = hardEdge0; _hardEdge[0] = hardEdge0;
_hardEdge[1] = hardEdge1; _hardEdge[1] = hardEdge1;
_hardEdge[2] = hardEdge2; _hardEdge[2] = hardEdge2;
......
...@@ -16,6 +16,26 @@ class ProjectionSurface { ...@@ -16,6 +16,26 @@ class ProjectionSurface {
ProjectionSurface ProjectionSurface
(double uPeriod = -1., double vPeriod = -1.); (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() {} virtual ~ProjectionSurface() {}
inline int GetTag() { return tag_; } inline int GetTag() { return tag_; }
......
...@@ -16,10 +16,23 @@ class RevolvedParabolaProjectionSurface : public ProjectionSurface { ...@@ -16,10 +16,23 @@ class RevolvedParabolaProjectionSurface : public ProjectionSurface {
RevolvedParabolaProjectionSurface RevolvedParabolaProjectionSurface
(int tag, double O[3], double E0[3], double E1[3], double scale[3], (int tag, double O[3], double E0[3], double E1[3], double scale[3],
double R, double K[2]); 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 ~RevolvedParabolaProjectionSurface
() {} () {}
virtual ProjectionSurface *clone()
{
return new RevolvedParabolaProjectionSurface(this);
}
// Abstract methods of ProjectionSurface // Abstract methods of ProjectionSurface
virtual void F virtual void F
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment