Skip to Content.
Sympa Menu

cgal-discuss - RE: [cgal-discuss] Creating a random sample

Subject: CGAL users discussion list

List archive

RE: [cgal-discuss] Creating a random sample


Chronological Thread 
  • From: "Amir Vaxman" <>
  • To: <>
  • Subject: RE: [cgal-discuss] Creating a random sample
  • Date: Tue, 16 Jun 2009 12:00:02 +0300

Ok, these approaches sound good. Can they be simplified if the polygon is
convex?

Amir.

-----Original Message-----
From: Andreas Fabri
[mailto:]

Sent: Tuesday, June 16, 2009 11:43 AM
To:

Subject: Re: [cgal-discuss] Creating a random sample

Amir Vaxman wrote:
> Hello,
>
>
>
> How do I create a random set of N points inside a given polygon_2?
>
>
>
> Amir.
>

Hi Amir,

There is nothing out of the box. Two approaches that miht work:

Construct the constrained Delaunay triangulation of the polygon,
mark the triangles in the domain.
create random points in the bounding box and call the locate
method to figure out if it is inside or outside.


If the polygon doesn't cover a reasonably big area of the bounding box
you might enumerate the triangles inside the triangulated polygon,
toss a coin, compute a random point in triangle i, and decide if you
keep it based on the percentage of the area of the triangle in order
not to favorize points in tiny triangles.


andreas
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss




Archive powered by MHonArc 2.6.16.

Top of Page