Skip to content
Snippets Groups Projects
Select Git revision
  • 4786cbfe7cd2854635991569e0e919e91a73bde2
  • master default
  • gl2ps_1_4_0
  • gl2ps_1_3_9
  • gl2ps_1_3_8
  • gl2ps_1_3_7
  • gl2ps_1_3_6
  • gl2ps_1_3_5
  • gl2ps_1_3_4
  • gl2ps_1_3_3
  • gl2ps_1_3_2
  • gl2ps_1_3_1
  • gl2ps_1_3_0
  • gl2ps_1_2_7
  • gl2ps_1_2_6
  • gl2ps_1_2_5
  • gl2ps_1_2_4
  • gl2ps_1_2_3
  • gl2ps_1_2_2
  • gl2ps_1_2_1
  • gl2ps_1_2_0
  • gl2ps_1_1_2
22 results

gl2ps.tex

Blame
  • Forked from gl2ps / gl2ps
    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