Skip to content
Snippets Groups Projects
Select Git revision
  • facc9e41fdce898fd686b4d7799fce99b60875b8
  • master default protected
  • albertpiwonski-master-patch-57409
  • quadspheres
  • fix_Tmatrix_code_epsr_background
  • albertpiwonski-master-patch-12427
  • cavity
  • c1
8 results

scattererTmatrix.pro

Blame
  • contextWindow.cpp 54.43 KiB
    // Gmsh - Copyright (C) 1997-2018 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to the public mailing list <gmsh@onelab.info>.
    
    #include <stdlib.h>
    #include <FL/Fl_Tabs.H>
    #include <FL/Fl_Return_Button.H>
    #include "FlGui.h"
    #include "drawContext.h"
    #include "contextWindow.h"
    #include "paletteWindow.h"
    #include "graphicWindow.h"
    #include "openglWindow.h"
    #include "Parser.h"
    #include "GModel.h"
    #ifdef Convex // can be defined by Xlib
    #undef Convex
    #endif
    #include "GModelIO_OCC.h"
    #include "GeoStringInterface.h"
    #include "OpenFile.h"
    #include "Context.h"
    #include "Options.h"
    #include "MallocUtils.h"
    #include "Geo.h"
    #include "VertexArray.h"
    #include "mathEvaluator.h"
    
    static bool getval(const char *str, double &val)
    {
      std::vector<std::string> var;
      std::vector<double> valVar;
    
      // we should probably use the actual .geo parser instead...
      for(std::map<std::string, gmsh_yysymbol>::iterator it = gmsh_yysymbols.begin();
          it != gmsh_yysymbols.end(); it++){
        if(it->second.value.size() == 1){
          var.push_back(it->first);
          valVar.push_back(it->second.value[0]);
        }
      }
    
      std::vector<std::string> expr(1);
      expr[0] = str;
      std::vector<double> res(1);
      mathEvaluator f(expr, var);
      if(expr.empty()) return false;
      if(!f.eval(valVar, res)) return false;
      val = res[0];
      return true;
    }
    
    static void draw_stl(std::vector<SPoint3> &vertices, std::vector<SVector3> &normals,
                         std::vector<int> &triangles)
    {
      GLint mode[2];
      glGetIntegerv(GL_POLYGON_MODE, mode);
      if(CTX::instance()->geom.surfaceType == 1)
        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
      else
        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
      glEnable(GL_LIGHTING);
      glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
      glColor4ubv((GLubyte *) & CTX::instance()->color.geom.highlight[0]);
    
      VertexArray va(3, triangles.size());
      for(unsigned int i = 0; i < triangles.size(); i+=3){
        SPoint3 p1 = vertices[triangles[i]];
        SPoint3 p2 = vertices[triangles[i + 1]];