[vtkusers] "Filling" parts of a volume that are "inside" a set of polyhedra

David Gobbi david.gobbi at gmail.com
Sun Jul 23 23:21:43 EDT 2017


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170723/6aba9e72/attachment.html>


More information about the vtkusers mailing list