$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: huseyinakcan_at_[hidden]
Date: 2007-07-24 16:14:32
Author: huseyinakcan
Date: 2007-07-24 16:14:31 EDT (Tue, 24 Jul 2007)
New Revision: 7525
URL: http://svn.boost.org/trac/boost/changeset/7525
Log:
documentation for halfedge related free functions
Text files modified: 
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.hpp |   328 +++++++++++++++++++++++++++++++++------ 
   1 files changed, 276 insertions(+), 52 deletions(-)
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.hpp	(original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.hpp	2007-07-24 16:14:31 EDT (Tue, 24 Jul 2007)
@@ -36,15 +36,19 @@
 //  - set_next_at_target: sets 'g' as the halfedge succeeding 'h' 
 //                     around the target vertex of 'h', when halfedges are ordered 
 //                     around a given vertex in clockwise order.
+//  - set_prev_in_facet: sets 'g' as the halfedge preceeding 'h' in 
+//                     the adjacent facet cycle, when facet cycles are oriented in 
+//                     counter-clockwise order.
+//  - set_prev_at_source: sets 'g' as the halfedge preceeding 'h' 
+//                     around the source vertex of 'h', when halfedges are ordered 
+//                     around a given vertex in clockwise order.
+//  - set_prev_at_target: sets 'g' as the halfedge preceeding 'h' 
+//                     around the target vertex of 'h', when halfedges are ordered 
+//                     around a given vertex in clockwise order.
+//  -        add_edge: creates two halfedges and adds them to 'hds' as an opposite
+//                     pair
 //
-//  
-///Definitions
-//------------
-// All next_... and prev_... methods take a forward traversal tag, which defines how the
-// next or previous halfedges are stored in the data structure. Using these tags, all three
-// methods can be called so that the specializations can take care of converting 
-// one access method to another.
-//
+//@SEE_ALSO: {hds_concepts.hpp, container_selectors.hpp, halfedge_selectors.hpp}
 
 #ifndef BOOST_HDSTL_HALFEDGE_FUNCTIONS_HPP
 #define BOOST_HDSTL_HALFEDGE_FUNCTIONS_HPP 1
@@ -59,6 +63,8 @@
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
 typename halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>::halfedge_iterator
 halfedges_begin(halfedge_gen<HalfedgeS,  VertexDescriptor, FacetDescriptor, Config>& hds)
+    // Returns a halfedge iterator to the beginning of the container member of 'hds'. The value type
+    // of the halfedge iterator is a halfedge descriptor.
 {
     typedef typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>
                 ::ContainerGen ContainerGen;
@@ -69,6 +75,9 @@
 typename halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>::halfedge_iterator
 halfedges_end(halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
 {
+    // Returns a halfedge iterator to the end of the container member of 'hds'. The value type
+    // of the halfedge iterator is a halfedge descriptor. Note that 'end' here follows the STL
+    // convention and returns an iterator one past the last element, instead of the last element.
     typedef typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>
                 ::ContainerGen ContainerGen;
     return ContainerGen::container_end(hds.m_container);
@@ -76,14 +85,23 @@
 
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
 typename halfedge_gen<HalfedgeS,  VertexDescriptor, FacetDescriptor, Config>::size_type
+    // Returns the number of halfedges in the 'hds'. Return type is the size type specific to 
+    // the container used, specified in container selectors.
 num_halfedges(halfedge_gen<HalfedgeS,  VertexDescriptor, FacetDescriptor, Config>& hds)
 {
     return hds.m_container.size();
 }
 
 // \cond
+namespace detail {
+
 template<typename HalfedgeS, typename HalfedgeDescriptor>
-struct opposite_function_helper {
+struct opposite_function_helper 
+    // Helper struct for the opposite function. This is
+    // the general case where halfedges are stored in 
+    // any container except a 'vector', so halfedge
+    // descriptors can be used as pointers.
+{
     static
     HalfedgeDescriptor
     opposite(HalfedgeDescriptor h)
@@ -93,7 +111,15 @@
 };
 
 template<typename HalfedgeDescriptor, typename TraversalS>
-struct opposite_function_helper<halfedgeS<vecS,TraversalS>, HalfedgeDescriptor> {
+struct opposite_function_helper<halfedgeS<vecS,TraversalS>, HalfedgeDescriptor> 
+    // This is the specialization of the helper for 'vector'. 
+    // In this case no opposite member is used to access the
+    // opposite halfedge. Halfedges having even numbered descriptors
+    // select the next halfedge in the vector as opposite, and 
+    // halfedges with odd numbered descriptors select the previous
+    // halfedge in the vector as opposite. Note that halfedge
+    // descriptors start from '0'.
+{
     static
     HalfedgeDescriptor
     opposite(HalfedgeDescriptor h)
@@ -101,12 +127,16 @@
         return h^1;
     }
 };
+
+} // end namespace detail
 // \endcond
 
 template <typename HalfedgeS,  typename VertexDescriptor, typename FacetDescriptor, typename Config>
 typename Config::halfedge_descriptor
 opposite(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
          const halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>&)
+    // Return the halfedge descriptor of the opposite of halfedge 'h' in 'hds'. The opposite is
+    // determined based on the helper functions, which are specialized based on container type.
 {
     typedef typename halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config
@@ -114,14 +144,20 @@
     typedef typename halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config
                                  >::halfedge_descriptor halfedge_descriptor;
-    return opposite_function_helper<halfedge_selector,
+    return detail::opposite_function_helper<halfedge_selector,
                                     halfedge_descriptor
                                    >::opposite(h);
 }
 
 // \cond
+namespace detail {
+
 template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag = next_in_facet_tag>
-struct next_in_facet_helper{
+struct next_in_facet_helper
+    // Helper struct for returning next_in_facet link of 'h'. The selection is based on 
+    // the Tag being passed in the function, which in this case is next_in_facet_tag, so
+    // simply return the m_next member of 'h'.
+{
     static
     HalfedgeDescriptor
     next_in_facet(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -132,7 +168,13 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor>
-struct next_in_facet_helper<HalfedgeGen, HalfedgeDescriptor, next_at_source_tag>{
+struct next_in_facet_helper<HalfedgeGen, HalfedgeDescriptor, next_at_source_tag>
+    // Specialization for the next_in_facet helper. In this case the next_in_facet function
+    // is called with an 'hds' which has organized its 'm_next' links as 'next_at_source'.
+    // In this case, the next_in_facet of 'h' is determined by converting 'next_at_source'
+    // links to 'next_in_facet' links. See 'forward_hds_concept.hpp' for more details 
+    // concerning these conversions.
+{
     static
     HalfedgeDescriptor
     next_in_facet(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -145,7 +187,13 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor>
-struct next_in_facet_helper<HalfedgeGen, HalfedgeDescriptor, next_at_target_tag>{
+struct next_in_facet_helper<HalfedgeGen, HalfedgeDescriptor, next_at_target_tag>
+    // Specialization for the next_in_facet helper. In this case the next_in_facet function
+    // is called with an 'hds' which has organized its 'm_next' links as 'next_at_target'.
+    // In this case, the next_in_facet of 'h' is determined by converting 'next_at_target'
+    // links to 'next_in_facet' links. See 'forward_hds_concept.hpp' for more details 
+    // concerning these conversions.
+{
     static
     HalfedgeDescriptor
     next_in_facet(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -158,7 +206,11 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag = next_at_source_tag>
-struct next_at_source_helper{
+struct next_at_source_helper
+    // Helper struct for returning next_in_source link of 'h'. The selection is based on 
+    // the Tag being passed in the function, which in this case is next_in_source_tag, so
+    // simply return the m_next member of 'h'.
+{
     static
     HalfedgeDescriptor
     next_at_source(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -169,7 +221,13 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor>
-struct next_at_source_helper<HalfedgeGen, HalfedgeDescriptor, next_in_facet_tag>{
+struct next_at_source_helper<HalfedgeGen, HalfedgeDescriptor, next_in_facet_tag>
+    // Specialization for the next_at_source helper. In this case the next_at_source function
+    // is called with an 'hds' which has organized its 'm_next' links as 'next_in_facet'.
+    // In this case, the next_at_source of 'h' is determined by converting 'next_in_facet'
+    // links to 'next_at_source' links. See 'forward_hds_concept.hpp' for more details 
+    // concerning these conversions.
+{
     static
     HalfedgeDescriptor
     next_at_source(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -182,7 +240,13 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor>
-struct next_at_source_helper<HalfedgeGen, HalfedgeDescriptor, next_at_target_tag>{
+struct next_at_source_helper<HalfedgeGen, HalfedgeDescriptor, next_at_target_tag>
+    // Specialization for the next_at_source helper. In this case the next_at_source function
+    // is called with an 'hds' which has organized its 'm_next' links as 'next_at_target'.
+    // In this case, the next_at_source of 'h' is determined by converting 'next_at_target'
+    // links to 'next_at_source' links. See 'forward_hds_concept.hpp' for more details 
+    // concerning these conversions.
+{
     static
     HalfedgeDescriptor
     next_at_source(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -197,7 +261,11 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag = next_at_target_tag>
-struct next_at_target_helper{
+struct next_at_target_helper
+    // Helper struct for returning next_at_target link of 'h'. The selection is based on 
+    // the Tag being passed in the function, which in this case is next_at_target_tag, so
+    // simply return the m_next member of 'h'.
+{
     static
     HalfedgeDescriptor
     next_at_target(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -208,7 +276,13 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor>
-struct next_at_target_helper<HalfedgeGen, HalfedgeDescriptor, next_in_facet_tag>{
+struct next_at_target_helper<HalfedgeGen, HalfedgeDescriptor, next_in_facet_tag>
+    // Specialization for the next_at_target helper. In this case the next_at_target function
+    // is called with an 'hds' which has organized its 'm_next' links as 'next_in_facet'.
+    // In this case, the next_at_target of 'h' is determined by converting 'next_in_facet'
+    // links to 'next_at_target' links. See 'forward_hds_concept.hpp' for more details 
+    // concerning these conversions.
+{
     static
     HalfedgeDescriptor
     next_at_target(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -221,7 +295,13 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor>
-struct next_at_target_helper<HalfedgeGen, HalfedgeDescriptor, next_at_source_tag>{
+struct next_at_target_helper<HalfedgeGen, HalfedgeDescriptor, next_at_source_tag>
+    // Specialization for the next_at_target helper. In this case the next_at_target function
+    // is called with an 'hds' which has organized its 'm_next' links as 'next_at_source'.
+    // In this case, the next_at_target of 'h' is determined by converting 'next_at_source'
+    // links to 'next_at_target' links. See 'forward_hds_concept.hpp' for more details 
+    // concerning these conversions.
+{
     static
     HalfedgeDescriptor
     next_at_target(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -234,12 +314,17 @@
                                 , hds));
     }
 };
+
+} // end namespace detail
 // \endcond
 
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
 typename Config::halfedge_descriptor
 next_in_facet(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+    // returns a halfedge descriptor to the halfedge succeeding the given halfedge in the adjacent facet cycle, when
+    // facet cycles are oriented in counter-clockwise order. Uses the 'HalfedgeS::next_tag' to determine
+    // the primary way the next links are set, and does conversion using the helper classes if necessary.
 {
     typedef typename halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config
@@ -247,13 +332,17 @@
     typedef  halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config> halfedgeGen;
 
-    return next_in_facet_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::next_tag>::next_in_facet(h, hds);
+    return detail::next_in_facet_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::next_tag
+                                       >::next_in_facet(h, hds);
 }
 
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
 typename Config::halfedge_descriptor
 next_at_source(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+    // returns a halfedge descriptor to the halfedge succeeding the given halfedge around the source vertex, when
+    // halfedges are ordered around a given vertex in clockwise order. Uses the 'HalfedgeS::next_tag' to determine
+    // the primary way the next links are set, and does conversion using the helper classes if necessary.
 {
     typedef typename halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config
@@ -261,13 +350,17 @@
     typedef  halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config> halfedgeGen;
 
-    return next_at_source_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::next_tag>::next_at_source(h,hds);
+    return detail::next_at_source_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::next_tag
+                                        >::next_at_source(h,hds);
 }
 
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
 typename Config::halfedge_descriptor
 next_at_target(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+    // returns a halfedge descriptor to the halfedge succeeding the given halfedge around the target vertex, when
+    // halfedges are ordered around a given vertex in clockwise order. Uses the 'HalfedgeS::next_tag' to determine
+    // the primary way the next links are set, and does conversion using the helper classes if necessary.
 {
     typedef typename halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config
@@ -275,12 +368,19 @@
     typedef  halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config> halfedgeGen;
 
-    return next_at_target_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::next_tag>::next_at_target(h,hds);
+    return detail::next_at_target_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::next_tag
+                                        >::next_at_target(h,hds);
 }
 
 // \cond
+namespace detail {
+
 template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag = prev_in_facet_tag>
-struct prev_in_facet_helper{
+struct prev_in_facet_helper
+    // Helper struct for returning prev_in_facet link of 'h'. The selection is based on 
+    // the Tag being passed in the function, which in this case is prev_in_facet_tag, so
+    // simply return the m_prev member of 'h'.
+{
     static
     HalfedgeDescriptor
     prev_in_facet(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -291,7 +391,13 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor>
-struct prev_in_facet_helper<HalfedgeGen, HalfedgeDescriptor, prev_at_source_tag>{
+struct prev_in_facet_helper<HalfedgeGen, HalfedgeDescriptor, prev_at_source_tag>
+    // Specialization for the prev_in_facet helper. In this case the prev_in_facet function
+    // is called with an 'hds' which has organized its 'm_prev' links as 'prev_at_source'.
+    // In this case, the prev_in_facet of 'h' is determined by converting 'prev_at_source'
+    // links to 'prev_in_facet' links. See 'backward_hds_concept.hpp' for more details 
+    // concerning these conversions.
+{
     static
     HalfedgeDescriptor
     prev_in_facet(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -304,7 +410,13 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor>
-struct prev_in_facet_helper<HalfedgeGen, HalfedgeDescriptor, prev_at_target_tag>{
+struct prev_in_facet_helper<HalfedgeGen, HalfedgeDescriptor, prev_at_target_tag>
+    // Specialization for the prev_in_facet helper. In this case the prev_in_facet function
+    // is called with an 'hds' which has organized its 'm_prev' links as 'prev_at_target'.
+    // In this case, the prev_in_facet of 'h' is determined by converting 'prev_at_target'
+    // links to 'prev_in_facet' links. See 'backward_hds_concept.hpp' for more details 
+    // concerning these conversions.
+{
     static
     HalfedgeDescriptor
     prev_in_facet(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -317,7 +429,11 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag = prev_at_source_tag>
-struct prev_at_source_helper{
+struct prev_at_source_helper
+    // Helper struct for returning prev_in_source link of 'h'. The selection is based on 
+    // the Tag being passed in the function, which in this case is prev_in_source_tag, so
+    // simply return the m_prev member of 'h'.
+{
     static
     HalfedgeDescriptor
     prev_at_source(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -328,7 +444,13 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor>
-struct prev_at_source_helper<HalfedgeGen, HalfedgeDescriptor, prev_in_facet_tag>{
+struct prev_at_source_helper<HalfedgeGen, HalfedgeDescriptor, prev_in_facet_tag>
+    // Specialization for the prev_in_source helper. In this case the prev_in_source function
+    // is called with an 'hds' which has organized its 'm_prev' links as 'prev_at_facet'.
+    // In this case, the prev_in_source of 'h' is determined by converting 'prev_at_facet'
+    // links to 'prev_in_source' links. See 'backward_hds_concept.hpp' for more details 
+    // concerning these conversions.
+{
     static
     HalfedgeDescriptor
     prev_at_source(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -341,7 +463,13 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor>
-struct prev_at_source_helper<HalfedgeGen, HalfedgeDescriptor, prev_at_target_tag>{
+struct prev_at_source_helper<HalfedgeGen, HalfedgeDescriptor, prev_at_target_tag>
+    // Specialization for the prev_in_source helper. In this case the prev_in_source function
+    // is called with an 'hds' which has organized its 'm_prev' links as 'prev_at_target'.
+    // In this case, the prev_in_source of 'h' is determined by converting 'prev_at_target'
+    // links to 'prev_in_source' links. See 'backward_hds_concept.hpp' for more details 
+    // concerning these conversions.
+{
     static
     HalfedgeDescriptor
     prev_at_source(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -356,7 +484,11 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag = prev_at_target_tag>
-struct prev_at_target_helper{
+struct prev_at_target_helper
+    // Helper struct for returning prev_in_target link of 'h'. The selection is based on 
+    // the Tag being passed in the function, which in this case is prev_in_target_tag, so
+    // simply return the m_prev member of 'h'.
+{
     static
     HalfedgeDescriptor
     prev_at_target(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -367,7 +499,13 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor>
-struct prev_at_target_helper<HalfedgeGen, HalfedgeDescriptor, prev_in_facet_tag>{
+struct prev_at_target_helper<HalfedgeGen, HalfedgeDescriptor, prev_in_facet_tag>
+    // Specialization for the prev_in_target helper. In this case the prev_in_target function
+    // is called with an 'hds' which has organized its 'm_prev' links as 'prev_at_facet'.
+    // In this case, the prev_in_target of 'h' is determined by converting 'prev_at_facet'
+    // links to 'prev_in_target' links. See 'backward_hds_concept.hpp' for more details 
+    // concerning these conversions.
+{
     static
     HalfedgeDescriptor
     prev_at_target(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -380,7 +518,13 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor>
-struct prev_at_target_helper<HalfedgeGen, HalfedgeDescriptor, prev_at_source_tag>{
+struct prev_at_target_helper<HalfedgeGen, HalfedgeDescriptor, prev_at_source_tag>
+    // Specialization for the prev_in_target helper. In this case the prev_in_target function
+    // is called with an 'hds' which has organized its 'm_prev' links as 'prev_at_source'.
+    // In this case, the prev_in_target of 'h' is determined by converting 'prev_at_source'
+    // links to 'prev_in_target' links. See 'backward_hds_concept.hpp' for more details 
+    // concerning these conversions.
+{
     static
     HalfedgeDescriptor
     prev_at_target(HalfedgeDescriptor h, HalfedgeGen& hds)
@@ -393,12 +537,17 @@
                                 , hds));
     }
 };
+
+} // end namespace detail
 // \endcond
 
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
 typename Config::halfedge_descriptor
 prev_in_facet(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+    // returns a halfedge descriptor to the halfedge preceeding the given halfedge in the adjacent facet cycle, when
+    // facet cycles are oriented in counter-clockwise order. Uses the 'HalfedgeS::prev_tag' to determine
+    // the primary way the prev links are set, and does conversion using the helper classes if necessary.
 {
     typedef typename halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config
@@ -406,13 +555,17 @@
     typedef  halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config> halfedgeGen;
 
-    return prev_in_facet_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::prev_tag>::prev_in_facet(h, hds);
+    return detail::prev_in_facet_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::prev_tag
+                                       >::prev_in_facet(h, hds);
 }
 
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
 typename Config::halfedge_descriptor
 prev_at_source(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+    // returns a halfedge descriptor to the halfedge preceeding the given halfedge around the source vertex, when
+    // halfedges are ordered around a given vertex in clockwise order. Uses the 'HalfedgeS::prev_tag' to determine
+    // the primary way the prev links are set, and does conversion using the helper classes if necessary.
 {
     typedef typename halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config
@@ -420,13 +573,17 @@
     typedef  halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config> halfedgeGen;
 
-    return prev_at_source_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::prev_tag>::prev_at_source(h,hds);
+    return detail::prev_at_source_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::prev_tag
+                                        >::prev_at_source(h,hds);
 }
 
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
 typename Config::halfedge_descriptor
 prev_at_target(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+    // returns a halfedge descriptor to the halfedge preceeding the given halfedge around the target vertex, when
+    // halfedges are ordered around a given vertex in clockwise order. Uses the 'HalfedgeS::prev_tag' to determine
+    // the primary way the prev links are set, and does conversion using the helper classes if necessary.
 {
     typedef typename halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config
@@ -434,16 +591,25 @@
     typedef  halfedge_gen<HalfedgeS, 
                                   VertexDescriptor,FacetDescriptor, Config> halfedgeGen;
 
-    return prev_at_target_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::prev_tag>::prev_at_target(h,hds);
+    return detail::prev_at_target_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::prev_tag
+                                        >::prev_at_target(h,hds);
 }
 
 // \cond
+namespace detail {
+
 template<typename HalfedgeGen, typename HalfedgeDescriptor, typename ContainerS, typename ThisTag, typename Tag>
-struct set_next_helper{
+struct set_next_helper
+    // Helper struct to set the next link. In this case the 'ThisTag' which represents how the next 
+    // links are assigned in the 'hds', and 'Tag' which represents what modifier method is called, do not
+    // match, so a compile time error should follow. E.g. if the data structure points to next halfedge in the facet
+    // cycle as the prefered next member, trying to modify the dataset with 'set_next_at_source' or 
+    // 'set_next_at_target' methods should cause an error.
+{
     static void
     set_next(HalfedgeDescriptor h, HalfedgeDescriptor g, HalfedgeGen& hds)
     {
-        // This Tag and Tag do not match, 
+        // ThisTag and Tag do not match, 
         // What you are trying to do is  setting the next tag 
         // with a different function than it is supposed to 
         // be used.
@@ -452,7 +618,9 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag>
-struct set_next_helper<HalfedgeGen, HalfedgeDescriptor, vecS, Tag, Tag>{
+struct set_next_helper<HalfedgeGen, HalfedgeDescriptor, vecS, Tag, Tag>
+    // Helper struct to set the next link. This is a specialization for the vector. 
+{
     static void
     set_next(HalfedgeDescriptor h, HalfedgeDescriptor g, HalfedgeGen& hds)
     {
@@ -461,7 +629,9 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor, typename ContainerS, typename Tag>
-struct set_next_helper<HalfedgeGen, HalfedgeDescriptor, ContainerS, Tag, Tag>{
+struct set_next_helper<HalfedgeGen, HalfedgeDescriptor, ContainerS, Tag, Tag>
+    // Helper struct to set the next link. This is a specialization for the containers other than the vector. 
+{
     static void
     set_next(HalfedgeDescriptor h, HalfedgeDescriptor g, HalfedgeGen& hds)
     {
@@ -469,6 +639,8 @@
         h->m_next = g;
     }
 };
+
+} // end namespace detail
 // \endcond
 
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
@@ -476,6 +648,10 @@
 set_next_in_facet(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                   typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor g,
                   halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+    // sets 'g' as the halfedge succeeding 'h' in the adjacent facet cycle, when facet cycles are oriented in
+    // counter-clockwise order. The helper functions do selections based on containerS and the 'Halfedge::next_tag'.
+    // Also the 'this_tag' and the 'Halfedge::next_tag' should match for properly setting the next link. Otherwise
+    // compile time error will follow.
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -486,7 +662,7 @@
 
     typedef next_in_facet_tag this_tag;
 
-    set_next_helper<halfedgeGen, halfedge_descriptor, containerS, this_tag, typename HalfedgeS::next_tag>
+    detail::set_next_helper<halfedgeGen, halfedge_descriptor, containerS, this_tag, typename HalfedgeS::next_tag>
                     ::set_next(h, g, hds);
 }
 
@@ -495,6 +671,10 @@
 set_next_at_source(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                   typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor g,
                   halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+    // sets 'g' as the halfedge succeeding 'h' around the source vertex of 'h', when halfedges are ordered around a
+    // given vertex in clockwise order. The helper functions do selections based on containerS and the
+    // 'Halfedge::next_tag'.  Also the 'this_tag' and the 'Halfedge::next_tag' should match for properly setting the
+    // next link. Otherwise compile time error will follow.
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -505,7 +685,7 @@
 
     typedef next_at_source_tag this_tag;
 
-    set_next_helper<halfedgeGen, halfedge_descriptor, containerS, this_tag, typename HalfedgeS::next_tag>
+    detail::set_next_helper<halfedgeGen, halfedge_descriptor, containerS, this_tag, typename HalfedgeS::next_tag>
                     ::set_next(h, g, hds);
 }
 
@@ -514,6 +694,10 @@
 set_next_at_target(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                   typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor g,
                   halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+    // sets 'g' as the halfedge succeeding 'h' around the target vertex of 'h', when halfedges are ordered around a
+    // given vertex in clockwise order. The helper functions do selections based on containerS and the
+    // 'Halfedge::next_tag'.  Also the 'this_tag' and the 'Halfedge::next_tag' should match for properly setting the
+    // next link. Otherwise compile time error will follow.
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -524,17 +708,25 @@
 
     typedef next_at_target_tag this_tag;
 
-    set_next_helper<halfedgeGen, halfedge_descriptor, containerS, this_tag, typename HalfedgeS::next_tag>
+    detail::set_next_helper<halfedgeGen, halfedge_descriptor, containerS, this_tag, typename HalfedgeS::next_tag>
                     ::set_next(h, g, hds);
 }
 
 // \cond
+namespace detail {
+
 template<typename HalfedgeGen, typename HalfedgeDescriptor, typename ContainerS, typename ThisTag, typename Tag>
-struct set_prev_helper{
+struct set_prev_helper
+    // Helper struct to set the prev link. In this case the 'ThisTag' which represents how the prev 
+    // links are assigned in the 'hds', and 'Tag' which represents what modifier method is called, do not
+    // match, so a compile time error should follow. E.g. if the data structure points to prev halfedge in the facet
+    // cycle as the prefered prev member, trying to modify the dataset with 'set_prev_at_source' or 
+    // 'set_prev_at_target' methods should cause an error.
+{
     static void
     set_prev(HalfedgeDescriptor h, HalfedgeDescriptor g, HalfedgeGen& hds)
     {
-        // This Tag and Tag do not match, 
+        // ThisTag and Tag do not match, 
         // What you are trying to do is  setting the prev tag 
         // with a different function than it is supposed to 
         // be used.
@@ -543,7 +735,9 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag>
-struct set_prev_helper<HalfedgeGen, HalfedgeDescriptor, vecS, Tag, Tag>{
+struct set_prev_helper<HalfedgeGen, HalfedgeDescriptor, vecS, Tag, Tag>
+    // Helper struct to set the prev link. This is a specialization for the vector. 
+{
     static void
     set_prev(HalfedgeDescriptor h, HalfedgeDescriptor g, HalfedgeGen& hds)
     {
@@ -552,7 +746,9 @@
 };
 
 template<typename HalfedgeGen, typename HalfedgeDescriptor, typename ContainerS, typename Tag>
-struct set_prev_helper<HalfedgeGen, HalfedgeDescriptor, ContainerS, Tag, Tag>{
+struct set_prev_helper<HalfedgeGen, HalfedgeDescriptor, ContainerS, Tag, Tag>
+    // Helper struct to set the prev link. This is a specialization for the containers other than the vector. 
+{
     static void
     set_prev(HalfedgeDescriptor h, HalfedgeDescriptor g, HalfedgeGen& hds)
     {
@@ -560,6 +756,8 @@
         h->m_prev = g;
     }
 };
+
+} // end namespace detail
 // \endcond
 
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
@@ -567,6 +765,10 @@
 set_prev_in_facet(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                   typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor g,
                   halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+    // sets 'g' as the halfedge preceeding 'h' in the adjacent facet cycle, when facet cycles are oriented in
+    // counter-clockwise order. The helper functions do selections based on containerS and the 'Halfedge::prev_tag'.
+    // Also the 'this_tag' and the 'Halfedge::prev_tag' should match for properly setting the prev link. Otherwise
+    // compile time error will follow.
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -577,7 +779,7 @@
 
     typedef prev_in_facet_tag this_tag;
 
-    set_prev_helper<halfedgeGen, halfedge_descriptor, containerS, this_tag, typename HalfedgeS::prev_tag>
+    detail::set_prev_helper<halfedgeGen, halfedge_descriptor, containerS, this_tag, typename HalfedgeS::prev_tag>
                     ::set_prev(h, g, hds);
 }
 
@@ -586,6 +788,10 @@
 set_prev_at_source(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                   typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor g,
                   halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+    // sets 'g' as the halfedge preceeding 'h' around the source vertex of 'h', when halfedges are ordered around a
+    // given vertex in clockwise order. The helper functions do selections based on containerS and the
+    // 'Halfedge::prev_tag'.  Also the 'this_tag' and the 'Halfedge::prev_tag' should match for properly setting the
+    // prev link. Otherwise compile time error will follow.
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -596,7 +802,7 @@
 
     typedef prev_at_source_tag this_tag;
 
-    set_prev_helper<halfedgeGen, halfedge_descriptor, containerS, this_tag, typename HalfedgeS::prev_tag>
+    detail::set_prev_helper<halfedgeGen, halfedge_descriptor, containerS, this_tag, typename HalfedgeS::prev_tag>
                     ::set_prev(h, g, hds);
 }
 
@@ -605,6 +811,10 @@
 set_prev_at_target(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                   typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor g,
                   halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+    // sets 'g' as the halfedge preceeding 'h' around the target vertex of 'h', when halfedges are ordered around a
+    // given vertex in clockwise order. The helper functions do selections based on containerS and the
+    // 'Halfedge::prev_tag'.  Also the 'this_tag' and the 'Halfedge::prev_tag' should match for properly setting the
+    // prev link. Otherwise compile time error will follow.
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -615,13 +825,18 @@
 
     typedef prev_at_target_tag this_tag;
 
-    set_prev_helper<halfedgeGen, halfedge_descriptor, containerS, this_tag, typename HalfedgeS::prev_tag>
+    detail::set_prev_helper<halfedgeGen, halfedge_descriptor, containerS, this_tag, typename HalfedgeS::prev_tag>
                     ::set_prev(h, g, hds);
 }
 
 // \cond
+namespace detail {
+
 template<typename HalfedgeDescriptor, typename ContainerS>
-struct set_opposite_pair_helper{
+struct set_opposite_pair_helper
+   // Helper struct for setting two halfedges opposites of each other.
+   // In this case, any container but vector.
+{
     static void
     set_opposite(HalfedgeDescriptor& h, HalfedgeDescriptor& g)
     {
@@ -631,18 +846,27 @@
 };
 
 template<typename HalfedgeDescriptor>
-struct set_opposite_pair_helper<HalfedgeDescriptor, vecS> {
+struct set_opposite_pair_helper<HalfedgeDescriptor, vecS> 
+   // Helper struct for setting two halfedges opposites of each other.
+   // In this case vector as the container in which no opposite 
+   // pointers are used so nothing further to do.
+{
     static void
     set_opposite(HalfedgeDescriptor& , HalfedgeDescriptor&) 
     {
         // nothing to do
     }
 };
+
+} // end namespace detail
 // \endcond
 
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
 typename Config::halfedge_descriptor
 new_edge(halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+    // Create two halfedges, add them to 'hds' and set them opposites of each other.
+    // Return one of these halfedge descriptors. This method enforces halfedges created
+    // in pairs.
 {
     typedef halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config> halfedgeGen;
     typedef typename halfedgeGen::halfedge_descriptor halfedge_descriptor;
@@ -655,7 +879,7 @@
     halfedge_type half_g;
     halfedge_descriptor h = *ContainerGen::container_add(half_h, hds.m_container);
     halfedge_descriptor g = *ContainerGen::container_add(half_g, hds.m_container);
-    set_opposite_pair_helper<halfedge_descriptor, containerS>::set_opposite(h,g);
+    detail::set_opposite_pair_helper<halfedge_descriptor, containerS>::set_opposite(h,g);
     return g;
 }