Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77507 - sandbox/gtl/doc
From: sydorchuk.andriy_at_[hidden]
Date: 2012-03-23 15:47:24


Author: asydorchuk
Date: 2012-03-23 15:47:23 EDT (Fri, 23 Mar 2012)
New Revision: 77507
URL: http://svn.boost.org/trac/boost/changeset/77507

Log:
Updating voronoi documentation. Finished voronoi main page.

Text files modified:
   sandbox/gtl/doc/voronoi_diagram.htm | 75 ++++++++++++++++++++++++++-------------
   sandbox/gtl/doc/voronoi_main.htm | 62 ++++++++++++++++++++++++++++----
   2 files changed, 103 insertions(+), 34 deletions(-)

Modified: sandbox/gtl/doc/voronoi_diagram.htm
==============================================================================
--- sandbox/gtl/doc/voronoi_diagram.htm (original)
+++ sandbox/gtl/doc/voronoi_diagram.htm 2012-03-23 15:47:23 EDT (Fri, 23 Mar 2012)
@@ -19,6 +19,7 @@
 
 
 
+
 <meta http-equiv="Content-Language" content="en-us">
 <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Contents</title><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body>
 
@@ -98,20 +99,22 @@
                 <td style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;" valign="top" width="100%"><!-- End Header -->
                 <br>
                 <p></p>
- <h1>Voronoi Diagram</h1>Voronoi
+
+ <h1>Voronoi Diagram</h1>
+Voronoi
 diagram is a computational geometry concept that represents partition
 of a given space onto regions, with bounds determined by distances to a
 specified family of objects. Boost.Polygon provides implementation of
 Voronoi diagram data structure in 2D space. Internal representation
-consists of a three arrays, that respectively contain: voronoi cells
-(area around input sites bounded by voronoi edges), voronoi vertices
-(points where three or more voronoi edges intersect), voronoi edges
+consists of a three arrays, that respectively contain: Voronoi cells
+(area around input sites bounded by Voronoi edges), Voronoi vertices
+(points where three or more Voronoi edges intersect), Voronoi edges
 (one dimensonal curves containing points equidistant from the two
 closest input sites). Each of the primitives (cell, vertex, edge)
 contains pointers to other linked primitives, so that it's always
 possible to efficiently traverse Voronoi diagram. Picture below shows
