Skip to content
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

Merged
merged 3 commits into from
Sep 1, 2017

Conversation

frozar
Copy link
Contributor

@frozar frozar commented Aug 27, 2017

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.

@taketwo
Copy link
Member

taketwo commented Aug 27, 2017

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.

@taketwo taketwo added this to the pcl-1.9.0 milestone Aug 27, 2017
@taketwo taketwo added the needs: author reply Specify why not closed/merged yet label Aug 27, 2017
@frozar
Copy link
Contributor Author

frozar commented Aug 28, 2017

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 (tree_it.getCurrentOctreeDepth () != depth). Don't you think that there is an issue about the octree iterator?

@taketwo
Copy link
Member

taketwo commented Aug 29, 2017

From what I see, the argument for begin() function is called max_depth_arg, so this is expected that you get nodes with depth less or equal to what is passed to the function.

@taketwo
Copy link
Member

taketwo commented Aug 29, 2017

Regarding the file loading commit. I've just remembered that we have a relatively new load function that automatically deals with all supported filetypes.

@frozar
Copy link
Contributor Author

frozar commented Aug 29, 2017

I agree with you for the max_depth_arg. I think the first person who wrote octree_viewer.cpp didn't notice that. Don't you think that it would be valuable to provide an other iterator that does the work? (I prepare a merge request in this way, but I don't if this feature will be merged (I send a mail on the PCL-users mailing list, but no answer yet...)).

I update the code with the load function.

@taketwo
Copy link
Member

taketwo commented Aug 29, 2017

Don't you think that it would be valuable to provide an other iterator that does the work?

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

I send a mail on the PCL-users mailing list, but no answer yet...

This issue tracker is the right place to propose and discuss new functionality before actually crafting a pull request.

Copy link
Member

@taketwo taketwo left a 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.


/* \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();
Copy link
Member

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 ();

double s = voxelSideLen / 2.0;
for (i = 0; i < displayCloud->points.size(); i++)
for (size_t i = 0; i < displayCloud->points.size(); i++)
Copy link
Member

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 ();

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();
Copy link
Member

Choose a reason for hiding this comment

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

Space

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);
Copy link
Member

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.


treeActor->GetProperty()->SetColor(1.0, 1.0, 1.0);
treeActor->GetProperty()->SetLineWidth(2);
multiActor->GetProperty( )->SetColor(0.0, 1.0, 1.0);
Copy link
Member

Choose a reason for hiding this comment

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

No spaces inside brackets

treeActor->GetProperty()->SetLineWidth(2);
multiActor->GetProperty( )->SetColor(0.0, 1.0, 1.0);
multiActor->GetProperty( )->SetAmbient(1.0);
multiActor->GetProperty( )->SetLineWidth(2);
if(wireframe)
Copy link
Member

Choose a reason for hiding this comment

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

Space after if

@frozar
Copy link
Contributor Author

frozar commented Aug 29, 2017

Maybe you should check the coding style again: I never wrote code like that... ^^'

#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 ());
Copy link
Member

Choose a reason for hiding this comment

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

Missing space after AddInput.

#else
treeWireframe->AddInputData (GetCuboid (x - s, x + s, y - s, y + s, z - s, z + s));
appendFilter->AddInputData(wk_cubeSource->GetOutput ());
Copy link
Member

Choose a reason for hiding this comment

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

Same

mapper->SetInputData (treeWireframe->GetOutput ());
#endif
treeActor->SetMapper(mapper);
cleanFilter->SetInputConnection(appendFilter->GetOutputPort ());
Copy link
Member

Choose a reason for hiding this comment

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

Missing space after SetInputConnection

treeActor->GetProperty()->SetColor(1.0, 1.0, 1.0);
treeActor->GetProperty()->SetLineWidth(2);
if(wireframe)
multiActor->GetProperty ()->SetColor (0.0, 1.0, 1.0);
Copy link
Member

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?

Copy link
Contributor Author

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...

Copy link
Member

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.

Copy link
Contributor Author

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...

@@ -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 ;
Copy link
Member

Choose a reason for hiding this comment

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

Extra space before semicolon.

@taketwo
Copy link
Member

taketwo commented Aug 29, 2017

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.

@frozar
Copy link
Contributor Author

frozar commented Aug 30, 2017

I rewrite the history, now it should be fine 👌

@taketwo taketwo removed the needs: author reply Specify why not closed/merged yet label Aug 30, 2017
@taketwo
Copy link
Member

taketwo commented Aug 30, 2017

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.

@frozar
Copy link
Contributor Author

frozar commented Aug 30, 2017

Nice 😄

@SergioRAgostinho
Copy link
Member

Of course, other opinions are welcome @SergioRAgostinho

+1 for the iterator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants