Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Lloyd optimization and center of mass

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Lloyd optimization and center of mass


Chronological Thread 
  • From: "Laurent Rineau (CGAL/GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Lloyd optimization and center of mass
  • Date: Fri, 10 Jun 2016 15:58:40 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:/AyynRdVZzzI08sfJ+4SoYJllGMj4u6mDksu8pMizoh2WeGdxc69ZB7h7PlgxGXEQZ/co6odzbGG4ua/Biddvd6oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDjvcKMKFgUzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IAu3GePEzQrVcSTgnKGso/9bDtB/ZTALJ6GFPfH8Rl08CJwHY9hz8Qt/Lsy33v/c1mAK1FOmxYr0zXDm+9bZFQRT0jz0WdnRxpGXel9Z9ir4duhOnqhVi64XbaYXTM+BxKPCONegGTHZMC54CHxdKBZmxOtMC
  • Organization: GeometryFactory

Le Friday 10 June 2016 14:49:31 Yann GAVET a écrit :
> Hello all,
>
> I basically want to implement a code for stipple algorithm
> (https://mrl.nyu.edu/~ajsecord/stipples.html), which uses a centroidal
> voronoi diagram weighted by a gray level image (the center of the
> Voronoi cells move to the center of mass instead of the centroid).
>
> What would be the best way to code this algorithm with CGAL, efficiently
> ? is their a way to transform Lloyd mesh optimization
> (CGAL::lloyd_optimize_mesh_2) for using the center of mass given by an
> exterior constraint on each cell (here, given by the pixels of the image
> laying in the cell).

Have a look at the function `lloyd_optimize_mesh_2_impl` from
`<CGAL/lloyd_optimize_mesh_2.h>`. It starts with:

typedef Mesh_2::Mesh_sizing_field<CDT> Sizing;
typedef Mesh_2::Lloyd_move_2<CDT, Sizing> Mv;
typedef Mesh_2::Mesh_global_optimizer_2<CDT, Mv> Optimizer;

Optimizer lloyd(cdt,
convergence_ratio,
freeze_bound);

If you replace `Mesh_2::Lloyd_move_2` by a modification of it, it can do what
you want. You will need to copy and paste `<CGAL/Mesh_2/Lloyd_move_2.h>` and
then modify the function `operator()` that computes the move. As for the
modification of that function `operator()`, you are on your own.

--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory http://www.geometryfactory.com/
Release Manager of the CGAL Project http://www.cgal.org/




Archive powered by MHonArc 2.6.18.

Top of Page