

I am new to CGAL. I have installed CGAL 4.8.2 on the latest version of Ubuntu
I would like some help with writing the following method barycentric_subdivide:
The method should take in the n+1 vertices (each vertex for me represents a probability distribution) that define the convex hull (boundary) of an ndimensional simplex as input, partition that simplex using barycentric subdivision, and return (n+1)! subsimplices (with the same dimensionality) as output.
Input: n+1 vertices that define the convex hull of an ndimensional simplex. For eg:
For 1D: {(0,1), (1,0)} for 1D,
For 2D: {(0,0,1),(0,1,0),(1,0,0)}, and so on..
Output: (n+1)! subsimplices (i.e (n+1)! sets of vertices that define the convex hull of the (n+1)! subsimplices). For eg:
For 1D: {{(0,1),(0.5,0.5)} , {(0.5,0.5),(1,0)}},
For 2D: {{(0,0,1),(1/3,1/3,1/3),(0,1/2,1/2)} ,
{(0,1,0),(1/3,1/3,1/3),(0,1/2,1/2)}, {(0,0,1),(1/3,1/3,1/3),(1/2,0,1/2)}
, {(1,0,0),(1/3,1/3,1/3),(1/2,0,1/2)},
{(1,0,0),(1/3,1/3,1/3),(1/2,1/2,0)} ,
{(0,1,0),(1/3,1/3,1/3),(1/2,1/2,0)}, and so on..
I tried running http://doc.cgal.org/latest/Triangulation/#title11 but it doesn't provide what I want. Any help is greatly appreciated.
Thanks!

Muthukumaran Chandrasekaran Department of Computer Science University of Georgia
Phone: <a href="tel:(706)%202472873" value="+17062472873" target="_blank">7062472873
 Muthukumaran Chandrasekaran Department of Computer Science University of Georgia
Phone: 7062472873


On Tue, 14 Feb 2017, Muthukumaran Chandrasekaran wrote:
> I am new to CGAL. I have installed CGAL 4.8.2
> < http://www.cgal.org/2016/09/19/cgal482/> on the latest version of Ubuntu
>
> I would like some help with writing the following method
> *barycentric_subdivide*:
>
> The method should take in the *n+1* vertices (each vertex for me represents
> a probability distribution) that define the convex hull (boundary) of
> an *n*dimensional
> simplex as input, partition that simplex using barycentric subdivision, and
> return *(n+1)!* subsimplices (with the same dimensionality) as output.
>
> *Input*: *n+1* vertices that define the convex hull of an ndimensional
> simplex. For eg:
>
> For 1D: {(0,1), (1,0)} for 1D,
>
> For 2D: {(0,0,1),(0,1,0),(1,0,0)}, and so on..
>
> *Output*: *(n+1)!* subsimplices (i.e *(n+1)!* sets of vertices that define
> the convex hull of the (n+1)! subsimplices). For eg:
>
> For 1D: {{(0,1),(0.5,0.5)} , {(0.5,0.5),(1,0)}},
>
> For 2D: {{(0,0,1),(1/3,1/3,1/3),(0,1/2,1/2)} ,
> {(0,1,0),(1/3,1/3,1/3),(0,1/2,1/2)}, {(0,0,1),(1/3,1/3,1/3),(1/2,0,1/2)} ,
> {(1,0,0),(1/3,1/3,1/3),(1/2,0,1/2)}, {(1,0,0),(1/3,1/3,1/3),(1/2,1/2,0)} ,
> {(0,1,0),(1/3,1/3,1/3),(1/2,1/2,0)}, and so on..
>
> I tried running http://doc.cgal.org/latest/Triangulation/#title11 but it
> doesn't provide what I want. Any help is greatly appreciated.
You could build a triangulation of your points, which has just one finite
cell, then apply a variant of barycentric_subdivide from the example to it
(the example works on the TDS, you would want to work on a full
triangulation, with points with coordinates), and iterate on the resulting
finite cells.
Otherwise, you'll have to implement it yourself, it isn't hard to do
recursively: get the barycentric subdivision of each facet, and append the
centroid to them.

Marc Glisse

You are currently subscribed to cgaldiscuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgaldiscuss


Dear Marc,
Thank you for getting back to me so quickly!


Hi,
Please find my attempt at doing what Marc suggested. Code is attached. 1) I create a full triangulation of points with 1 finite cell. 2) Rewrote a variant of the barycentric_subdivide that now uses the full triangulation 3) Had to reimplement CGAL::barycenter() because it wasn't defined for Point_d However, I am not sure if what I am doing is 100% correct. I couldn't test this because I kept getting an error at compile time at line 48 (v = v + it  CGAL::ORIGIN;) The error: "no match for ‘operator+’ (operand types are ‘Point_d {aka CGAL::Wrap::Point_d<CGAL::Epick_d<CGAL::Dynamic_dimension_tag> >}’ and ‘Point_d {aka CGAL::Wrap::Point_d<CGAL::Epick_d<CGAL::Dynamic_dimension_tag> >}’)" Can someone please tell me why I am getting this error? Also, can you please check the rest of the code to see if the implementation seems right? Thanks Muthu Chandrasekaran PhD Candidate, THINC Lab Department of Comp. Science University of Georgia


Hi,
Please find my attempt at doing what Marc suggested. Code is attached. 1) I create a full triangulation of points with 1 finite cell. 2) Rewrote a variant of the barycentric_subdivide that now uses the full triangulation 3) Had to reimplement CGAL::barycenter() because it wasn't defined for Point_d However, I am not sure if what I am doing is 100% correct. I couldn't test this because I kept getting an error at compile time at line 48 (v = v + it  CGAL::ORIGIN;) The error: "no match for ‘operator+’ (operand types are ‘Point_d {aka CGAL::Wrap::Point_d<CGAL:: Epick_d<CGAL::Dynamic_dimension_tag> >}’ and ‘Point_d {aka CGAL::Wrap::Point_d<CGAL::Epick_d<CGAL::Dynamic_dimension_tag> >}’)"
Can someone please tell me why I am getting this error? Also, can you please check the rest of the code to see if the implementation seems right? Thanks Muthu Chandrasekaran PhD Candidate, THINC Lab Department of Comp. Science University of Georgia
This is what I'm trying to do:
I would like some help with writing the following method barycentric_subdivide: The method should take in the n+1 vertices (each vertex for me represents a probability distribution) that define the convex hull (boundary) of an ndimensional simplex as input, partition that simplex using barycentric subdivision, and return (n+1)! subsimplices (with the same dimensionality) as output. Input: n+1 vertices that define the convex hull of an ndimensional simplex. For eg: For 1D: {(0,1), (1,0)} for 1D, For 2D: {(0,0,1),(0,1,0),(1,0,0)}, and so on.. Output: (n+1)! subsimplices (i.e (n+1)! sets of vertices that define the convex hull of the (n+1)! subsimplices). For eg: For 1D: {{(0,1),(0.5,0.5)} , {(0.5,0.5),(1,0)}}, For 2D: {{(0,0,1),(1/3,1/3,1/3),(0,1/2,1/2)} , {(0,1,0),(1/3,1/3,1/3),(0,1/2,1/2)}, {(0,0,1),(1/3,1/3,1/3),(1/2,0,1/2)} , {(1,0,0),(1/3,1/3,1/3),(1/2,0,1/2)}, {(1,0,0),(1/3,1/3,1/3),(1/2,1/2,0)} , {(0,1,0),(1/3,1/3,1/3),(1/2,1/2,0)}, and so on.. I tried running http://doc.cgal.org/latest/Triangulation/#title11 but it doesn't provide what I want. Any help is greatly appreciated

