diff --git a/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/Barycentric_coordinates_2.txt b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/Barycentric_coordinates_2.txt index be72d546670..1133964c85c 100755 --- a/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/Barycentric_coordinates_2.txt +++ b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/Barycentric_coordinates_2.txt @@ -54,14 +54,6 @@ We also do this for Segment and Triangle coordinates - `Barycentric_coordinates::Seg_coordinates_2` and - `Barycentric_coordinates::Tri_coordinates_2`. -The last five classes are intended to parallel the computation of coordinates for multiple points. These classes are parameterized by `CGAL::Polygon_2` class, they require a container with points, and they return an `std::vector` with coordinates - -- `Barycentric_coordinates::Segment_coordinates_parallel_2`, -- `Barycentric_coordinates::Triangle_coordinates_parallel_2`, -- `Barycentric_coordinates::Wachspress_coordinates_parallel_2`, -- `Barycentric_coordinates::Mean_value_coordinates_parallel_2`, and -- `Barycentric_coordinates::Discrete_harmonic_coordinates_parallel_2`. - \subsection gbc_int_compute_weights Computation of the weight functions Since all the closed-form generalized barycentric coordinates are normalized weight functions (See \ref gbc_theory section for more information), the base class is able to compute weights directly without normalization for a strictly interior query point. To do so, you can use the following function @@ -121,7 +113,7 @@ In the following example we create a random strictly convex polygon with 1000 ra \cgalExample{Barycentric_coordinates_2/Wachspress_coordinates_example.cpp} \subsection dh_example Discrete Harmonic coordinates example -In this example we are going to compute the set of Discrete Harmonic coordinates for a set of green (interior), red (boundary), and blue (exterior) points with respect to the unit square. We will also show how to accelerate computations using additional parameters of the function `compute()`. The used kernel is exact, and we use `std::list` as an output container. Since all the points are symmetric, it is easy to debug the correctness of the obtained coordinate values. Output iterator is `std::back_insert_iterator`. +In this example we are going to compute the set of Discrete Harmonic coordinates for a set of interior, boundary, and exterior points with respect to the unit square. We will also show how to accelerate computations using additional parameters of the function `compute()`. The used kernel is exact, and we use `std::list` as an output container. Since all the points are symmetric, it is easy to debug the correctness of the obtained coordinate values. Output iterator is `std::back_insert_iterator`. \anchor dh_coord_example \cgalFigureBegin{dh__example,discrete_harmonic_coordinates_example.png} @@ -166,7 +158,7 @@ Example's point pattern. Segment coordinates can be computed exactly if an exact data type is chosen. The segment itself, with respect to which we compute coordinates, must be not degenerate. If the both conditions are satisfied, the computation never breaks down. But, we have to do some clarification here. To compute coordinate functions, the user must be positive about a query point being exactly on the line \f$L\f$ supporting the segment. Since in many applications it is not the case, and a query point may lie very close but not exactly on this line, the class is able to handle this situation. \cgalFigureBegin{projection,projection.png} -Scalar projection \f$p'\f$ of the vector \f$p\f$ on the vector \f$q\f$. +Scalar projection \f$p'\f$ of the vector \f$p\f$ on the vector \f$q\f$. \cgalFigureEnd Let us imagine that some query point \f$v\f$ does not lie exactly on the line \f$L\f$, but it is of some distance \f$d\f$ away as it is shown in the figure above. If we want to compute Segment barycentric coordinate \f$b_1(v)\f$ with respect to the vertex \f$v_1\f$, we, first, find a scalar projection \f$p'\f$ of the vector \f$p\f$ on the vector \f$q\f$ and then normalize it by the length of \f$q\f$. It gives us Segment barycentric coordinate \f$b_1(v') = b_1(v)\f$ if \f$v\f$ lied exactly on the line. @@ -250,7 +242,7 @@ Since \f$\bar{w}_i\f$ is always positive, we have to append to it the proper sig Apart the most important requirement on barycentric coordinates to be as much as possible precise, it is very important for them to be as fast as possible to evaluate. These coordinate functions are used in many applications where they must be computed for millions of points and, thus, the real time usage of coordinates is crucial. When writing the code, we tried to fulfil this important requirement, and in this section we present the reader a few results about the computational time of the implemented coordinate functions. -The structure of the speed test that we run for all the functions consists of computing coordinate (or weight) values at \f$10^6-10^9\f$ strictly interior points with respect to some polygon (triangle or segment). At each iteration of the loop we create a query point, pass it to the function, and compute all the related coordinates. We run this loop 10 times in a row, and the time presented in the Table 1 is the arithmetic mean of all the trials. A typical example of the performed test for Triangle coordinates can be found below. This example also shows how to construct your own iterator and pass it to our class. In our example we create an iterator that writes coordinate values for each new query point over coordinate values of the previous point in the fixed-size standard C++ array, so that memory is allocated only once. +The structure of the speed test that we run for all the functions consists of computing coordinate (or weight) values at \f$10^8-10^{10}\f$ strictly interior points with respect to some polygon (triangle or segment). At each iteration of the loop we create a query point, pass it to the function, and compute all the related coordinates. We run this loop 10 times in a row, and the time presented in the Table 1 is the arithmetic mean of all the trials. A typical example of the performed test for Triangle coordinates can be found below. This example also shows how to construct your own iterator and pass it to our class. In our example we create an iterator that writes coordinate values for each new query point over coordinate values of the previous point in the fixed-size standard C++ array, so that memory is allocated only once. \cgalExample{Barycentric_coordinates_2/Triangle_coordinates_speed_test.cpp} @@ -260,175 +252,155 @@ The machine that has been used in all the tests is MacBook Pro 2011 with 2 GHz I - + - + + - - + + + - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - + - + + - - - + + + + - - - + + + + - - - + + + + - + - + - - + + + + + + - + - - - - - - - - - - - - - + + - - - + + + + - - - + + + + - - - + + + + - +
Time to compute Segment and Triangle coordinatesTime to compute Segment and Triangle coordinates (seconds)
Type of coordinates Number of points Number of coordinate valuesTime in secondsTime \f$O(n)\f$ algorithm
Segment coordinates\f$10^9\f$\f$2\cdot 10^9\f$\f$10^{10}\f$\f$2\cdot 10^{10}\f$ 13.86494708
Triangle coordinates\f$10^9\f$\f$3\cdot 10^9\f$\f$10^{10}\f$\f$3\cdot 10^{10}\f$ 13.91510820
Time to compute coordinate functions on a unit squareTime to compute weight functions on a unit square (seconds)
Type of coordinates Number of points Number of coordinate valuesTime in seconds
Wachspress coordinates\f$10^9\f$\f$4\cdot 10^9\f$
Discrete Harmonic coordinates\f$10^9\f$\f$4\cdot 10^9\f$
Mean Value coordinates\f$10^9\f$\f$4\cdot 10^9\f$
Time to compute weight functions on a unit square
Type of weightsNumber of pointsNumber of weight valuesTime in secondsTime \f$O(n)\f$ algorithm
Wachspress weights \f$10^9\f$ \f$4\cdot 10^9\f$ 47.25240803
Discrete Harmonic weights \f$10^9\f$ \f$4\cdot 10^9\f$ 58.56583214
Mean Value weights \f$10^9\f$ \f$4\cdot 10^9\f$ 97.41971302
Time to compute coordinate functions on a strictly convex polygon with 16 verticesTime to compute coordinate functions on a unit square (seconds)
Type of coordinates Number of points Number of coordinate valuesTime in secondsTime \f$O(n^2)\f$ algorithmTime \f$O(n)\f$ algorithm
Wachspress coordinates\f$10^8\f$\f$16\cdot 10^8\f$\f$10^9\f$\f$4\cdot 10^9\f$48.6475379564.24326611
Discrete Harmonic coordinates\f$10^8\f$\f$16\cdot 10^8\f$\f$10^9\f$\f$4\cdot 10^9\f$61.9383294078.09849691
Mean Value coordinates\f$10^8\f$\f$16\cdot 10^8\f$\f$10^9\f$\f$4\cdot 10^9\f$99.83270693113.8180611
Time to compute weight functions on a strictly convex polygon with 16 verticesTime to compute weight functions on a strictly convex polygon with 16 vertices (seconds)
Type of weightsType of coordinates Number of pointsNumber of weight valuesTime in secondsNumber of coordinate valuesTime \f$O(n)\f$ algorithm
Wachspress weights \f$10^8\f$ \f$16\cdot 10^8\f$ 20.44883299
Discrete Harmonic weights \f$10^8\f$ \f$16\cdot 10^8\f$ 22.88397408
Mean Value weights \f$10^8\f$ \f$16\cdot 10^8\f$ 39.10448194
Parallel computation along segment, triangle, and unit squareTime to compute coordinate functions on a strictly convex polygon with 16 vertices (seconds)
Type of coordinates Number of points Number of coordinate valuesTime in seconds
Segment coordinates\f$10^6\f$\f$2\cdot 10^6\f$
Triangle coordinates\f$10^6\f$\f$3\cdot 10^6\f$Time \f$O(n^2)\f$ algorithmTime \f$O(n)\f$ algorithm
Wachspress coordinates\f$10^6\f$\f$4\cdot 10^6\f$\f$10^8\f$\f$16\cdot 10^8\f$37.8885359823.22868419
Discrete Harmonic coordinates\f$10^6\f$\f$4\cdot 10^6\f$\f$10^8\f$\f$16\cdot 10^8\f$39.6991670125.71915221
Mean Value coordinates\f$10^6\f$\f$4\cdot 10^6\f$\f$10^8\f$\f$16\cdot 10^8\f$58.9169349741.49101996
Table 1Table 1

@@ -474,7 +446,7 @@ Some statistics about current implementation of the package can be found in the Classes -16 +11 Enumerations @@ -482,7 +454,7 @@ Some statistics about current implementation of the package can be found in the Lines of code - +2590 Supported kernels @@ -518,7 +490,7 @@ Some statistics about current implementation of the package can be found in the Number of speed tests -19 +18 Table 2 @@ -555,7 +527,7 @@ Wachspress coordinates with respect to \f$v_2 = (1.0,\ 1.0)\f$. The colour bar i Another type of generalized barycentric coordinates proposed by Pinkall and Polthier in 1993 \cite cgal:pp-cdmsc-93 and by Eck et al. in 1995 \cite cgal:bc:eddhls-maam-95 in the context of a \ref chapsurface_mesh_parameterization "triangle mesh parameterization" is called Discrete Harmonic coordinates. These coordinates are defined, similar to the Wachspress approach, for an arbitrary strictly convex polygon and inherit all the properties of Triangle coordinates apart the positivity inside a polygon because they can be negative in some regions of some irregular polygons. Another interesting property of these coordinate functions is that they coincide with Wachspress coordinates for any polygon whose vertices lie on a circle. -To plot the Discrete Harmonic coordinates we take \ref dh_coord_example "the unit square" \f$[v_0, \dots, v_3]\f$ used with Wachspress coordinates and plot the function with respect to the same vertex \f$v_2\f$. Since a unit square is a regular polygon that is its vertices lie on a circle, we get the plot identical to the \ref wp_plot "Wachspress one". +To plot Discrete Harmonic coordinates we take \ref dh_coord_example "the unit square" \f$[v_0, \dots, v_3]\f$ used with Wachspress coordinates and plot the function with respect to the same vertex \f$v_2\f$. Since a unit square is a regular polygon that is its vertices lie on a circle, we get the plot identical to the \ref wp_plot "Wachspress one". The last type of generalized barycentric coordinates, we want to discuss, is Mean Value coordinates \cite cgal:f-mvc-03 proposed by M. Floater in 2003. Based on the Mean Value theorem these coordinates, unlike Wachspress and Discrete Harmonic ones, are defined for an arbitrary simple polygon, inherit all the properties of Triangle coordinates for any convex polygon, and lack the only positivity property for some concave ones. It is proven by Hormann and Floater that these coordinates are positive only inside the kernel of a star-shaped polygon \cite cgal:bc:hf-mvcapp-06. The same as for Discrete Harmonic coordinates, Mean Value weights are often used in the context of a \ref chapsurface_mesh_parameterization "triangle mesh parameterization." @@ -567,6 +539,9 @@ Mean Value coordinates with respect to \f$v_7\f$. The colour bar indicates the r \b Family: All the coordinates discussed in this section and implemented in the package come from one and the same family of generalized barycentric coordinates named 3-Point Family of Coordinates \cite cgal:bc:fhk-gcbcocp-06. +\section gbc_acknowledgments Acknowledgments +The authors wish to thank Teseo Schneider and Randolf Schaerfig for helpful comments and discussions. + */ } \ No newline at end of file diff --git a/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/dh_notations.png b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/dh_notations.png new file mode 100644 index 00000000000..c2f669322b7 Binary files /dev/null and b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/dh_notations.png differ diff --git a/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/discrete_harmonic_coordinates_example.png b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/discrete_harmonic_coordinates_example.png new file mode 100644 index 00000000000..d5b7f467c8e Binary files /dev/null and b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/discrete_harmonic_coordinates_example.png differ diff --git a/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/mean_value_coordinates_example.png b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/mean_value_coordinates_example.png new file mode 100644 index 00000000000..7ce00fcd046 Binary files /dev/null and b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/mean_value_coordinates_example.png differ diff --git a/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/mv_notations.png b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/mv_notations.png new file mode 100644 index 00000000000..e7c3b94be3c Binary files /dev/null and b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/mv_notations.png differ diff --git a/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/projection.png b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/projection.png new file mode 100644 index 00000000000..e815e00f98c Binary files /dev/null and b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/projection.png differ diff --git a/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/segment_coordinates_example.png b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/segment_coordinates_example.png new file mode 100644 index 00000000000..08e30c73d33 Binary files /dev/null and b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/segment_coordinates_example.png differ diff --git a/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/triangle_coordinates_example.png b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/triangle_coordinates_example.png new file mode 100644 index 00000000000..a4e6eff4523 Binary files /dev/null and b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/triangle_coordinates_example.png differ diff --git a/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/wp_notations.png b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/wp_notations.png new file mode 100644 index 00000000000..c32435d5878 Binary files /dev/null and b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/wp_notations.png differ diff --git a/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/zero_set.png b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/zero_set.png new file mode 100644 index 00000000000..f719f5ba17a Binary files /dev/null and b/Barycentric_coordinates_2/doc/Barycentric_coordinates_2/fig/zero_set.png differ