Skip to content

Add slightly modified LineIterator for maxheight calculation - #1

Open
ipa-fer wants to merge 9 commits into
feature/allow-map-growthfrom
fix/vis-cleanup-custom-iterator
Open

ipa-fer wants to merge 9 commits into
feature/allow-map-growthfrom
fix/vis-cleanup-custom-iterator

Conversation

@ipa-fer

@ipa-fer ipa-fer commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Add slightly modified LineIterator for maxheight calculation in vis cleanup

@ipa-fer
ipa-fer requested a review from ipa-dmo March 20, 2026 13:43
@@ -0,0 +1,135 @@
/*
* LineIterator.hpp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TraverslGridLineIterator and author etc

* Iterator class to iterate over a line in the map.
* Based on Bresenham Line Drawing algorithm.
*/
class TraversalGridLineIterator

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not deriving the class from the LineIterator Class? i guess most of the member functions are the same?

#include "grid_map_core/iterators/EllipseIterator.hpp"
#include "grid_map_core/iterators/SpiralIterator.hpp"
#include "grid_map_core/iterators/LineIterator.hpp"
#include "grid_map_core/iterators/TraversalGridLineIterator.hpp"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a different name? pretty unclear what this iterator is by that name...

Comment on lines +108 to +110
const double eps = 1e-9;
Vector direction = (end - start).normalized();
Position newStart = start + eps * direction;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why adding this eps?


/*!
* Iterator class to iterate over a line in the map.
* Based on Bresenham Line Drawing algorithm.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still based on the Bresenham Line algo? Probably not.

return index_;
}

TraversalGridLineIterator & TraversalGridLineIterator::operator++()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this differ from the normal iterator? We check here based on the world coordinates and not on the indexes, but how does this effect the line? Do we now skip small intersections of cells due to this sampling based approach?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may show/test here the difference between normal line and this line iterator. Not to clear to me where the difference lies.

@ipa-fer

ipa-fer commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Also, need to update the inputs of the iterator such that it matches the format of other iterators, i.e. it must use the index instead of the position.

@ipa-fer
ipa-fer force-pushed the fix/vis-cleanup-custom-iterator branch from 6c4545f to 900fe1e Compare October 29, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants