-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISSUE #599 Updated pmp with new filesystem shim for g++9
- Loading branch information
Showing
22 changed files
with
196 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
bouncer/src/repo/manipulator/modeloptimizer/pmp/algorithms/GraphViz.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#include "pmp/algorithms/GraphViz.h" | ||
|
||
#include <unordered_map> | ||
#include <unordered_set> | ||
|
||
// https://dreampuf.github.io/GraphvizOnline | ||
|
||
using namespace pmp; | ||
|
||
GraphViz::GraphViz(SurfaceMesh& m):mesh(m) { | ||
} | ||
|
||
void GraphViz::add_edge_label(Halfedge h) | ||
{ | ||
std::cout << h.idx(); | ||
|
||
if (mesh.is_boundary(h)) | ||
{ | ||
std::cout << "b"; | ||
} | ||
|
||
std::cout << " (" << mesh.next_halfedge(h).idx(); | ||
|
||
if (mesh.is_boundary(mesh.next_halfedge(h))) | ||
{ | ||
std::cout << "b"; | ||
} | ||
|
||
std::cout << ", " << mesh.prev_halfedge(h).idx(); | ||
|
||
if (mesh.is_boundary(mesh.prev_halfedge(h))) | ||
{ | ||
std::cout << "b"; | ||
} | ||
|
||
std::cout << ")"; | ||
} | ||
|
||
void GraphViz::draw_halfedge(Halfedge h) | ||
{ | ||
std::string start = "_" + std::to_string(mesh.prev_halfedge(h).idx()) + | ||
"to" + std::to_string(h.idx()); | ||
std::string end = "_" + std::to_string(h.idx()) + "to" + | ||
std::to_string(mesh.next_halfedge(h).idx()); | ||
|
||
std::cout << start | ||
<< "[label=\"\", shape=\"point\", width=0.1, height=0.1]\n"; | ||
|
||
std::cout << end | ||
<< "[label=\"\", shape=\"point\", width=0.1, height=0.1]\n"; | ||
|
||
// Create fake vertex to reference | ||
|
||
std::cout << start; | ||
|
||
std::cout << " -> "; | ||
|
||
auto to = mesh.to_vertex(h); | ||
std::cout << end; | ||
|
||
std::cout << " [label=\""; | ||
|
||
std::cout << h.idx(); | ||
|
||
if (mesh.is_boundary(h)) | ||
{ | ||
std::cout << "b"; | ||
} | ||
|
||
std::cout << "\"]\n"; | ||
|
||
std::cout << end << " -> " << to << " [len=0,\"arrowhead\"=none]\n"; | ||
} | ||
|
||
void GraphViz::print_edge(Halfedge h) | ||
{ | ||
auto e = mesh.edge(h); | ||
if (edges.count(e.idx()) == 0) | ||
{ | ||
edges.insert(e.idx()); | ||
} | ||
else | ||
{ | ||
return; | ||
} | ||
|
||
draw_halfedge(h); | ||
draw_halfedge(mesh.opposite_halfedge(h)); | ||
} | ||
|
||
void GraphViz::print_topology(Halfedge h) | ||
{ | ||
print_topology(mesh.from_vertex(h)); | ||
print_topology(mesh.to_vertex(h)); | ||
} | ||
|
||
void GraphViz::print_topology(Vertex v) | ||
{ | ||
int n(0); | ||
auto hit = mesh.halfedges(v); | ||
auto hend = hit; | ||
if (hit) | ||
{ | ||
do | ||
{ | ||
print_edge(mesh.prev_halfedge(*hit)); | ||
print_edge(mesh.next_halfedge(*hit)); | ||
print_edge(*hit); | ||
} while (++hit != hend); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
bouncer/src/repo/manipulator/modeloptimizer/pmp/algorithms/GraphViz.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2011-2023 the Polygon Mesh Processing Library developers. | ||
// Distributed under a MIT-style license, see LICENSE.txt for details. | ||
|
||
#pragma once | ||
|
||
#include "pmp/SurfaceMesh.h" | ||
|
||
#include <set> | ||
|
||
namespace pmp { | ||
|
||
/** | ||
* The GraphViz module renders sections of a mesh to Graphviz source. This is | ||
* printed to the console. The output can be rendered by any Graphviz renderer. | ||
* For example, https://dreampuf.github.io/GraphvizOnline can render graphs in | ||
* the browser. | ||
*/ | ||
class GraphViz | ||
{ | ||
public: | ||
GraphViz(SurfaceMesh& m); | ||
|
||
void print_topology(Vertex v); | ||
void print_topology(Halfedge h); | ||
|
||
private: | ||
std::set<IndexType> edges; | ||
SurfaceMesh& mesh; | ||
void add_edge_label(Halfedge h); | ||
void print_edge(Halfedge h); | ||
void draw_halfedge(Halfedge h); | ||
}; | ||
} // namespace pmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ | |
|
||
#pragma once | ||
|
||
#include <filesystem> | ||
|
||
#include "pmp/io/IOFlags.h" | ||
#include "pmp/SurfaceMesh.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ | |
|
||
#pragma once | ||
|
||
#include <filesystem> | ||
|
||
#include "pmp/SurfaceMesh.h" | ||
|
||
namespace pmp { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ | |
|
||
#pragma once | ||
|
||
#include <filesystem> | ||
|
||
#include "pmp/SurfaceMesh.h" | ||
|
||
namespace pmp { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.