src/Geometry/clipFacetedVolumeByPlanes3d.cc
//------------------------------------------------------------------------------
// Decide if the given edge plane intersection should give us a new vertex.
//------------------------------------------------------------------------------
Decide if the given edge plane intersection should give us a new vertex.
Decide if the given edge plane intersection should give us a new vertex .
inline
bool
insertVertex(std::vector<Dim<3>::Vector>& vertices,
             int& vertID,
             std::vector<int>& vertexMask,
             const int v0,
             const int v1,
             const Dim<3>::Vector& p0,
             const Dim<3>::Vector& phat) {
  const auto v = segmentPlaneIntersection(vertices[v0], vertices[v1], p0, phat);
  bool result;
  vertID = 0;
  while (vertID < vertices.size() and 
         not (vertexMask[vertID] == 1 and (vertices[vertID] - v).magnitude2() < 1.0e-16)) ++vertID;
  if (vertID == vertices.size()) {
    vertices.push_back(v);
    vertexMask.push_back(1);
    result = true;
  } else {
    result = false;
  }
  ENSURE(vertID < vertices.size());
  ENSURE(vertices.size() == vertexMask.size());
  ENSURE(vertexMask[vertID] == 1);
  return result;
}
inline bool insertVertex ( std :: vector < Dim < 3 > :: Vector > & vertices , int & vertID , std :: vector < int > & vertexMask , const int v0 , const int v1 , const Dim < 3 > :: Vector & p0 , const Dim < 3 > :: Vector & phat ) { const auto v = segmentPlaneIntersection ( vertices [ v0 ] , vertices [ v1 ] , p0 , phat ) ; bool result ; vertID = 0 ; while ( vertID < vertices . size ( ) and not ( vertexMask [ vertID ] == 1 and ( vertices [ vertID ] - v ) . magnitude2 ( ) < 1.0e-16 ) ) ++ vertID ; if ( vertID == vertices . size ( ) ) { vertices . push_back ( v ) ; vertexMask . push_back ( 1 ) ; result = true ; } else { result = false ; } ENSURE ( vertID < vertices . size ( ) ) ; ENSURE ( vertices . size ( ) == vertexMask . size ( ) ) ; ENSURE ( vertexMask [ vertID ] == 1 ) ; return result ; }
Decide if the given edge plane intersection should give us a new vertex.
Decide if the given edge plane intersection should give us a new vertex .
// Where would we like the vertex? // Is this degenerate with any existing active vertices?