From abbdf41ab19bd3ce5ec2449e6b6ac23007b52da2 Mon Sep 17 00:00:00 2001 From: Akash Anand <akasha@iitk.ac.in> Date: Fri, 1 Feb 2008 21:05:23 +0000 Subject: [PATCH] work on blending --- Fltk/GUI_Projection.cpp | 44 +++++++++++++++++++++++++++++++++++++---- Fltk/GUI_Projection.h | 4 ++++ 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/Fltk/GUI_Projection.cpp b/Fltk/GUI_Projection.cpp index fce0b98319..86d930e054 100644 --- a/Fltk/GUI_Projection.cpp +++ b/Fltk/GUI_Projection.cpp @@ -14,9 +14,10 @@ extern Context_T CTX; #if defined(HAVE_FOURIER_MODEL) -#include "FM_FPatch.h" -#include "FM_WFPatch.h" +#include "FM_BlendedPatch.h" +#include "FM_BlendOperator.h" #include "FM_PlaneProjectionSurface.h" +#include "FM_SphericalProjectionSurface.h" #include "FM_ParaboloidProjectionSurface.h" #include "FM_CylindricalProjectionSurface.h" #include "FM_RevolvedParabolaProjectionSurface.h" @@ -29,6 +30,8 @@ static fourierProjectionFace *createProjectionFaceFromName(char *name) fourierProjectionFace *f = 0; if(!strcmp(name, "plane")) f = new fourierProjectionFace(m, tag, new FM::PlaneProjectionSurface(tag)); + else if(!strcmp(name, "sphere")) + f = new fourierProjectionFace(m, tag, new FM::SphericalProjectionSurface(tag)); else if(!strcmp(name, "paraboloid")) f = new fourierProjectionFace(m, tag, new FM::ParaboloidProjectionSurface(tag)); else if(!strcmp(name, "cylinder")) @@ -371,8 +374,12 @@ projectionEditor::projectionEditor() } { - new Fl_Button(WB, height - 2 * WB - 2 * BH, BB, BH, "Blend"); - new Fl_Button(2 * WB + BB, height - 2 * WB - 2 * BH, BB, BH, "Intersect"); + Fl_Button *b1 = new Fl_Button(WB, height - 2 * WB - 2 * BH, BB, BH, + "Blend"); + b1->callback(blend_cb, this); + + Fl_Button *b2 = new Fl_Button(2 * WB + BB, height - 2 * WB - 2 * BH, BB, + BH, "Intersect"); } Fl_Button *b = new Fl_Button(width - WB - BB, height - WB - BH, BB, BH, "Cancel"); @@ -986,6 +993,34 @@ void delete_fourier(GFace *gf) m->remove(gf); } +void blend_cb(Fl_Widget *w, void *data) +{ + projectionEditor *e = (projectionEditor*)data; + + std::vector<GFace*> faces; + std::vector<FM::Patch*> patches; + + GModel *m = GModel::current(); + + for(GModel::fiter it = m->firstFace(); it != m->lastFace(); it++) + if((*it)->getNativeType() == GEntity::FourierModel) + faces.push_back(*it); + for(unsigned int i = 0; i < faces.size(); i++){ + fourierFace* ff = (fourierFace*)faces[i]; + FM::TopoFace* tf = (FM::TopoFace*)ff->getNativePtr(); + patches.push_back(tf->GetPatch()); + } + FM::BlendOperator* blendOp = new FM::BlendOperator(patches); + for (int i = 0; i < patches.size(); i++) { + FM::BlendedPatch* patch = new FM::BlendedPatch(i,blendOp); + makeGFace(patch); + } + for(unsigned int i = 0; i < faces.size(); i++) { + delete_fourier(faces[i]); + //faces[i]->setVisibility(0, true); + } +} + void action_cb(Fl_Widget *w, void *data) { std::string what((char*)data); @@ -1050,6 +1085,7 @@ void mesh_parameterize_cb(Fl_Widget* w, void* data) if(!editor){ editor = new projectionEditor(); editor->load(createProjectionFaceFromName("plane")); + editor->load(createProjectionFaceFromName("sphere")); editor->load(createProjectionFaceFromName("paraboloid")); editor->load(createProjectionFaceFromName("cylinder")); editor->load(createProjectionFaceFromName("revolvedParabola")); diff --git a/Fltk/GUI_Projection.h b/Fltk/GUI_Projection.h index 1d78405ba8..77f7a5b511 100644 --- a/Fltk/GUI_Projection.h +++ b/Fltk/GUI_Projection.h @@ -14,6 +14,9 @@ #if defined(HAVE_FOURIER_MODEL) +#include "FM_FPatch.h" +#include "FM_WFPatch.h" + void select_cb(Fl_Widget *w, void *data); void filter_cb(Fl_Widget *w, void *data); void browse_cb(Fl_Widget *w, void *data); @@ -31,6 +34,7 @@ void hide_cb(Fl_Widget *w, void *data); void save_selection_cb(Fl_Widget *w, void *data); void load_projection_cb(Fl_Widget *w, void *data); void save_projection_cb(Fl_Widget *w, void *data); +void blend_cb(Fl_Widget *w, void *data); void compute_cb(Fl_Widget *w, void *data); void action_cb(Fl_Widget *w, void *data); -- GitLab