Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-02-24 15:58:56 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-02-24 16:10:33 +0400
commit9643b2e5b50399c8224d6de8d150d88c0d3e2848 (patch)
tree85f0e9e3c26294b66777ab4833b381513b56318a /extern/carve/carve-util.cc
parent59472df8d695eaa8c7062d3006078c08fab8f3cc (diff)
Preserve non-flat faces in boolean modifier
This commit implements dissolving of edges which were used to triangulate non-flat faces. This slows things down a bit (around 5% on heave mesh with all faces triangulated). We could improve speed of dissolve a bit here (so not a bell to add an option for triangulation yet). Also fixed wrong edge origindex mapping.
Diffstat (limited to 'extern/carve/carve-util.cc')
-rw-r--r--extern/carve/carve-util.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/extern/carve/carve-util.cc b/extern/carve/carve-util.cc
index b9b7fb1c03f..b1943a6dd74 100644
--- a/extern/carve/carve-util.cc
+++ b/extern/carve/carve-util.cc
@@ -619,6 +619,7 @@ int triangulateNGon_carveTriangulator(const std::vector<Vector> &vertices,
}
carve::triangulate::triangulate(poly_2d, *triangles);
+ carve::triangulate::improve(poly_2d, *triangles);
return triangles->size();
}
@@ -737,9 +738,9 @@ int carve_triangulatePoly(struct ImportMeshData *import_data,
}
for (int i = 0; i < triangles.size(); ++i) {
- int v1 = triangles[i].c,
+ int v1 = triangles[i].a,
v2 = triangles[i].b,
- v3 = triangles[i].a;
+ v3 = triangles[i].c;
// Sanity check of the triangle.
assert(v1 != v2);
@@ -750,13 +751,15 @@ int carve_triangulatePoly(struct ImportMeshData *import_data,
assert(v3 < verts_per_poly);
face_indices->push_back(3);
- face_indices->push_back(verts_of_poly[v3]);
- face_indices->push_back(verts_of_poly[v2]);
face_indices->push_back(verts_of_poly[v1]);
+ face_indices->push_back(verts_of_poly[v2]);
+ face_indices->push_back(verts_of_poly[v3]);
#define CHECK_TRIANGLE_LOOP_INDEX(v1, v2) \
{ \
- if (v2 == v1 + 1) { \
+ int v1_ = std::min(v1, v2), \
+ v2_ = std::max(v1, v2); \
+ if (v1_ + 1 == v2_ || v1_ + verts_per_poly == v2_ + 1) { \
orig_loop_index_map->push_back(start_loop_index + v1); \
} \
else { \