[vtkusers] Random point set generation inside a surface

Carlos Martínez Burgos cmarbur at iti.upv.es
Fri Mar 14 03:16:35 EST 2003


Hi David.

I have a polydata instead of a structured grid structure. I don't know if
there is a way to do this on a structured grid but I think it could be
possible to convert the polydata to a grid, if possible, and generate
coordinates inside the volume. What do you think?

Thanks.

On Fri, 14 Mar 2003, David Netherway wrote:

> Would it be suitable to generate the random points on a fixed grid. Then you
> could create a structured grid of the data. Then turn the points inside the
> volume into a 1 dimensional array and generate random points within that
> array.
> 
> David Netherway
> 
> 
> >
> > Carlos,
> >     I have a class that treats polydata as an implicit surface.
> > You could get the centre and radius for your polydata (from its bounds?),
> > use vtkPointSource to generate a random set of points in that region,
> using
> > SetCenter and SetRadius and SetNumberOfPoints. Of course some points will
> > fall outside the surface, then use the class I have, vtkImplicitPolydata,
> > to clip away the points outside the surface. You will not have exact
> > control over the number of points inside the surface, but it should work
> if
> > that is not a strict requirement. Tell me if you want the class and I will
> > send the C++ code to you.
> >   Dave Pont
> >
> >
> >
> > Hi all.
> >
> > I have a closed surface (vtkPolyData) and want to generate a random point
> > set inside this surface. I don't know how exactly do this. Is there a
> > method in VTK?
> >
> > I have an idea. Get the OBBTree of the surface and its bounding box. Then
> > generate random points with their coordinates inside the bounding box.
> > Then test if the point is inside the surface using the OBBTree method
> > InsideOrOutside. If the point is outside the surface generate it again.
> > What do you think about this method? I think that it sometimes can take
> > too much time if the surface is not like a cube because of in/out test but
> > I don't have any idea.
> >
> > Thanks a lot.
> >
> > --

-- 
----------------------------------------------------------------------
Carlos Martínez Burgos      |     Instituto Tecnológico de Informática
Ingeniero Informático       |      Universidad Politécnica de Valencia
Tlf: +34 963877237          |                        Camí de Vera, S/N
cmarbur at iti.upv.es          |                   46071 Valencia - Spain
www.iti.upv.es/~cmarbur     |                           www.iti.upv.es
----------------------------------------------------------------------




More information about the vtkusers mailing list