-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OCTREE] Fix pcl_octree_viewer #1973
[OCTREE] Fix pcl_octree_viewer #1973
Conversation
Hi, thanks for contributing. If I understand correctly, you propose three different changes here. It is okay to keep them in a single pull request, but would be better to split into three commits with appropriate messages. Further, I'd ask you to follow the PCL style guide. (In particular, spacing in function calls and positioning of curly brackets.) Please update this pull request. |
I split my contribution in 3 commits as you advise. I try to follow the PCL coding style but if there still is some coding style issue, please put some comment on the concern lines and I'll fix them. I must say the code I have written to fix the spurious points display is pretty odd: if the iterator over an octree was correct, I should not have to check the depth of the iterator ( |
From what I see, the argument for |
Regarding the file loading commit. I've just remembered that we have a relatively new |
I agree with you for the I update the code with the |
Honestly, I don't have a strong opinion here. The octree module has been around for many years now and nobody submitted either a feature request or an implementation of such an iterator. So it seems fine without. That said, if you find multiple places in existing code in PCL that can be rewritten in a more clear and concise way by using the proposed iterator, I would take it as a strong evidence that the iterator is valuable and will be happy to merge it. Of course, other opinions are welcome @SergioRAgostinho @jspricke
This issue tracker is the right place to propose and discuss new functionality before actually crafting a pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a bunch of inline comments where style has to be fixed.
tools/octree_viewer.cpp
Outdated
|
||
/* \brief display octree cubes via vtk-functions | ||
* | ||
*/ | ||
void showCubes(double voxelSideLen) | ||
{ | ||
//get the renderer of the visualizer object | ||
vtkRenderer *renderer = viz.getRenderWindow()->GetRenderers()->GetFirstRenderer(); | ||
vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need space before brackets, i.e. New ();
tools/octree_viewer.cpp
Outdated
double s = voxelSideLen / 2.0; | ||
for (i = 0; i < displayCloud->points.size(); i++) | ||
for (size_t i = 0; i < displayCloud->points.size(); i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need space before brackets, i.e. points.size ();
tools/octree_viewer.cpp
Outdated
double x = displayCloud->points[i].x; | ||
double y = displayCloud->points[i].y; | ||
double z = displayCloud->points[i].z; | ||
|
||
vtkSmartPointer<vtkCubeSource> wk_cubeSource = vtkSmartPointer<vtkCubeSource>::New(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space
tools/octree_viewer.cpp
Outdated
double x = displayCloud->points[i].x; | ||
double y = displayCloud->points[i].y; | ||
double z = displayCloud->points[i].z; | ||
|
||
vtkSmartPointer<vtkCubeSource> wk_cubeSource = vtkSmartPointer<vtkCubeSource>::New(); | ||
|
||
wk_cubeSource->SetBounds(x - s, x + s, y - s, y + s, z - s, z + s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space here and in all line.s below.
tools/octree_viewer.cpp
Outdated
|
||
treeActor->GetProperty()->SetColor(1.0, 1.0, 1.0); | ||
treeActor->GetProperty()->SetLineWidth(2); | ||
multiActor->GetProperty( )->SetColor(0.0, 1.0, 1.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No spaces inside brackets
tools/octree_viewer.cpp
Outdated
treeActor->GetProperty()->SetLineWidth(2); | ||
multiActor->GetProperty( )->SetColor(0.0, 1.0, 1.0); | ||
multiActor->GetProperty( )->SetAmbient(1.0); | ||
multiActor->GetProperty( )->SetLineWidth(2); | ||
if(wireframe) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after if
Maybe you should check the coding style again: I never wrote code like that... ^^' |
tools/octree_viewer.cpp
Outdated
#if VTK_MAJOR_VERSION < 6 | ||
treeWireframe->AddInput(GetCuboid(x - s, x + s, y - s, y + s, z - s, z + s)); | ||
appendFilter->AddInput(wk_cubeSource->GetOutput ()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after AddInput
.
tools/octree_viewer.cpp
Outdated
#else | ||
treeWireframe->AddInputData (GetCuboid (x - s, x + s, y - s, y + s, z - s, z + s)); | ||
appendFilter->AddInputData(wk_cubeSource->GetOutput ()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
tools/octree_viewer.cpp
Outdated
mapper->SetInputData (treeWireframe->GetOutput ()); | ||
#endif | ||
treeActor->SetMapper(mapper); | ||
cleanFilter->SetInputConnection(appendFilter->GetOutputPort ()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after SetInputConnection
tools/octree_viewer.cpp
Outdated
treeActor->GetProperty()->SetColor(1.0, 1.0, 1.0); | ||
treeActor->GetProperty()->SetLineWidth(2); | ||
if(wireframe) | ||
multiActor->GetProperty ()->SetColor (0.0, 1.0, 1.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason to change the color from white to cyan?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at all. In fact, I was just trying to find the color used to produce the image there, but unsuccessfully...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then let's leave it white as it was before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't see this message...
tools/octree_viewer.cpp
Outdated
@@ -339,6 +345,9 @@ class OctreeViewer | |||
|
|||
for (tree_it = octree.begin(depth); tree_it!=tree_it_end; ++tree_it) | |||
{ | |||
if (tree_it.getCurrentOctreeDepth () != depth) | |||
continue ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space before semicolon.
So besides from color everything looks good now. Once that is fixed, please regroup all related changes so that we have 3 topic commits, as planned, and then we are good to go. |
…n octree node before to print it.
I rewrite the history, now it should be fine 👌 |
Thanks for the effort. From my side everything is fine, but we'll need to wait a bit until one other maintainer takes a look and pushes the merge button. |
Nice 😄 |
+1 for the iterator |
Fixes issue #1840
To avoid the display of spurious point, check the detph of an octree node before to print it.
Be able to read PLY file.
Fix the display of the octree cube.