@@ -723,17 +723,26 @@ void ContinuousClustering::associatePointsInColumn(AssociationJob&& job)
723
723
{
724
724
if (point.tree_root_ .column_index == -1 )
725
725
{
726
- // this point is not associated to any tree -> associate it
727
- point.tree_root_ = point_other.tree_root_ ;
728
- point_other.child_points .push_back (index);
729
-
730
- // new point was associated to tree -> check if finish time will be delayed
726
+ // this point is not associated to any tree -> associate it if the resulting cluster will be
727
+ // not wider than one full rotation
731
728
Point& point_root = range_image_[point_other.tree_root_ .column_index * num_rows_ +
732
729
point_other.tree_root_ .row_index ];
733
- point_root.finished_at_continuous_azimuth_angle =
734
- std::max (point_root.finished_at_continuous_azimuth_angle ,
735
- point.continuous_azimuth_angle + max_angle_diff);
736
- point_root.tree_num_points ++;
730
+ uint32_t new_cluster_width = point.global_column_index - point_root.global_column_index ;
731
+ if (new_cluster_width < num_columns_)
732
+ {
733
+ point.tree_root_ = point_other.tree_root_ ;
734
+ point.tree_id = point_root.global_column_index * num_rows_ + point_root.row_index ;
735
+ point_other.child_points .push_back (index);
736
+
737
+ // keep track of cluster width
738
+ point_root.cluster_width = new_cluster_width;
739
+
740
+ // new point was associated to tree -> check if finish time will be delayed
741
+ point_root.finished_at_continuous_azimuth_angle =
742
+ std::max (point_root.finished_at_continuous_azimuth_angle ,
743
+ point.continuous_azimuth_angle + max_angle_diff);
744
+ point_root.tree_num_points ++;
745
+ }
737
746
}
738
747
else
739
748
{
@@ -787,9 +796,11 @@ void ContinuousClustering::associatePointsInColumn(AssociationJob&& job)
787
796
{
788
797
// this point could not be associated to any tree -> init new tree
789
798
point.tree_root_ = index;
799
+ point.tree_id = point.global_column_index * num_rows_ + point.row_index ;
790
800
791
801
// calculate finish time (will be increased when new points are associated to tree)
792
802
point.finished_at_continuous_azimuth_angle = point.continuous_azimuth_angle + max_angle_diff;
803
+ point.cluster_width = 1 ;
793
804
794
805
// new tree has 1 point
795
806
point.tree_num_points = 1 ;
@@ -1065,6 +1076,8 @@ void ContinuousClustering::clearColumns(int64_t from_global_column_index, int64_
1065
1076
point.tree_root_ .row_index = 0 ;
1066
1077
point.tree_root_ .column_index = -1 ;
1067
1078
point.tree_num_points = 0 ;
1079
+ point.cluster_width = 0 ;
1080
+ point.tree_id = 0 ;
1068
1081
point.id = 0 ;
1069
1082
point.visited_at_continuous_azimuth_angle = -1 .;
1070
1083
point.belongs_to_finished_cluster = false ;
0 commit comments