Revision: 73962
http://sourceforge.net/p/brlcad/code/73962
Author: starseeker
Date: 2019-09-18 22:25:56 +0000 (Wed, 18 Sep 2019)
Log Message:
-----------
Start working on the high level logic flow to actually perform comparisons
between two brep meshes.
Modified Paths:
--------------
brlcad/trunk/include/brep/cdt.h
brlcad/trunk/src/libbrep/RTree.h
brlcad/trunk/src/libbrep/cdt.cpp
Modified: brlcad/trunk/include/brep/cdt.h
===================================================================
--- brlcad/trunk/include/brep/cdt.h 2019-09-18 20:41:47 UTC (rev 73961)
+++ brlcad/trunk/include/brep/cdt.h 2019-09-18 22:25:56 UTC (rev 73962)
@@ -94,7 +94,6 @@
int mode,
struct ON_Brep_CDT_State *s);
-#if 0
/* Given two or more triangulation states, refine them to clear any face
* overlaps introduced by the triangulation. If any of the states are
* un-tessellated, first perform the tessellation indicated by the state
@@ -108,6 +107,7 @@
extern BREP_EXPORT int
ON_Brep_CDT_Ovlp_Resolve(struct ON_Brep_CDT_State **s_a, int s_cnt);
+#if 0
/* Report the number of other tessellation states which manifest unresolvable
* overlaps with state s. If the ovlps argument is non-null, populate with
* the problematic states. If no resolve step was performed on s, return -1 */
Modified: brlcad/trunk/src/libbrep/RTree.h
===================================================================
--- brlcad/trunk/src/libbrep/RTree.h 2019-09-18 20:41:47 UTC (rev 73961)
+++ brlcad/trunk/src/libbrep/RTree.h 2019-09-18 22:25:56 UTC (rev 73962)
@@ -1653,17 +1653,17 @@
size_t RTREE_QUAL::CheckNodes(Node *a_nodeA, Node *a_nodeB, std::set<DataType>
*a_result, std::set<DataType> *b_result)
{
size_t ocnt = 0;
- for (int index = 0; index < a_nodeA.m_count; ++index) {
- for (int index2 = 0; index2 < a_nodeB.m_count; ++index2) {
+ for (int index = 0; index < a_nodeA->m_count; ++index) {
+ for (int index2 = 0; index2 < a_nodeB->m_count; ++index2) {
if (Overlap(&(a_nodeA->m_branch[index].m_rect),
&(a_nodeB->m_branch[index2].m_rect))) {
if (a_nodeA->m_level > 0) {
if ( a_nodeB->m_level > 0 ) {
ocnt += CheckNodes(a_nodeA->m_branch[index].m_child,
a_nodeB->m_branch[index2].m_child, a_result, b_result);
} else {
- ocnt += CheckNodes(a_nodeA->m_branch[index].m_child,
a_nodeB->m_branch[index2], a_result, b_result);
+ ocnt += CheckNodes(a_nodeA->m_branch[index].m_child,
a_nodeB, a_result, b_result);
}
} else if ( a_nodeB->m_level > 0 ) {
- ocnt += CheckNodes(a_nodeA->m_branch[index],
a_nodeB->m_branch[index2].m_child, a_result, b_result);
+ ocnt += CheckNodes(a_nodeA,
a_nodeB->m_branch[index2].m_child, a_result, b_result);
} else {
a_result->insert(a_nodeA->m_branch[index].m_data);
b_result->insert(a_nodeB->m_branch[index2].m_data);
Modified: brlcad/trunk/src/libbrep/cdt.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt.cpp 2019-09-18 20:41:47 UTC (rev 73961)
+++ brlcad/trunk/src/libbrep/cdt.cpp 2019-09-18 22:25:56 UTC (rev 73962)
@@ -644,7 +644,49 @@
}
+int
+ON_Brep_CDT_Ovlp_Resolve(struct ON_Brep_CDT_State **s_a, int s_cnt)
+{
+ if (!s_a) return -1;
+ if (s_cnt < 2) return 0;
+ std::vector<std::set<size_t> *> ovlp_tris;
+ for (int i = 0; i < s_cnt; i++) {
+ ovlp_tris.push_back(new std::set<size_t>);
+ }
+ for (int i = 0; i < s_cnt; i++) {
+ struct ON_Brep_CDT_State *s_i = s_a[i];
+ for (int i_fi = 0; i_fi < s_i->brep->m_F.Count(); i_fi++) {
+ const ON_BrepFace *i_face = s_i->brep->Face(i_fi);
+ ON_BoundingBox i_fbb = i_face->BoundingBox();
+ cdt_mesh::cdt_mesh_t &i_fmesh = s_i->fmeshes[i_fi];
+ for (int j = i+1; j < s_cnt; j++) {
+ struct ON_Brep_CDT_State *s_j = s_a[j];
+ for (int j_fi = 0; j_fi < s_j->brep->m_F.Count(); j_fi++) {
+ const ON_BrepFace *j_face = s_j->brep->Face(j_fi);
+ ON_BoundingBox j_fbb = j_face->BoundingBox();
+ if (!i_fbb.IsDisjoint(j_fbb)) {
+ cdt_mesh::cdt_mesh_t &j_fmesh = s_j->fmeshes[j_fi];
+ std::cout << "Checking " << i << " face " << i_fi << "
against " << j << " face " << j_fi << "\n";
+ size_t ovlp_cnt =
i_fmesh.tris_tree.Overlaps(j_fmesh.tris_tree, ovlp_tris[i], ovlp_tris[j]);
+ if (ovlp_cnt) {
+ std::cout << " found " << ovlp_cnt << "
overlaps\n";
+ } else {
+ std::cout << "RTREE_ISECT_EMPTY: " << i << " face "
<< i_fi << " and " << j << " face " << j_fi << "\n";
+ }
+ } else {
+ std::cout << "DISJOINT: " << i << " face " << i_fi << "
and " << j << " face " << j_fi << "\n";
+ }
+ }
+ }
+ }
+ }
+ for (int i = 0; i < s_cnt; i++) {
+ delete ovlp_tris[i];
+ }
+ return 0;
+}
+
// Generate a BoT with normals.
int
ON_Brep_CDT_Mesh(
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits