Skip to content
Snippets Groups Projects
Select Git revision
  • be1117bc68966c7df6014f0fc4bc138fcb51bfca
  • master default protected
  • alphashapes
  • quadMeshingTools
  • cygwin_conv_path
  • macos_arm64
  • add-transfiniteautomatic-to-geo
  • patch_releases_4_10
  • HierarchicalHDiv
  • isuruf-master-patch-63355
  • hyperbolic
  • hexdom
  • hxt_update
  • jf
  • 1618-pythonocc-and-gmsh-api-integration
  • octreeSizeField
  • hexbl
  • alignIrregularVertices
  • getEdges
  • patch_releases_4_8
  • isuruf-master-patch-51992
  • gmsh_4_11_0
  • gmsh_4_10_5
  • gmsh_4_10_4
  • gmsh_4_10_3
  • gmsh_4_10_2
  • gmsh_4_10_1
  • gmsh_4_10_0
  • gmsh_4_9_5
  • gmsh_4_9_4
  • gmsh_4_9_3
  • gmsh_4_9_2
  • gmsh_4_9_1
  • gmsh_4_9_0
  • gmsh_4_8_4
  • gmsh_4_8_3
  • gmsh_4_8_2
  • gmsh_4_8_1
  • gmsh_4_8_0
  • gmsh_4_7_1
  • gmsh_4_7_0
41 results

GModelIO_DIFF.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    MEdge.cpp 1.73 KiB
    // Gmsh - Copyright (C) 1997-2016 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 <algorithm>
    #include "MEdge.h"
    #include "Numeric.h"
    
    bool MEdge::isInside(MVertex *v) const
    {
      double tol = MVertexLessThanLexicographic::tolerance;
      MVertex *v0 = _v[0];
      MVertex *v1 = _v[1];
      MVertexLessThanLexicographic lt;
      if(lt(v0, v1)){
        v0 = _v[1]; v1 = _v[0];
      }
      double x = v->x(), y = v->y(), z = v->z();
      double x0 = v0->x(), y0 = v0->y(), z0 = v0->z();
      double x1 = v1->x(), y1 = v1->y(), z1 = v1->z();
      if(fabs(x - x0) < tol && fabs(y - y0) < tol && fabs(z - z0) < tol)
        return true;
      if(fabs(x - x1) < tol && fabs(y - y1) < tol && fabs(z - z1) < tol)
        return true;
      if(x < x0 - tol || x > x1 + tol ||
         y < std::min(y0, y1) - tol || y > std::max(y0, y1) + tol ||
         z < std::min(z0, z1) - tol || z > std::max(z0, z1) + tol)
        return false;
      if(fabs(x1 - x0) > tol){
        double tx = (x - x0) / (x1 - x0);
        if(fabs(y1 - y0) > tol){
          double ty = (y - y0) / (y1 - y0);
          if(fabs(z1 - z0) > tol){
            double tz = (z - z0) / (z1 - z0);
            if(fabs(tx - ty) > tol || fabs(tx - tz) > tol)
              return false;
          }
          else{
            if(fabs(tx - ty) > tol)
              return false;
          }
        }
        else{
          if(fabs(z1 - z0) > tol){
            double tz = (z - z0) / (z1 - z0);
            if(fabs(tx - tz) > tol)
              return false;
          }
        }
      }
      else{
        if(fabs(y1 - y0) > tol){
          double ty = (y - y0) / (y1 - y0);
          if(fabs(z1 - z0) > tol){
            double tz = (z - z0) / (z1 - z0);
            if(fabs(ty - tz) > tol)
              return false;
          }
        }
      }
      return true;
    }