-voronoi vertices in red, voronoi edges in black, input sites that
-correspond to the voroni cells in blue (it is considered that each
+Voronoi vertices in red, Voronoi edges in black, input sites that
+correspond to the Voronoi cells in blue (it is considered that each
 input segment consists of three sites: segment itself and two
 endpoints).<br>
       <br>
@@ -126,44 +129,44 @@
       <table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
         <tbody>
           <tr>
- <td style="vertical-align: top;">voronoi_diagram()<br>
+ <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">voronoi_diagram()<br>
             </td>
             <td style="vertical-align: top;">Default constructor.<br>
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top;">void clear()<br>
+ <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">void clear()<br>
             </td>
             <td style="vertical-align: top;">Clears diagram.<br>
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top;">const cell_container_type &amp;cells() const<br>
+ <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">const cell_container_type &amp;cells() const<br>
             </td>
             <td style="vertical-align: top;">Returns const reference to Voronoi cells container.<br>
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top;">const vertex_container_type &amp;vertices() const<br>
+ <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">const vertex_container_type &amp;vertices() const<br>
             </td>
             <td style="vertical-align: top;">Returns const reference to Voronoi vertices container.<br>
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top;">const edge_container_type &amp;edges() const<br>
+ <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">const edge_container_type &amp;edges() const<br>
             </td>
             <td style="vertical-align: top;">Returns const reference to Voronoi edges container.<br>
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top;">unsigned int num_cells() const<br>
+ <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">unsigned int num_cells() const<br>
             </td>
             <td style="vertical-align: top;">Returns number of cells in the Voronoi diagram.<br>
 This value should be the same as the size of cells container.<br>
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top;">unsigned int num_edges() const<br>
+ <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">unsigned int num_edges() const<br>
             </td>
             <td style="vertical-align: top;">Returns number of edges in the Voronoi diagram.<br>
 This value should be twice smaller then the size of edges container.<br>
@@ -171,7 +174,7 @@
             </td>
           </tr>
           <tr>
- <td style="vertical-align: top;">unsigned int num_vertices() const<br>
+ <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">unsigned int num_vertices() const<br>
             </td>
             <td style="vertical-align: top;">Returns number of vertices in the Voronoi diagram.<br>
 This value should be the same as the size of vertices container.<br>
@@ -197,19 +200,19 @@
           <tr>
             <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">voronoi_cell_type *cell()<br>
             </td>
- <td style="vertical-align: top;">Retruns pointer to the voronoi cell that edge belongs to.<br>
+ <td style="vertical-align: top;">Retruns pointer to the Voronoi <span style="font-family: Courier New,Courier,monospace;"></span>cell that edge belongs to.<br>
             </td>
           </tr>
           <tr>
             <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">const voronoi_cell_type *cell() const<br>
             </td>
- <td style="vertical-align: top;">Returns const pointer to the voronoi cell that edge belongs to.<br>
+ <td style="vertical-align: top;">Returns const pointer to the Voronoi cell that edge belongs to.<br>
             </td>
           </tr>
           <tr>
             <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">void cell(voronoi_cell_type *c)<br>
             </td>
- <td style="vertical-align: top;">Sets voronoi cell pointer for the cell current edge belongs to.<br>
+ <td style="vertical-align: top;">Sets Voronoi cell pointer for the cell current edge belongs to.<br>
             </td>
           </tr>
           <tr>
@@ -273,14 +276,14 @@
           <tr>
             <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">voronoi_edge_type *next()<br>
             </td>
- <td style="vertical-align: top;">Returns pointer to the CCW next edge within the corresponding voronoi cell.<br>
+ <td style="vertical-align: top;">Returns pointer to the CCW next edge within the corresponding Voronoi cell.<br>
 Edges not necessarily share a common vertex.<br>
             </td>
           </tr>
           <tr>
             <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">const voronoi_edge_type *next() const<br>
             </td>
- <td style="vertical-align: top;">Returns const pointer to the CCW next edge within the corresponding voronoi cell.<br>
+ <td style="vertical-align: top;">Returns const pointer to the CCW next edge within the corresponding Voronoi cell.<br>
 Edges not necessarily share a common vertex.<br>
             </td>
           </tr>
@@ -293,14 +296,14 @@
           <tr>
             <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">voronoi_edge_type *prev()<br>
             </td>
- <td style="vertical-align: top;">Returns pointer to the CCW prev edge within the corresponding voronoi cell.<br>
+ <td style="vertical-align: top;">Returns pointer to the CCW prev edge within the corresponding Voronoi cell.<br>
 Edges not necessarily share a common vertex.<br>
             </td>
           </tr>
           <tr>
             <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">const voronoi_edge_type *prev() const<br>
             </td>
- <td style="vertical-align: top;">Returns const pointer to the CCW prev edge within the corresponding voronoi cell.<br>
+ <td style="vertical-align: top;">Returns const pointer to the CCW prev edge within the corresponding Voronoi cell.<br>
 Edges not necessarily share a common vertex.<br>
             </td>
           </tr>
@@ -397,7 +400,7 @@
             <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">voronoi_cell(const point_type &amp;p1,<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; voronoi_edge_type *edge)<br>
             </td>
- <td style="vertical-align: top;">Constructs voronoi cell from the given point site and pointer to the one of boundary edges.<br>
+ <td style="vertical-align: top;">Constructs Voronoi cell from the given point site and pointer to the one of boundary edges.<br>
             </td>
           </tr>
           <tr>
@@ -405,7 +408,7 @@
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const point_type &amp;p2,<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; voronoi_edge_type *edge)<br>
             </td>
- <td style="vertical-align: top;">Constructs voronoi cell from the given segment site and pointer to one of boundary edges.<br>
+ <td style="vertical-align: top;">Constructs Voronoi cell from the given segment site and pointer to one of boundary edges.<br>
             </td>
           </tr>
           <tr>
@@ -473,6 +476,14 @@
       </span>All the above methods have O(1) complexity. The size of
 the Voronoi cell structure is equal to: 2 * sizeof(void *) + 4 *
 sizeof(coordinate_type).<br>
+ <br>
+Following code snipped effectively traverses Voronoi edges around the Voronoi cell:<br>
+ <br>
+ <span style="font-family: Courier New,Courier,monospace;">const voronoi_edge&lt;double&gt; *edge = cell-&gt;incident_edge();</span><br>
+ <span style="font-family: Courier New,Courier,monospace;">do {</span><br style="font-family: Courier New,Courier,monospace;">
+ <span style="font-family: Courier New,Courier,monospace;">&nbsp; edge = edge-&gt;next();</span><br style="font-family: Courier New,Courier,monospace;">
+ <span style="font-family: Courier New,Courier,monospace;">&nbsp; // Do smth. with edge.</span><br style="font-family: Courier New,Courier,monospace;">
+ <span style="font-family: Courier New,Courier,monospace;">} while (edge != cell-&gt;incident_edge());</span><br>
       <h1>Voronoi Vertex</h1>
 Voronoi vertex is represented by a point that corresponds to the vertex
 and a pointer to the incident edge. The declaration and list of member
