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:
authorHoward Trickey <howard.trickey@gmail.com>2020-08-29 18:31:47 +0300
committerHoward Trickey <howard.trickey@gmail.com>2020-08-29 18:31:47 +0300
commitd8585e184aef90f80d1721c2c89eaf303c67e309 (patch)
treef7c7c6122bf077eaf465e3309e1b34fd02763ade /source/blender/blenlib/intern/mesh_intersect.cc
parent014276a11cd24825ca9d3ea2e21682a5557d38da (diff)
New boolean: fixed a bug in coplanar intersect.
The code that found coplanar clusters was not updating a bounding box. Also, code that was detecting non-trivial coplanar intersects was slightly wrong, but that would not have caused any functional problems.
Diffstat (limited to 'source/blender/blenlib/intern/mesh_intersect.cc')
-rw-r--r--source/blender/blenlib/intern/mesh_intersect.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc
index 80b37ea6f44..8c412617b13 100644
--- a/source/blender/blenlib/intern/mesh_intersect.cc
+++ b/source/blender/blenlib/intern/mesh_intersect.cc
@@ -927,7 +927,7 @@ class CoplanarCluster {
void add_tri(int t, const BoundingBox &bb)
{
tris_.append(t);
- bb_ = bb;
+ bb_.combine(bb);
}
int tot_tri() const
{
@@ -1129,6 +1129,8 @@ static bool non_trivially_2d_point_in_tri(const int orients[3][3], int pi)
* overlap in a "hex" pattern? That is, the overlap region is a hexagon, which
* one gets by having, each point of one triangle being strictly right-of one
* edge of the other and strictly left of the other two edges; and vice versa.
+ * In addition, it must not be the case that all of the points of one triangle
+ * are totally to one side of one edge of the other triangle, and vice versa.
*/
static bool non_trivially_2d_hex_overlap(int orients[2][3][3])
{
@@ -1139,6 +1141,10 @@ static bool non_trivially_2d_hex_overlap(int orients[2][3][3])
if (!ok) {
return false;
}
+ int s = orients[ab][0][i] + orients[ab][1][i] + orients[ab][2][i];
+ if (s == 3 || s == -3) {
+ return false;
+ }
}
}
return true;
@@ -2845,6 +2851,9 @@ static CoplanarClusterInfo find_clusters(const IMesh &tm, const Array<BoundingBo
Vector<CoplanarCluster *> int_cls;
Vector<CoplanarCluster *> no_int_cls;
for (CoplanarCluster &cl : curcls) {
+ if (dbg_level > 1) {
+ std::cout << "consider intersecting with cluster " << cl << "\n";
+ }
if (bbs_might_intersect(tri_bb[t], cl.bounding_box()) &&
non_trivially_coplanar_intersects(tm, t, cl, proj_axis)) {
if (dbg_level > 1) {
@@ -3026,6 +3035,7 @@ IMesh trimesh_nary_intersect(const IMesh &tm_in,
for (int t : tm_in.face_index_range()) {
std::cout << "shape(" << t << ") = " << shape_fn(tm_in.face(t)->orig) << "\n";
}
+ write_obj_mesh(const_cast<IMesh &>(tm_in), "trimesh_input");
}
}
# ifdef PERFDEBUG