Skip to content

Commit

Permalink
[OCTREE] Coding style review.
Browse files Browse the repository at this point in the history
  • Loading branch information
frozar committed Aug 29, 2017
1 parent ae00995 commit d01dbd3
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions tools/octree_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,62 +271,62 @@ class OctreeViewer
*/
void showCubes(double voxelSideLen)
{
vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New();
vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New ();

// Create every cubes to be displayed
double s = voxelSideLen / 2.0;
for (size_t i = 0; i < displayCloud->points.size(); i++)
for (size_t i = 0; i < displayCloud->points.size (); i++)
{
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();
vtkSmartPointer<vtkCubeSource> wk_cubeSource = vtkSmartPointer<vtkCubeSource>::New ();

wk_cubeSource->SetBounds(x - s, x + s, y - s, y + s, z - s, z + s);
wk_cubeSource->Update();
wk_cubeSource->SetBounds (x - s, x + s, y - s, y + s, z - s, z + s);
wk_cubeSource->Update ();

#if VTK_MAJOR_VERSION < 6
appendFilter->AddInput(wk_cubeSource->GetOutput());
appendFilter->AddInput(wk_cubeSource->GetOutput ());
#else
appendFilter->AddInputData(wk_cubeSource->GetOutput());
appendFilter->AddInputData(wk_cubeSource->GetOutput ());
#endif
}

// Remove any duplicate points
vtkSmartPointer<vtkCleanPolyData> cleanFilter = vtkSmartPointer<vtkCleanPolyData>::New();
vtkSmartPointer<vtkCleanPolyData> cleanFilter = vtkSmartPointer<vtkCleanPolyData>::New ();

cleanFilter->SetInputConnection(appendFilter->GetOutputPort());
cleanFilter->Update();
cleanFilter->SetInputConnection(appendFilter->GetOutputPort ());
cleanFilter->Update ();

//Create a mapper and actor
vtkSmartPointer<vtkPolyDataMapper> multiMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkPolyDataMapper> multiMapper = vtkSmartPointer<vtkPolyDataMapper>::New ();

multiMapper->SetInputConnection(cleanFilter->GetOutputPort());
multiMapper->SetInputConnection (cleanFilter->GetOutputPort ());

vtkSmartPointer<vtkActor> multiActor = vtkSmartPointer<vtkActor>::New();
vtkSmartPointer<vtkActor> multiActor = vtkSmartPointer<vtkActor>::New ();

multiActor->SetMapper(multiMapper);
multiActor->SetMapper (multiMapper);

multiActor->GetProperty( )->SetColor(0.0, 1.0, 1.0);
multiActor->GetProperty( )->SetAmbient(1.0);
multiActor->GetProperty( )->SetLineWidth(2);
if(wireframe)
multiActor->GetProperty ()->SetColor (0.0, 1.0, 1.0);
multiActor->GetProperty ()->SetAmbient (1.0);
multiActor->GetProperty ()->SetLineWidth (2);
if (wireframe)
{
multiActor->GetProperty()->SetRepresentationToWireframe();
multiActor->GetProperty()->EdgeVisibilityOn();
multiActor->GetProperty()->SetOpacity(1.0);
multiActor->GetProperty ()->SetRepresentationToWireframe ();
multiActor->GetProperty ()->EdgeVisibilityOn ();
multiActor->GetProperty ()->SetOpacity (1.0);
}
else
{
multiActor->GetProperty()->SetRepresentationToSurface();
multiActor->GetProperty ()->SetRepresentationToSurface ();
}

// Add the actor to the scene
viz.getRenderWindow()->GetRenderers()->GetFirstRenderer()->AddActor(multiActor);
viz.getRenderWindow ()->GetRenderers ()->GetFirstRenderer ()->AddActor (multiActor);

// Render and interact
viz.getRenderWindow()->Render();
viz.getRenderWindow ()->Render ();
}

/* \brief Extracts all the points of depth = level from the octree
Expand Down

0 comments on commit d01dbd3

Please sign in to comment.