@@ -487,7 +498,7 @@
           <tr>
             <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">voronoi_vertex(const point_type &amp;vertex, voronoi_edge_type *edge)<br>
             </td>
- <td style="vertical-align: top;">Constructs voronoi vertex that corresponds to the give point and incident edge.<br>
+ <td style="vertical-align: top;">Constructs Voronoi vertex that corresponds to the give point and incident edge.<br>
             </td>
           </tr>
           <tr>
@@ -533,6 +544,18 @@
       <span style="font-family: Courier New,Courier,monospace;"><br>
       </span>All the above methods have O(1) complexity. The size of the Voronoi vertex structure is equal to: 2 * sizeof(void *) + 2 *
 sizeof(coordinate_type).<br>
+ <br>
+Following code snipped effectively traverses Voronoi edges around the Voronoi vertex:<br>
+ <br>
+ <span style="font-family: Courier New,Courier,monospace;">const voronoi_edge&lt;double&gt; *edge = vertex-&gt;incident_edge();</span><br>
+
+ <span style="font-family: Courier New,Courier,monospace;">do {</span><br style="font-family: Courier New,Courier,monospace;">
+
+ <span style="font-family: Courier New,Courier,monospace;">&nbsp; edge = edge-&gt;next();</span><br style="font-family: Courier New,Courier,monospace;">
+
+ <span style="font-family: Courier New,Courier,monospace;">&nbsp; // Do smth. with edge.</span><br style="font-family: Courier New,Courier,monospace;">
+
+ <span style="font-family: Courier New,Courier,monospace;">} while (edge != vertex-&gt;incident_edge());</span><br>
       <h1>Voronoi Diagram Traits<br>
       </h1>
 
@@ -549,7 +572,7 @@
           <tr>
             <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">coordinate_type<br>
             </td>
- <td style="vertical-align: top;">The main coordinate type of the voronoi diagram internal structures.<br>
+ <td style="vertical-align: top;">The main coordinate type of the Voronoi diagram internal structures.<br>
             </td>
           </tr>
           <tr>
@@ -587,7 +610,7 @@
             <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">vertex_equality_predicate_type<br>
             </td>
             <td style="vertical-align: top;">Predicate that returns true if two points are considered to be equal.<br>
-This is used to unite nearby voronoi vertices.<br>
+This is used to unite nearby Voronoi vertices.<br>
             </td>
           </tr>
         </tbody>

Modified: sandbox/gtl/doc/voronoi_main.htm
==============================================================================
--- sandbox/gtl/doc/voronoi_main.htm (original)
+++ sandbox/gtl/doc/voronoi_main.htm 2012-03-23 15:47:23 EDT (Fri, 23 Mar 2012)
@@ -19,6 +19,7 @@
 
 
 
+
 <meta http-equiv="Content-Language" content="en-us">
 <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Contents</title><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body>
 
@@ -133,13 +134,13 @@
 exact, but we developed relative error arithmetic apparatus to identify them and switch to higher precision predicates when required.<br>
       <h1>Precision of output structures<br>
       </h1>
-
 One of the extremely important results of using two types of predicates
 is that library efficiently computes relatively precise coordinates of
-the output geometries. Here we will explain a bit what exactly
+output geometries. Here we will explain a bit what exactly
 "relatively precise" means and how received output may differ from
 theoretically correct one (here and after we assume that output
 coordinate type is IEEE-754 floating-point type).<br>
+<br>
 Voronoi implementation guaranties that relative error of the output
 geometries coordinates is always not higher then 64 machine epsilons (6
 bits of mantissa), while in many cases it is slightly less. That also
@@ -153,7 +154,8 @@
 [2^31 - 2^-16, 2^31 + 2^16]. For output Voronoi vertex with long double
 (64 bit mantissa) x-coordinate equal to 2^31, the absolute error will
 be at most 2^-64 * 2 ^31 * 2^6 = 2^-27 and exact value of x-coordinate
-lies in the range [2^31-2^-27, 2^31+2^-27].<br>
+lies in the range [2^31-2^-27, 2^31+2^-27]. If you'd like to become master of absolute and relative errors try this article.<br>
+<br>
 During finalization step library unites Voronoi vertices whose both
 coordinates are situated within relative error range equal to 128
 machine epsilons and removes any voronoi edges between them. That is
