src/Geometry/clipConvexFacetedVolumeByPlanes2d.cc
//------------------------------------------------------------------------------
// Return a formatted string with the current polygon.
//------------------------------------------------------------------------------
Return a formatted string with the current polygon.
Return a formatted string with the current polygon .
inline
string
poly2string(const vector<Dim<2>::Vector>& vertices,
            const vector<int>& vertexMask,
            const vector<pair<int, int>>& edges,
            const vector<int>& face) {
  typedef Dim<2>::Vector Vector;
  ostringstream s;
  REQUIRE(vertices.size() == vertexMask.size());
  s << "Vertices: ";
  copy(vertices.begin(), vertices.end(), ostream_iterator<Vector>(s, " "));
  s << "\n"
    << "Vertex mask: ";
  copy(vertexMask.begin(), vertexMask.end(), ostream_iterator<int>(s, " "));
  s << "\n"
    << "Active vertices: ";
  for (auto i = 0; i < vertices.size(); ++i) {
    if (vertexMask[i] == 1) s << " ([" << i << "] " << vertices[i].x() << " " << vertices[i].y() << ")";
  }
  s << "\n"
    << "Clipped vertices: ";
  for (auto i = 0; i < vertices.size(); ++i) {
    if (vertexMask[i] == -1) s << " ([" << i << "] " << vertices[i].x() << " " << vertices[i].y() << ")";
  }
  s << "\n"
    << "Inactive vertices: ";
  for (auto i = 0; i < vertices.size(); ++i) {
    if (vertexMask[i] == 0) s << " ([" << i << "] " << vertices[i].x() << " " << vertices[i].y() << ")";
  }
  s << "\n";
  s << "Face : ";
  for (auto kedge = 0; kedge < face.size(); ++kedge) {
    s <<  " ([" << face[kedge] << "->" << posID(face[kedge]) << "] ";
    s << startVertex(face[kedge], edges) << " " << endVertex(face[kedge], edges) << ")";
  }
  s << "\n";
  return s.str();
}
inline string poly2string ( const vector < Dim < 2 > :: Vector > & vertices , const vector < int > & vertexMask , const vector < pair < int , int > > & edges , const vector < int > & face ) { typedef Dim < 2 > :: Vector Vector ; ostringstream s ; REQUIRE ( vertices . size ( ) == vertexMask . size ( ) ) ; s << " " ; copy ( vertices . begin ( ) , vertices . end ( ) , ostream_iterator < Vector > ( s , " " ) ) ; s << " \n " << " " ; copy ( vertexMask . begin ( ) , vertexMask . end ( ) , ostream_iterator < int > ( s , " " ) ) ; s << " \n " << " " ; for ( auto i = 0 ; i < vertices . size ( ) ; ++ i ) { if ( vertexMask [ i ] == 1 ) s << " " << i << " " << vertices [ i ] . x ( ) << " " << vertices [ i ] . y ( ) << " " ; } s << " \n " << " " ; for ( auto i = 0 ; i < vertices . size ( ) ; ++ i ) { if ( vertexMask [ i ] == -1 ) s << " " << i << " " << vertices [ i ] . x ( ) << " " << vertices [ i ] . y ( ) << " " ; } s << " \n " << " " ; for ( auto i = 0 ; i < vertices . size ( ) ; ++ i ) { if ( vertexMask [ i ] == 0 ) s << " " << i << " " << vertices [ i ] . x ( ) << " " << vertices [ i ] . y ( ) << " " ; } s << " \n " ; s << " " ; for ( auto kedge = 0 ; kedge < face . size ( ) ; ++ kedge ) { s << " " << face [ kedge ] << " " << posID ( face [ kedge ] ) << " " ; s << startVertex ( face [ kedge ] , edges ) << " " << endVertex ( face [ kedge ] , edges ) << " " ; } s << " \n " ; return s . str ( ) ; }
Return a formatted string with the current polygon.
Return a formatted string with the current polygon .