force the symmetry of the condition matrix

This commit is contained in:
Paul Leroy
2024-02-28 23:14:33 +01:00
parent 1185206fdb
commit 71b6f9cc50
2 changed files with 14 additions and 4 deletions
+2
View File
@@ -19,6 +19,8 @@ class G3PointAction : public QObject
{
Q_OBJECT
typedef Eigen::Array<bool, Eigen::Dynamic, Eigen::Dynamic> XXb;
public:
explicit G3PointAction(ccPointCloud *cloud, ccMainAppInterface *app=nullptr);
~G3PointAction();
+12 -4
View File
@@ -677,6 +677,13 @@ int G3PointAction::cluster()
Eigen::ArrayXi newLabels = Eigen::ArrayXi::Ones(m_labels.size()) * (-1);
int countNewLabels = 0;
// create the condition matrix and for ce the symmetry of the matrix
XXb condition = (Dist < 1) || (Nneigh < 1) || (A > m_maxAngle1) || (A != A);
XXb symmetrical_condition = (condition == condition.transpose()).select(condition, true);
std::cout << "\n\nsymmetrical_condition" << std::endl;
std::cout << symmetrical_condition.block(0, 0, 20, 20) << std::endl;
for (int label = 0; label < nlabels; label++)
{
@@ -696,10 +703,11 @@ int G3PointAction::cluster()
}
// shall we merge otherLabel with label?
if ((Dist(label, otherLabel) == 1)
&& (Nneigh(label, otherLabel) == 1)
&& (A(label, otherLabel) <= m_maxAngle1)
&& (!isnan(A(label, otherLabel))))
if (!symmetrical_condition(label, otherLabel))
// if ((Dist(label, otherLabel) == 1)
// && (Nneigh(label, otherLabel) == 1)
// && (A(label, otherLabel) <= m_maxAngle1)
// && (!isnan(A(label, otherLabel))))
{
std::vector<int>& labelStack = newStacks[newLabels(label)];