[vtkusers] vtkBooleanOperationPolyDataFilter including disconnected faces
Cory Quammen
cquammen at cs.unc.edu
Mon Jan 23 13:21:57 EST 2012
Hi Eric,
I am one of the main contributors of the boolean operation filters. I
will take a look at this bug within the next couple days.
Thanks,
Cory
On Mon, Jan 23, 2012 at 12:59 PM, Fahlgren, Eric
<efahlgren at lifemodeler.com> wrote:
> Here's another shot of a similar configuration (I think I've moved the spheres from the previous example). This one clearly shows the odd shading on the stitching, which look to me to be normals pointed off to Mars or possibly Alpha Centauri. Could they just be pointed 180 off, an inside/outside detection problem when generating those new faces that glue the surfaces together?
>
> http://www.lifemodeler.com/eric/badNormals.png
>
> Eric
>
>>
>> Two problems, possibly related:
>>
>> 1) When I perform two successive Boolean operations, extraneous faces from
>> the second solid of the final operation are left in the polydata.
>>
>> 2) Note the faces in the red box of the linked image. The normals appear
>> to be incorrect, there are occasional dark regions in odd places on the
>> resulting polydata.
>>
>> Is there a filter I can add after the Boolean operations to eliminate the
>> extra faces? How about straightening up the normals?
>>
>> Thanks,
>> Eric
>>
>> #!/usr/bin/env python
>>
>> import vtk
>>
>> LHS = vtk.vtkCubeSource()
>> LHS.SetCenter((0.0, 0.0, 0.8))
>>
>> if 1:
>> triangle = vtk.vtkTriangleFilter()
>> triangle.SetInputConnection(LHS.GetOutputPort())
>> LHS = triangle
>>
>> if 1:
>> RHS = vtk.vtkSphereSource()
>> RHS.SetCenter((0.5, 0.0, 0.2))
>> RHS.SetRadius(1.0); RHS.SetPhiResolution(40);
>> RHS.SetThetaResolution(40)
>>
>> boolOp = vtk.vtkBooleanOperationPolyDataFilter()
>> boolOp.SetOperation(vtk.VTK_DIFFERENCE)
>> boolOp.SetInputConnection(0, LHS.GetOutputPort())
>> boolOp.SetInputConnection(1, RHS.GetOutputPort())
>> LHS = boolOp
>>
>> if 1:
>> RHS = vtk.vtkSphereSource()
>> RHS.SetCenter((-0.5, 0.0, 0.3))
>> RHS.SetRadius(1.0); RHS.SetPhiResolution(40);
>> RHS.SetThetaResolution(40)
>>
>> boolOp = vtk.vtkBooleanOperationPolyDataFilter()
>> boolOp.SetOperation(vtk.VTK_DIFFERENCE)
>> boolOp.SetInputConnection(0, LHS.GetOutputPort())
>> boolOp.SetInputConnection(1, RHS.GetOutputPort())
>> LHS = boolOp
>>
>> if 0:
>> fill = vtk.vtkFillHolesFilter()
>> #fill.SetHoleSize(1.0)
>> fill.SetInputConnection(LHS.GetOutputPort())
>> LHS = fill
>>
>> mapper = vtk.vtkPolyDataMapper()
>> mapper.SetInputConnection(LHS.GetOutputPort(0))
>> mapper.ScalarVisibilityOff()
>>
>> actor = vtk.vtkActor()
>> actor.SetMapper(mapper)
>>
>> renderer = vtk.vtkRenderer()
>> renderWindow = vtk.vtkRenderWindow()
>> renderWindow.AddRenderer(renderer)
>> renderWindow.SetSize(1024, 1024)
>>
>> renderer.AddActor(actor)
>>
>> interactor = vtk.vtkRenderWindowInteractor()
>> interactor.SetRenderWindow(renderWindow)
>> interactor.Initialize()
>> renderWindow.Render()
>> interactor.Start()
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
--
Cory Quammen
Research Associate
Department of Computer Science
The University of North Carolina at Chapel Hill
More information about the vtkusers
mailing list