[vtkusers] Random point set generation inside a surface

David.Pont at ForestResearch.co.nz David.Pont at ForestResearch.co.nz
Wed Mar 12 15:38:06 EST 2003


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


|--------+--------------------------------->
|        |          Carlos Martínez Burgos |
|        |          <cmarbur at iti.upv.es>   |
|        |          Sent by:               |
|        |          vtkusers-admin at public.k|
|        |          itware.com             |
|        |                                 |
|        |                                 |
|        |          13/03/2003 00:11       |
|        |                                 |
|--------+--------------------------------->
  >------------------------------------------------------------------------------------------------------------|
  |                                                                                                            |
  |      To:     VTK User Mailing List <vtkusers at public.kitware.com>                                           |
  |      cc:                                                                                                   |
  |      Subject:     [vtkusers] Random point set generation inside a surface                                  |
  >------------------------------------------------------------------------------------------------------------|




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
----------------------------------------------------------------------

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <
http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers







More information about the vtkusers mailing list