Skip to content
Snippets Groups Projects
Select Git revision
  • 68cda7be3120294b0e9385d006e2b4cb9847efb1
  • master default
  • cgnsUnstructured
  • partitioning
  • poppler
  • HighOrderBLCurving
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
  • gmsh_2_8_6
26 results

mainWindow.h

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    MEdge.h 3.63 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>.
    
    #ifndef _MEDGE_H_
    #define _MEDGE_H_
    
    #include <functional>
    #include "MVertex.h"
    #include "SVector3.h"
    
    // A mesh edge.
    class MEdge {
     private:
      MVertex *_v[2];
      char _si[2]; // sorted indices
    
     public:
      MEdge()
      {
        _v[0] = _v[1] = 0;
        _si[0] = _si[1] = 0;
      }
      MEdge(MVertex *v0, MVertex *v1)
      {
        _v[0] = v0; _v[1] = v1;
        if(_v[1]->getNum() < _v[0]->getNum()) {
          _si[0] = 1;
          _si[1] = 0;
        }
        else {
          _si[0] = 0;
          _si[1] = 1;
        }
      }
      inline int getNumVertices() const { return 2; }
      inline MVertex *getVertex(const int i) const { return _v[i]; }
      inline MVertex *getSortedVertex(const int i) const { return _v[int(_si[i])]; }
      inline MVertex *getMinVertex() const { return _v[int(_si[0])]; }
      inline MVertex *getMaxVertex() const { return _v[int(_si[1])]; }
      
      inline int computeCorrespondence(MEdge& other) {
        if (other.getVertex(0) == _v[0] && other.getVertex(1) == _v[1]) return 1;
        else if (other.getVertex(0) == _v[1] && other.getVertex(1) == _v[0]) return -1;
        return 0;
      }
    
      SVector3 scaledTangent() const
      {
        return SVector3(_v[1]->x() - _v[0]->x(),
                        _v[1]->y() - _v[0]->y(),
                        _v[1]->z() - _v[0]->z());
      }
      SVector3 tangent() const
      {
        SVector3 t(_v[1]->x() - _v[0]->x(),
                   _v[1]->y() - _v[0]->y(),
                   _v[1]->z() - _v[0]->z());
        t.normalize();
        return t;
      }
      double length() const
      {
        SVector3 t(_v[1]->x() - _v[0]->x(),
                   _v[1]->y() - _v[0]->y(),
                   _v[1]->z() - _v[0]->z());
        return t.norm();
      }
      SVector3 normal() const