Page MenuHome
Paste P1087

Quadriflow test
ActivePublic

Authored by Sebastian Parborg (zeddb) on Aug 28 2019, 1:03 AM.
diff --git a/extern/quadriflow/blender_config.cmake b/extern/quadriflow/blender_config.cmake
index b0e4c947952..4bda2ae6cea 100644
--- a/extern/quadriflow/blender_config.cmake
+++ b/extern/quadriflow/blender_config.cmake
@@ -3,12 +3,12 @@
set(QUADRIFLOW_STANDALONE FALSE)
set(BUILD_PERFORMANCE_TEST FALSE)
-set(BUILD_LOG FALSE)
set(BUILD_GUROBI FALSE)
set(BUILD_OPENMP ${WITH_OPENMP})
set(BUILD_TBB FALSE)
set(BUILD_FREE_LICENSE FALSE) #If TRUE, remove LGPL code
set(BUILD_STATIC_LIB TRUE)
+set(BUILD_LOG TRUE)
set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
set(EIGEN_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIRS})
diff --git a/extern/quadriflow/src/optimizer.cpp b/extern/quadriflow/src/optimizer.cpp
index 24d6f7f9b73..9a6f43fdf69 100644
--- a/extern/quadriflow/src/optimizer.cpp
+++ b/extern/quadriflow/src/optimizer.cpp
@@ -913,8 +913,8 @@ void Optimizer::optimize_positions_sharp(
loops.push_back(new_o);
}
}
- return;
- std::ofstream os("/Users/jingwei/Desktop/sharp.obj");
+ //return;
+ std::ofstream os("/tmp/sharp.obj");
for (int i = 0; i < loops.size(); ++i) {
for (auto& v : loops[i]) {
os << "v " << v[0] << " " << v[1] << " " << v[2] << "\n";
@@ -928,7 +928,20 @@ void Optimizer::optimize_positions_sharp(
offset += loops[i].size();
}
os.close();
- exit(0);
+ os.open("/tmp/mesh.obj");
+ for (int i = 0; i < O.cols(); ++i) {
+ auto t = O.col(i);
+ os << "v " << t[0] << " " << t[1] << " " << t[2] << "\n";
+ }
+ for (int i = 0; i < F.cols(); ++i) {
+ int v1 = F(0, i);
+ int v2 = F(1, i);
+ int v3 = F(2, i);
+ os << "f " << v1+1 << " " << v2+1
+ << " " << v3+1 << "\n";
+ }
+ os.close();
+ //exit(0);
}
void Optimizer::optimize_positions_fixed(
diff --git a/extern/quadriflow/src/parametrizer-int.cpp b/extern/quadriflow/src/parametrizer-int.cpp
index 467dc637cc5..931a49ad716 100644
--- a/extern/quadriflow/src/parametrizer-int.cpp
+++ b/extern/quadriflow/src/parametrizer-int.cpp
@@ -415,7 +415,7 @@ void Parametrizer::BuildIntegerConstraints() {
if (ii == 0)
max_num = std::min(abs(total_flows[j]) / 2, (int)modified_variables[ii][j].size());
else
- max_num = abs(total_flows[j]);
+ max_num = std::min(abs(total_flows[j]), (int)modified_variables[ii][j].size());
int dir = (total_flows[j] > 0) ? -1 : 1;
for (int i = 0; i < max_num; ++i) {
auto& info = modified_variables[ii][j][i];
diff --git a/extern/quadriflow/src/parametrizer-mesh.cpp b/extern/quadriflow/src/parametrizer-mesh.cpp
index fcae18c6845..a0d9b9adab6 100644
--- a/extern/quadriflow/src/parametrizer-mesh.cpp
+++ b/extern/quadriflow/src/parametrizer-mesh.cpp
@@ -139,7 +139,7 @@ void Parametrizer::ComputeSharpEdges() {
int re = E2E[e];
Vector3d& n1 = face_normals[e/3];
Vector3d& n2 = face_normals[re/3];
- if (n1.dot(n2) < cos_thres) {
+ if (re == -1) {
sharp_edges[i] = 1;
}
}
diff --git a/extern/quadriflow/src/parametrizer.cpp b/extern/quadriflow/src/parametrizer.cpp
index b85383566c9..5e8a11d7a93 100644
--- a/extern/quadriflow/src/parametrizer.cpp
+++ b/extern/quadriflow/src/parametrizer.cpp
@@ -63,9 +63,7 @@ void Parametrizer::ComputeIndexMap(int with_scale) {
if (sharpvert.count(edge_values[e].x) && sharpvert.count(edge_values[e].y)) {
if (sharp_edges[i] != 0) {
for (int k = 0; k < 2; ++k) {
- if (edge_diff[e][k] == 0) {
allow_changes[e * 2 + k] = 0;
- }
}
}
}
@@ -90,7 +88,7 @@ void Parametrizer::ComputeIndexMap(int with_scale) {
if (sharp_edges[i] == 0) continue;
int e = face_edgeIds[i / 3][i % 3];
for (int k = 0; k < 2; ++k) {
- if (edge_diff[e][k] == 0) allow_changes[e * 2 + k] = 0;
+ allow_changes[e * 2 + k] = 0;
}
}
diff --git a/source/blender/editors/object/object_remesh.c b/source/blender/editors/object/object_remesh.c
index 237605b5365..77d3045a12a 100644
--- a/source/blender/editors/object/object_remesh.c
+++ b/source/blender/editors/object/object_remesh.c
@@ -157,6 +157,8 @@ void OBJECT_OT_voxel_remesh(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+#define WITH_SHARP
+
static int quadriflow_remesh_exec(bContext *C, wmOperator *op)
{
const bool is_frozen = RNA_boolean_get(op->ptr, "use_freeze");

Event Timeline