[vtkusers] "Filling" parts of a volume that are "inside" a set of polyhedra
Elvis Stansvik
elvis.stansvik at orexplore.com
Sun Jul 23 23:58:32 EDT 2017
2017-07-24 5:43 GMT+02:00 David Gobbi <david.gobbi at gmail.com>:
> You can use as many closed surfaces as you want with
> vtkPolyDataToImageStencil, as long as the surfaces don't intersect.
> Intersection would break the topological constraints of the filter.
Alright. Good to know. My polyhedra will be the result result of a
rigid body physics simulation, and I'm not sure yet whether, in the
final resting state, the bodies may intersect slightly or not, they
probably can.
>
> But if you have each polyhedron as a separate vtkPolyData, then iterating
> over them all should still be fast, because for each polyhedron you can
> ignore all voxels except for the ones that are inside.
Okay, then I'll definitely process them one by one.
Elvis
>
> - David
>
> On Sun, Jul 23, 2017 at 9:34 PM, Elvis Stansvik
> <elvis.stansvik at orexplore.com> wrote:
>>
>> 2017-07-24 5:30 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
>> > 2017-07-24 5:25 GMT+02:00 Dean Inglis <inglis.dl at gmail.com>:
>> >> good to know David, thanks!!!
>> >
>> > Many thanks to both of you. I had not found vtkPolyDataToImageStencil
>> > yet, but was looking more towards the concept of implicit functions.
>> > But this sounds like a much better approach, so I think I was right in
>> > reaching out :)
>>
>> Just one thing I saw in the docs for vtkPolyDataToImageStencil now:
>>
>> "The polydata can either be a closed surface mesh or a series of
>> polyline contours (one contour per slice)."
>>
>> Does this mean that, since I have a set of closed surfaces (upwards a
>> 100 or so), I'd have to repeat the process David described, once for
>> each of my polyhedron? Or is there some way to generate a stencil from
>> many closed surfaces in one go?
>>
>> Elvis
>>
>> >
>> > Elvis
>> >
>> >>
>> >> - Dean
>> >>
>> >> On Sun, Jul 23, 2017 at 11:21 PM, David Gobbi <david.gobbi at gmail.com>
>> >> wrote:
>> >>>
>> >>> Hi Elvis,
>> >>>
>> >>> I'd recommend generating a stencil with vtkPolyDataToImageStencil,
>> >>> then
>> >>> iterating over over all the voxels inside the stencil with
>> >>> vtkImagePointDataIterator:
>> >>>
>> >>>
>> >>> http://www.vtk.org/doc/nightly/html/classvtkPolyDataToImageStencil.html
>> >>>
>> >>> http://www.vtk.org/doc/nightly/html/classvtkImagePointDataIterator.html
>> >>>
>> >>> The iterator can efficiently give you the pointId for every voxel
>> >>> enclosed
>> >>> by the polyhedral surface (works for concave as well as convex
>> >>> surfaces).
>> >>> Once you have the pointId, you can set that voxel to whatever you
>> >>> want.
>> >>> There's a brief and vaguely relevant description on gitlab:
>> >>> https://gitlab.kitware.com/vtk/vtk/merge_requests/1118
>> >>>
>> >>> - David
>> >>>
>> >>>
>> >>> On Sun, Jul 23, 2017 at 6:45 PM, Elvis Stansvik
>> >>> <elvis.stansvik at orexplore.com> wrote:
>> >>>>
>> >>>> Hi all,
>> >>>>
>> >>>> I have a set of points describing multiple convex polyhedra. The
>> >>>> polyhedra are for the most part disjoint in space, but they may
>> >>>> intersect slightly in some places.
>> >>>>
>> >>>> I need to create an empty voxel volume (all scalars 0), and then
>> >>>> "fill" the voxels that are inside one (or several) of the polyhedrons
>> >>>> with some Perlin noise. I also have access to normals for the faces
>> >>>> constituting the polyhedra, if necessary.
>> >>>>
>> >>>> Finally, I also have a single separate polyhedron (non-convex this
>> >>>> time), and as a finishing step, I'd like to fill the voxels that are
>> >>>> inside this polyhedron with a constant scalar value.
>> >>>>
>> >>>> Can VTK help me here?
>> >>>>
>> >>>> As this is new territory for me as far as VTK goes, any
>> >>>> pointers/advice on how to go about it would be much appreciated.
>> >>>>
>> >>>> Cheers,
>> >>>> Elvis
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> 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
>> >>>
>> >>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>> >>>
>> >>> Follow this link to subscribe/unsubscribe:
>> >>> http://public.kitware.com/mailman/listinfo/vtkusers
>> >>>
>> >>
>
>
More information about the vtkusers
mailing list