Remove comments.

master
Jeremy Hu 2019-02-27 23:08:39 +09:30
parent cbaccb0116
commit ae32a4693b
4 changed files with 27 additions and 27 deletions

View File

@ -348,7 +348,7 @@ void Builder::insertCutVertices(const std::vector<QVector3D> &cut, std::vector<s
bool Builder::generateCutsForNode(size_t nodeIndex)
{
if (m_swallowedNodes.find(nodeIndex) != m_swallowedNodes.end()) {
qDebug() << "node" << nodeIndex << "ignore cuts generating because of been swallowed";
//qDebug() << "node" << nodeIndex << "ignore cuts generating because of been swallowed";
return true;
}
@ -380,9 +380,9 @@ bool Builder::generateCutsForNode(size_t nodeIndex)
size_t tries = 0;
do {
offsetChanged = false;
qDebug() << "Try wrap #" << tries;
//qDebug() << "Try wrap #" << tries;
if (tryWrapMultipleBranchesForNode(nodeIndex, offsets, offsetChanged)) {
qDebug() << "Wrap succeed";
//qDebug() << "Wrap succeed";
return true;
}
++tries;
@ -422,7 +422,7 @@ bool Builder::tryWrapMultipleBranchesForNode(size_t nodeIndex, std::vector<float
float finalDistance = node.radius + offsetDistance;
if (finalDistance >= distance) {
if (swallowEdgeForNode(nodeIndex, i)) {
qDebug() << "Neighbor too near to wrap, swallow it";
//qDebug() << "Neighbor too near to wrap, swallow it";
offsets[i] = 0;
offsetsChanged = true;
directSwallowed = true;
@ -456,13 +456,13 @@ bool Builder::tryWrapMultipleBranchesForNode(size_t nodeIndex, std::vector<float
if (stitchSucceed) {
stitchSucceed = nodemesh::isManifold(testFaces);
if (!stitchSucceed) {
qDebug() << "Mesh stitch but not manifold";
//qDebug() << "Mesh stitch but not manifold";
}
}
if (stitchSucceed) {
nodemesh::Combiner::Mesh mesh(m_generatedVertices, testFaces, false);
if (mesh.isNull()) {
qDebug() << "Mesh stitched but not not pass test";
//qDebug() << "Mesh stitched but not not pass test";
//nodemesh::exportMeshAsObj(m_generatedVertices, testFaces, "/Users/jeremy/Desktop/test.obj");
stitchSucceed = false;
for (size_t i = 0; i < node.edges.size(); ++i) {
@ -484,7 +484,7 @@ bool Builder::tryWrapMultipleBranchesForNode(size_t nodeIndex, std::vector<float
for (const auto &edgeLoop: failedEdgeLoops) {
if (offsets[edgeLoop] + WRAP_STEP_BACK_FACTOR >= 1.0) {
if (swallowEdgeForNode(nodeIndex, edgeLoop)) {
qDebug() << "No offset to step back, swallow neighbor instead";
//qDebug() << "No offset to step back, swallow neighbor instead";
offsets[edgeLoop] = 0;
offsetsChanged = true;
break;
@ -509,7 +509,7 @@ bool Builder::tryWrapMultipleBranchesForNode(size_t nodeIndex, std::vector<float
for (const auto &u: first.first) {
for (const auto &v: second.first) {
if ((m_generatedVertices[u] - m_generatedVertices[v]).lengthSquared() < allowedMinDist2) {
qDebug() << "Weld" << v << "to" << u;
//qDebug() << "Weld" << v << "to" << u;
m_weldMap.insert({v, u});
}
}
@ -532,18 +532,18 @@ bool Builder::swallowEdgeForNode(size_t nodeIndex, size_t edgeOrder)
auto &node = m_nodes[nodeIndex];
size_t edgeIndex = node.edges[edgeOrder];
if (m_swallowedEdges.find(edgeIndex) != m_swallowedEdges.end()) {
qDebug() << "No more edge to swallow";
//qDebug() << "No more edge to swallow";
return false;
}
size_t neighborIndex = m_edges[edgeIndex].neiborOf(nodeIndex);
const auto &neighbor = m_nodes[neighborIndex];
if (neighbor.edges.size() != 2) {
qDebug() << "Neighbor is not a simple two edges node to swallow, edges:" << neighbor.edges.size() << "neighbor:" << neighborIndex << "node" << nodeIndex;
//qDebug() << "Neighbor is not a simple two edges node to swallow, edges:" << neighbor.edges.size() << "neighbor:" << neighborIndex << "node" << nodeIndex;
return false;
}
size_t anotherEdgeIndex = neighbor.anotherEdge(edgeIndex);
if (m_swallowedEdges.find(anotherEdgeIndex) != m_swallowedEdges.end()) {
qDebug() << "Desired edge already been swallowed";
//qDebug() << "Desired edge already been swallowed";
return false;
}
node.edges[edgeOrder] = anotherEdgeIndex;
@ -556,7 +556,7 @@ bool Builder::swallowEdgeForNode(size_t nodeIndex, size_t edgeOrder)
// qDebug() << it;
m_swallowedEdges.insert(edgeIndex);
m_swallowedNodes.insert(neighborIndex);
qDebug() << "Swallow edge" << edgeIndex << "for node" << nodeIndex << "neighbor" << neighborIndex << "got eliminated, choosen edge" << anotherEdgeIndex;
//qDebug() << "Swallow edge" << edgeIndex << "for node" << nodeIndex << "neighbor" << neighborIndex << "got eliminated, choosen edge" << anotherEdgeIndex;
return true;
}
@ -684,7 +684,7 @@ void Builder::applyWeld()
newIndices.push_back(newIndex);
}
if (newIndices.size() < 3) {
qDebug() << "Face been welded";
//qDebug() << "Face been welded";
continue;
}
newFaces.push_back(newIndices);

View File

@ -21,7 +21,7 @@ Combiner::Mesh::Mesh(const std::vector<QVector3D> &vertices, const std::vector<s
triangulate(vertices, faces, triangles);
cgalMesh = buildCgalMesh<ExactKernel>(vertices, triangles);
if (!CGAL::is_valid_polygon_mesh(*cgalMesh)) {
qDebug() << "Mesh is not valid polygon";
//qDebug() << "Mesh is not valid polygon";
delete cgalMesh;
cgalMesh = nullptr;
} else if (CGAL::Polygon_mesh_processing::does_self_intersect(*cgalMesh)) {
@ -29,16 +29,16 @@ Combiner::Mesh::Mesh(const std::vector<QVector3D> &vertices, const std::vector<s
m_isSelfIntersected = true;
if (removeSelfIntersects) {
if (!CGAL::Polygon_mesh_processing::remove_self_intersections(*cgalMesh)) {
qDebug() << "Mesh does self intersect and cann't remove intersections";
//qDebug() << "Mesh does self intersect and cann't remove intersections";
delete cgalMesh;
cgalMesh = nullptr;
} else {
qDebug() << "Mesh does self intersect but intersections got removed";
//qDebug() << "Mesh does self intersect but intersections got removed";
}
} else {
delete cgalMesh;
cgalMesh = nullptr;
qDebug() << "Mesh does self intersect";
//qDebug() << "Mesh does self intersect";
}
}
}

View File

@ -31,7 +31,7 @@ bool Recombiner::convertHalfEdgesToEdgeLoops(const std::vector<std::pair<size_t,
for (const auto &halfEdge: halfEdges) {
auto inserResult = vertexLinkMap.insert(halfEdge);
if (!inserResult.second) {
qDebug() << "Create edge loop from half edge failed, found repeated vertex link" << halfEdge.first << "->" << halfEdge.second << "exist:" << inserResult.first->first << "->" << inserResult.first->second;
//qDebug() << "Create edge loop from half edge failed, found repeated vertex link" << halfEdge.first << "->" << halfEdge.second << "exist:" << inserResult.first->first << "->" << inserResult.first->second;
return false;
}
}
@ -53,11 +53,11 @@ bool Recombiner::convertHalfEdgesToEdgeLoops(const std::vector<std::pair<size_t,
}
}
if (!loopBack) {
qDebug() << "Create edge loop from half edge failed, edge doesn't loop back";
//qDebug() << "Create edge loop from half edge failed, edge doesn't loop back";
return false;
}
if (edgeLoop.size() < 3) {
qDebug() << "Create edge loop from half edge failed, edge loop size invalid:" << edgeLoop.size();
//qDebug() << "Create edge loop from half edge failed, edge loop size invalid:" << edgeLoop.size();
return false;
}
for (const auto &vertex: edgeLoop) {
@ -107,7 +107,7 @@ bool Recombiner::buildHalfEdgeToFaceMap(std::map<std::pair<size_t, size_t>, size
size_t j = (i + 1) % face.size();
const auto insertResult = halfEdgeToFaceMap.insert({{face[i], face[j]}, faceIndex});
if (!insertResult.second) {
qDebug() << "Non manifold edge found:" << face[i] << face[j];
//qDebug() << "Non manifold edge found:" << face[i] << face[j];
succeed = false;
}
}
@ -135,7 +135,7 @@ bool Recombiner::recombine()
}
std::map<size_t, size_t> seamVertexToIslandMap;
size_t islands = splitSeamVerticesToIslands(seamLink, &seamVertexToIslandMap);
qDebug() << "Seam islands:" << islands;
//qDebug() << "Seam islands:" << islands;
std::map<std::pair<size_t, size_t>, std::pair<size_t, bool>> edgesInSeamArea;
for (size_t faceIndex = 0; faceIndex < (*m_faces).size(); ++faceIndex) {
@ -182,7 +182,7 @@ bool Recombiner::recombine()
for (auto &it: islandsMap) {
for (size_t side = 0; side < 2; ++side) {
if (!convertHalfEdgesToEdgeLoops(it.second.halfedges[side], &it.second.edgeLoops[side])) {
qDebug() << "Convert half edges to edge loops for island" << it.first << "side" << side << "failed";
//qDebug() << "Convert half edges to edge loops for island" << it.first << "side" << side << "failed";
it.second.edgeLoops[side].clear();
}
}
@ -197,7 +197,7 @@ bool Recombiner::recombine()
while ((adjustedTriangles=adjustTrianglesFromSeam(edgeLoop, it.first)) > 0) {
totalAdjustedTriangles += adjustedTriangles;
}
qDebug() << "Island" << it.first << "side" << side << "edge loop" << i << "adjusted" << totalAdjustedTriangles << "triangles";
//qDebug() << "Island" << it.first << "side" << side << "edge loop" << i << "adjusted" << totalAdjustedTriangles << "triangles";
}
}
}
@ -217,7 +217,7 @@ bool Recombiner::recombine()
copyNonSeamFacesAsRegenerated();
removeReluctantVertices();
qDebug() << "Optimized" << m_goodSeams.size() << "seams";
//qDebug() << "Optimized" << m_goodSeams.size() << "seams";
return true;
}
@ -343,7 +343,7 @@ bool Recombiner::bridge(const std::vector<size_t> &first, const std::vector<size
}
}
qDebug() << "small:" << small->size() << "large:" << large->size() << "matches:" << matchedPairs.size();
//qDebug() << "small:" << small->size() << "large:" << large->size() << "matches:" << matchedPairs.size();
if (matchedPairs.empty())
return false;

View File

@ -75,7 +75,7 @@ bool Stitcher::stitch(const std::vector<std::pair<std::vector<size_t>, QVector3D
m_wrapper->setVertices(m_positions);
m_wrapper->wrap(edgeLoops);
if (!m_wrapper->finished()) {
qDebug() << "Wrapping failed";
//qDebug() << "Wrapping failed";
return false;
}
return true;