@@ -168,8 +170,7 @@
 and equal to 2^-64 * 2^42 * 2^6 = 2^-18. In the output we are going to
 consider vertices with both coordinates that are within 2^-17 meters (8
 micrometers) distance to be equal. Come on that distance is equal to
-the size of bacteria. Can you even see those? I hope such overview
-convinced most pessimistic readers to give a try to our library.<br>
+the size of bacteria. Can you even see those?<br>
       <h1>Fully functional with segment inputs</h1>
 There are not many implementations of Voronoi diagrams that could
 handle segment inputs, even considering commercial ones. Support of
@@ -180,7 +181,52 @@
 medial axis transform of the arbitrary input geometry. So one may start
 using it for the next generation pattern recognition or computer vision
 project.<br>
- <h1>Basic and advanced usage cases</h1>
+ <h1>Basic and advanced usage cases</h1>The main library header <span style="font-family: Courier New,Courier,monospace;">voronoi.hpp</span> defines following static functions:<br>
+ <br>
+ <table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">template &lt;typename PC, typename VD&gt;<br>
+static inline void construct_voronoi_points(<br>
+&nbsp;&nbsp;&nbsp; const PC &amp;points, VD *output)<br>
+ </td>
+ <td style="vertical-align: top;">Constructs Voronoi diagram of a set of points into the output data structure.<br>
+Coordinates of the input geometries should belong to [-2^31, 2^31-1] integer range.<br>
+PC is a container of points that supports forward iterator.<br>
+ </td>
+ </tr>
+ <tr>
+ <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">template &lt;typename SC, typename VD&gt;<br>
+static inline void construct_voronoi_segments(<br>
+&nbsp;&nbsp;&nbsp; const SC &amp;segments, VD *output)<br>
+ </td>
+ <td style="vertical-align: top;">Constructs Voronoi diagram of a set of segments into the output data structure.<br>
+Coordinates of the input geometries should belong to [-2^31, 2^31-1] integer range.<br>
+SC is a container of segments that supports forward iterator.<br>
+Segment object should provide low(), high() public methods to retrieve endpoints of a segment.<br>
+ </td>
+ </tr>
+ <tr>
+ <td style="vertical-align: top; font-family: Courier New,Courier,monospace;">template &lt;typename PC, typename SC, typename VD&gt;<br>
+static inline void construct_voronoi(<br>
+&nbsp;&nbsp;&nbsp; const PC &amp;points, const SC &amp;segments, VD *output)<br>
+ </td>
+ <td style="vertical-align: top;">Constructs Voronoi diagram of a set of points and segments into the output data structure.<br>
+Coordinates of the input geometries should belong to [-2^31, 2^31-1] integer range.<br>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <br>
+For users that don't want to go into the details of the library this
+means that it's possible to construct Voronoi diagram with the
+following two lines of code:<br>
+ <br>
+ <span style="font-family: Courier New,Courier,monospace;">voronoi_diagram&lt;double&gt; vd;</span><br style="font-family: Courier New,Courier,monospace;">
+ <span style="font-family: Courier New,Courier,monospace;">construct_voronoi(points, segments, vd);</span><br>
+ <br>
+Isn't that simple? The library also provides clear interfaces to associate user data with output geometries, efficiently traverse Voronoi graph and utilities to visualize output primitives (e.g. discretization of parabolic edges, clipping of linear edges). More details on those is covered in the basic Voronoi tutorial.&nbsp; Advanced usage of the library with configuration of the coordinate types is explained in the advanced Voronoi tutorial.<br>
+
       <h1>Extendable for user provided coordinate types</h1>
 Voronoi implementation is coordinate type agnostic. That means that as soon as user provided types satisfy set of Voronoi builder coordinate type traits restrictions
 and implement library required methods no changes are requied neither
@@ -209,12 +255,12 @@
 constructed in O(N) time.</li>
         <li>Dropping restriction on non-intersecting input geometries.<br>
 Note: this means that library will also compute segment intersections if such exist.</li>
- <li>Closer integration with interfaces and functionality of Boost Polygon.<br>
+ <li>Closer integration with interfaces and functionality of Boost Polygon Library.<br>
         </li>
       </ul>
 High-priority tasks to be considered:<br>
       <ul>
- <li>Integration of Voronoi diagram structure with BGL library.</li>
+ <li>Integration of Voronoi diagram structure with BGL (Boost Graph Library).</li>
         <li>Support of other types of distance metrics.</li>
         <li>Construction of constrained Delaunay triangulation.</li>
         <li>Support of circle input geometries.</li>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk