[vtkusers] Random point set generation inside a surface

Sebastien MARAUX maraux at ondim.fr
Wed Mar 12 06:58:34 EST 2003


Well if it is not terrain, it is not as simple.
In the case of stones, I think this is not
the best approach. But is should be possible too,
if your objects are convexes (if they aren't, even
if casting rays in two ways - top to bottom and
vice verse - you cannot hit surface anywhere).

Moreover, putting random points a a projection of the stone
will lead to not exactly randomly points on the surface, as
vertical surfaces have much less chances to receive a point
in vertical projection case.

In your case, I would probably take a random triangle cell number,
( random from 0 to getCellNumber() )
and then take 3 random ponderation factors (one for each triangle summit)
from for exemple 0 to 100.

then compute ponderate position of your point with position and
ponderation factor of each of 3 sumits.

I am not sure this is exaclty random, but it should give better results
than the other method.

Notice that it is 4 randoms per point, you could find something with
only 1 random per point, much more faster.

Sebastien MARAUX

----- Original Message -----
From: "Carlos Martínez Burgos" <cmarbur at iti.upv.es>
To: "Sebastien MARAUX" <maraux at ondim.fr>
Sent: Wednesday, March 12, 2003 12:51 PM
Subject: Re: [vtkusers] Random point set generation inside a surface


> Hi again.
>
> On Wed, 12 Mar 2003, Sebastien MARAUX wrote:
>
> > why don't you randomly generate points with a coordinate
> > set to zero ( z ?), and others (x,y ?) in bounding box, and
> > then map the missing coordinate to your surface ?
> >
>
> It seems to be a good idea but, how to map the z coordinate randomly to
> the space inside the surface? I mean ...
>
> > to get z for a given x,y look at vtkCellPicker-
> > >IntersectWithLine with line going from x,y, max
> > height+10% to x,y,minheight +10%
> >
>
> How can I get the maxheight and the minheight of a closed surface? What
> about if there are holes inside? This could be ignored because is not
> usual but it could be possible.
>
> > For terrain surfaces this should work , if you have other
> > surfaces try to get the transformation to make it horizontal,
> > and apply this method.
> >
>
> OK. I don't have terrain surfaces. I have object surfaces like stones and
> so on.
>
> I think you mean to project the surface on a 2D plane and inside the
> polygon generate the coordinates and undo the projection. Isn't it? I
> don't know how to do this.
>
> > I don't have anyother idea for the moment.
> >
>
> Don't worry, something is better than nothing. What do you think about my
> idea?
>
> > Sebastien MARAUX
> >
>
> Thank you again.
>
> > ----- Original Message -----
> > From: "Carlos Martínez Burgos" <cmarbur at iti.upv.es>
> > To: "VTK User Mailing List" <vtkusers at public.kitware.com>
> > Sent: Wednesday, March 12, 2003 12:11 PM
> > 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
> > >
> >
>
> --
> ----------------------------------------------------------------------
> 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