Boost logo

Boost-Commit :

From: huseyinakcan_at_[hidden]
Date: 2007-07-22 13:54:12


Author: huseyinakcan
Date: 2007-07-22 13:54:11 EDT (Sun, 22 Jul 2007)
New Revision: 7502
URL: http://svn.boost.org/trac/boost/changeset/7502

Log:
halfedge next_... functions and the tests

Text files modified:
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.hpp | 319 +++++++++++++++++++++++++++++++++++++++
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.t.cpp | 311 ++++++++++++++++++++++++++++++++++++++
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_selectors.hpp | 2
   3 files changed, 623 insertions(+), 9 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-22 13:54:11 EDT (Sun, 22 Jul 2007)
@@ -6,13 +6,40 @@
 // manipulating halfedges. The list of these functions are as follows:
 //
 // - halfedges_begin: returns an iterator to the first halfedge in the 'hds'
-// - halfedges_end: returns an iterator after the last halfedge in the 'hds'
-// - num_halfedges: returns the number of halfedges in the 'hds'
+// - halfedges_end: returns an iterator after the last halfedge in the 'hds'
+// - num_halfedges: returns the number of halfedges in the 'hds'
+// - opposite: returns the opposite of the given halfedge in the 'hds'
+// - next_in_facet: 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.
+// - next_at_source: 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
+// - next_at_target: 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
+// - prev_in_facet: 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.
+// - prev_at_source: 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
+// - prev_at_target: 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
+//
+///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.
 //
 
 #ifndef BOOST_HDSTL_HALFEDGE_FUNCTIONS_HPP
 #define BOOST_HDSTL_HALFEDGE_FUNCTIONS_HPP 1
 
+#include <boost/hdstl/hds_traits.hpp>
 #include <boost/hdstl/halfedge_ds/halfedge_selectors.hpp>
 
 namespace boost {
@@ -66,8 +93,7 @@
 };
 // \endcond
 
-template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor,
- typename Config>
+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>&)
@@ -83,6 +109,291 @@
>::opposite(h);
 }
 
+template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag = next_in_facet_tag>
+struct next_in_facet_helper{
+ static
+ HalfedgeDescriptor
+ next_in_facet(HalfedgeDescriptor h, HalfedgeGen& hds)
+ {
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(containerGen::value(h,hds.m_container).m_next);
+ }
+};
+
+template<typename HalfedgeGen, typename HalfedgeDescriptor>
+struct next_in_facet_helper<HalfedgeGen, HalfedgeDescriptor, next_at_source_tag>{
+ static
+ HalfedgeDescriptor
+ next_in_facet(HalfedgeDescriptor h, HalfedgeGen& hds)
+ {
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(containerGen::value(
+ static_cast<HalfedgeDescriptor>(opposite(h, hds))
+ ,hds.m_container).m_next);
+ }
+};
+
+template<typename HalfedgeGen, typename HalfedgeDescriptor>
+struct next_in_facet_helper<HalfedgeGen, HalfedgeDescriptor, next_at_target_tag>{
+ static
+ HalfedgeDescriptor
+ next_in_facet(HalfedgeDescriptor h, HalfedgeGen& hds)
+ {
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(opposite(
+ static_cast<HalfedgeDescriptor>(containerGen::value(h,hds.m_container).m_next)
+ , hds));
+ }
+};
+
+template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag = next_at_source_tag>
+struct next_at_source_helper{
+ static
+ HalfedgeDescriptor
+ next_at_source(HalfedgeDescriptor h, HalfedgeGen& hds)
+ {
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(containerGen::value(h,hds.m_container).m_next);
+ }
+};
+
+template<typename HalfedgeGen, typename HalfedgeDescriptor>
+struct next_at_source_helper<HalfedgeGen, HalfedgeDescriptor, next_in_facet_tag>{
+ static
+ HalfedgeDescriptor
+ next_at_source(HalfedgeDescriptor h, HalfedgeGen& hds)
+ {
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(containerGen::value(
+ static_cast<HalfedgeDescriptor>(opposite(h, hds))
+ ,hds.m_container).m_next);
+ }
+};
+
+template<typename HalfedgeGen, typename HalfedgeDescriptor>
+struct next_at_source_helper<HalfedgeGen, HalfedgeDescriptor, next_at_target_tag>{
+ static
+ HalfedgeDescriptor
+ next_at_source(HalfedgeDescriptor h, HalfedgeGen& hds)
+ {
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(opposite(
+ static_cast<HalfedgeDescriptor>(containerGen::value(
+ static_cast<HalfedgeDescriptor>(opposite(h, hds))
+ ,hds.m_container).m_next)
+ , hds));
+ }
+};
+
+template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag = next_at_target_tag>
+struct next_at_target_helper{
+ static
+ HalfedgeDescriptor
+ next_at_target(HalfedgeDescriptor h, HalfedgeGen& hds)
+ {
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(containerGen::value(h,hds.m_container).m_next);
+ }
+};
+
+template<typename HalfedgeGen, typename HalfedgeDescriptor>
+struct next_at_target_helper<HalfedgeGen, HalfedgeDescriptor, next_in_facet_tag>{
+ static
+ HalfedgeDescriptor
+ next_at_target(HalfedgeDescriptor h, HalfedgeGen& hds)
+ {
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(opposite(
+ static_cast<HalfedgeDescriptor>(containerGen::value(h,hds.m_container).m_next)
+ , hds));
+ }
+};
+
+template<typename HalfedgeGen, typename HalfedgeDescriptor>
+struct next_at_target_helper<HalfedgeGen, HalfedgeDescriptor, next_at_source_tag>{
+ static
+ HalfedgeDescriptor
+ next_at_target(HalfedgeDescriptor h, HalfedgeGen& hds)
+ {
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(opposite(
+ static_cast<HalfedgeDescriptor>(containerGen::value(
+ static_cast<HalfedgeDescriptor>(opposite(h, hds))
+ ,hds.m_container).m_next)
+ , hds));
+ }
+};
+
+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)
+{
+ typedef typename halfedge_gen<HalfedgeS,
+ VertexDescriptor,FacetDescriptor, Config
+ >::halfedge_descriptor halfedge_descriptor;
+ 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);
+}
+
+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)
+{
+ typedef typename halfedge_gen<HalfedgeS,
+ VertexDescriptor,FacetDescriptor, Config
+ >::halfedge_descriptor halfedge_descriptor;
+ 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);
+}
+
+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)
+{
+ typedef typename halfedge_gen<HalfedgeS,
+ VertexDescriptor,FacetDescriptor, Config
+ >::halfedge_descriptor halfedge_descriptor;
+ 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);
+}
+
+template<typename HalfedgeDescriptor, typename Tag = prev_in_facet_tag>
+struct prev_in_facet_helper{
+ static
+ HalfedgeDescriptor
+ prev_in_facet(HalfedgeDescriptor h)
+ {
+ return static_cast<HalfedgeDescriptor>(h->m_prev);
+ }
+};
+
+template<typename HalfedgeDescriptor>
+struct prev_in_facet_helper<HalfedgeDescriptor, prev_at_source_tag>{
+ static
+ HalfedgeDescriptor
+ prev_in_facet(HalfedgeDescriptor h)
+ {
+ return static_cast<HalfedgeDescriptor>(static_cast<HalfedgeDescriptor>(h->m_prev)->m_opposite);
+ }
+};
+
+template<typename HalfedgeDescriptor>
+struct prev_in_facet_helper<HalfedgeDescriptor, prev_at_target_tag>{
+ static
+ HalfedgeDescriptor
+ prev_in_facet(HalfedgeDescriptor h)
+ {
+ return static_cast<HalfedgeDescriptor>(static_cast<HalfedgeDescriptor>(h->m_opposite)->m_prev);
+ }
+};
+
+template<typename HalfedgeDescriptor, typename Tag = prev_at_source_tag>
+struct prev_at_source_helper{
+ static
+ HalfedgeDescriptor
+ prev_at_source(HalfedgeDescriptor h)
+ {
+ return static_cast<HalfedgeDescriptor>(h->m_prev);
+ }
+};
+
+template<typename HalfedgeDescriptor>
+struct prev_at_source_helper<HalfedgeDescriptor, prev_in_facet_tag>{
+ static
+ HalfedgeDescriptor
+ prev_at_source(HalfedgeDescriptor h)
+ {
+ return static_cast<HalfedgeDescriptor>(static_cast<HalfedgeDescriptor>(h->m_prev)->m_opposite);
+ }
+};
+
+template<typename HalfedgeDescriptor>
+struct prev_at_source_helper<HalfedgeDescriptor, prev_at_target_tag>{
+ static
+ HalfedgeDescriptor
+ prev_at_source(HalfedgeDescriptor h)
+ {
+ return static_cast<HalfedgeDescriptor>(
+ static_cast<HalfedgeDescriptor>(
+ static_cast<HalfedgeDescriptor>(h->m_opposite)->m_prev)->m_opposite);
+ }
+};
+
+template<typename HalfedgeDescriptor, typename Tag = prev_at_target_tag>
+struct prev_at_target_helper{
+ static
+ HalfedgeDescriptor
+ prev_at_target(HalfedgeDescriptor h)
+ {
+ return static_cast<HalfedgeDescriptor>(h->m_prev);
+ }
+};
+
+template<typename HalfedgeDescriptor>
+struct prev_at_target_helper<HalfedgeDescriptor, prev_in_facet_tag>{
+ static
+ HalfedgeDescriptor
+ prev_at_target(HalfedgeDescriptor h)
+ {
+ return static_cast<HalfedgeDescriptor>(static_cast<HalfedgeDescriptor>(h->m_opposite)->m_prev);
+ }
+};
+
+template<typename HalfedgeDescriptor>
+struct prev_at_target_helper<HalfedgeDescriptor, prev_at_source_tag>{
+ static
+ HalfedgeDescriptor
+ prev_at_target(HalfedgeDescriptor h)
+ {
+ return static_cast<HalfedgeDescriptor>(
+ static_cast<HalfedgeDescriptor>(
+ static_cast<HalfedgeDescriptor>(h->m_opposite)->m_prev)->m_opposite);
+ }
+};
+
+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>&)
+{
+ typedef typename halfedge_gen<HalfedgeS,
+ VertexDescriptor,FacetDescriptor, Config
+ >::halfedge_descriptor halfedge_descriptor;
+ return prev_in_facet_helper<halfedge_descriptor, typename HalfedgeS::prev_tag>::prev_in_facet(h);
+}
+
+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>&)
+{
+ typedef typename halfedge_gen<HalfedgeS,
+ VertexDescriptor,FacetDescriptor, Config
+ >::halfedge_descriptor halfedge_descriptor;
+ return prev_at_source_helper<halfedge_descriptor, typename HalfedgeS::prev_tag>::prev_at_source(h);
+}
+
+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>&)
+{
+ typedef typename halfedge_gen<HalfedgeS,
+ VertexDescriptor,FacetDescriptor, Config
+ >::halfedge_descriptor halfedge_descriptor;
+ return prev_at_target_helper<halfedge_descriptor, typename HalfedgeS::prev_tag>::prev_at_target(h);
+}
+
+
 } // namespace hdstl
 } // namespace boost
 

Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.t.cpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.t.cpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.t.cpp 2007-07-22 13:54:11 EDT (Sun, 22 Jul 2007)
@@ -107,6 +107,266 @@
     // nothing to do
 }
 
+template <typename HalfedgeGen, typename HalfedgeDescriptor, typename ContainerS>
+void set_next_helper(HalfedgeGen& H, HalfedgeDescriptor h, HalfedgeDescriptor g, ContainerS const&) {
+ (void) H;
+ h->m_next = g;
+}
+
+template <typename HalfedgeGen,typename HalfedgeDescriptor>
+void set_next_helper(HalfedgeGen& H, HalfedgeDescriptor h, HalfedgeDescriptor g, vecS const&) {
+ H.m_container[h].m_next = g;
+}
+
+template <typename HalfedgeGen>
+bool halfedge_next_in_facet_test() {
+
+ // Types must exist.
+ typedef typename HalfedgeGen::halfedge_selector halfedge_selector;
+ typedef typename HalfedgeGen::halfedge_descriptor halfedge_descriptor;
+ typedef typename HalfedgeGen::halfedge_iterator halfedge_iterator;
+ typedef typename HalfedgeGen::halfedge_type halfedge_type;
+ typedef typename HalfedgeGen::ContainerGen container_gen;
+ typedef typename HalfedgeGen::ContainerGen::selector container_selector;
+ typedef typename HalfedgeGen::container_type container_type;
+
+ halfedge_type fa;
+ halfedge_type fb;
+ halfedge_type fc;
+ halfedge_type fd;
+ halfedge_type fe;
+ halfedge_type ff;
+ halfedge_type fg;
+ halfedge_type fh;
+ halfedge_type fi;
+ halfedge_type fj;
+ halfedge_type array[] = { fa, fb, fc, fd, fe, ff, fg, fh, fi, fj};
+
+ // Construct a halfedge_gen object whose container contains array. Verify
+ // that halfedges_begin(), halfedges_end(), and num_halfedges() work.
+
+ container_type halfedges(array, array+10);
+ HalfedgeGen halfedgeGen;
+ halfedgeGen.m_container = halfedges;
+
+ {
+ typename container_type::iterator begin = halfedgeGen.m_container.begin();
+ halfedge_type& ha = *begin;
+ halfedge_type& hb = *(++begin);
+ halfedge_type& hc = *(++begin);
+ halfedge_type& hd = *(++begin);
+ halfedge_type& he = *(++begin);
+ halfedge_type& hf = *(++begin);
+ halfedge_type& hg = *(++begin);
+ halfedge_type& hh = *(++begin);
+ halfedge_type& hi = *(++begin);
+ halfedge_type& hj = *(++begin);
+ set_opposite_helper(ha, &hb, container_selector());
+ set_opposite_helper(hb, &ha, container_selector());
+ set_opposite_helper(hc, &hd, container_selector());
+ set_opposite_helper(hd, &hc, container_selector());
+ set_opposite_helper(he, &hf, container_selector());
+ set_opposite_helper(hf, &he, container_selector());
+ set_opposite_helper(hg, &hh, container_selector());
+ set_opposite_helper(hh, &hg, container_selector());
+ set_opposite_helper(hi, &hj, container_selector());
+ set_opposite_helper(hj, &hi, container_selector());
+ }
+
+ halfedge_iterator begin = halfedges_begin(halfedgeGen);
+ halfedge_descriptor ha = *begin;
+ halfedge_descriptor hb = *(++begin);
+ halfedge_descriptor hc = *(++begin);
+ halfedge_descriptor hd = *(++begin);
+ halfedge_descriptor he = *(++begin);
+ halfedge_descriptor hf = *(++begin);
+ halfedge_descriptor hg = *(++begin);
+ halfedge_descriptor hh = *(++begin);
+ halfedge_descriptor hi = *(++begin);
+ halfedge_descriptor hj = *(++begin);
+ set_next_helper(halfedgeGen, ha, hc, container_selector());
+ set_next_helper(halfedgeGen, hc, he, container_selector());
+ set_next_helper(halfedgeGen, hj, hd, container_selector());
+ set_next_helper(halfedgeGen, hd, hg, container_selector());
+ set_next_helper(halfedgeGen, hh, hb, container_selector());
+ set_next_helper(halfedgeGen, hf, hi, container_selector());
+ BOOST_CHECK(( next_in_facet(hc, halfedgeGen) == he));
+ BOOST_CHECK(( next_at_source(hc, halfedgeGen) == hg));
+ BOOST_CHECK(( next_at_target(hc, halfedgeGen) == hf));
+ //BOOST_CHECK(( prev_in_facet(hc, halfedgeGen) == ha));
+ //BOOST_CHECK(( prev_at_source<next_in_facet_tag>(hc, halfedgeGen) == hg));
+ //BOOST_CHECK(( prev_at_target<next_in_facet_tag>(hc, halfedgeGen) == hf));
+
+ return true;
+}
+
+template <typename HalfedgeGen>
+bool halfedge_next_at_source_test() {
+
+ // Types must exist.
+ typedef typename HalfedgeGen::halfedge_selector halfedge_selector;
+ typedef typename HalfedgeGen::halfedge_descriptor halfedge_descriptor;
+ typedef typename HalfedgeGen::halfedge_iterator halfedge_iterator;
+ typedef typename HalfedgeGen::halfedge_type halfedge_type;
+ typedef typename HalfedgeGen::ContainerGen container_gen;
+ typedef typename HalfedgeGen::ContainerGen::selector container_selector;
+ typedef typename HalfedgeGen::container_type container_type;
+
+ halfedge_type fa;
+ halfedge_type fb;
+ halfedge_type fc;
+ halfedge_type fd;
+ halfedge_type fe;
+ halfedge_type ff;
+ halfedge_type fg;
+ halfedge_type fh;
+ halfedge_type fi;
+ halfedge_type fj;
+ halfedge_type array[] = { fa, fb, fc, fd, fe, ff, fg, fh, fi, fj};
+
+ // Construct a halfedge_gen object whose container contains array. Verify
+ // that halfedges_begin(), halfedges_end(), and num_halfedges() work.
+
+ container_type halfedges(array, array+10);
+ HalfedgeGen halfedgeGen;
+ halfedgeGen.m_container = halfedges;
+
+ {
+ typename container_type::iterator begin = halfedgeGen.m_container.begin();
+ halfedge_type& ha = *begin;
+ halfedge_type& hb = *(++begin);
+ halfedge_type& hc = *(++begin);
+ halfedge_type& hd = *(++begin);
+ halfedge_type& he = *(++begin);
+ halfedge_type& hf = *(++begin);
+ halfedge_type& hg = *(++begin);
+ halfedge_type& hh = *(++begin);
+ halfedge_type& hi = *(++begin);
+ halfedge_type& hj = *(++begin);
+ set_opposite_helper(ha, &hb, container_selector());
+ set_opposite_helper(hb, &ha, container_selector());
+ set_opposite_helper(hc, &hd, container_selector());
+ set_opposite_helper(hd, &hc, container_selector());
+ set_opposite_helper(he, &hf, container_selector());
+ set_opposite_helper(hf, &he, container_selector());
+ set_opposite_helper(hg, &hh, container_selector());
+ set_opposite_helper(hh, &hg, container_selector());
+ set_opposite_helper(hi, &hj, container_selector());
+ set_opposite_helper(hj, &hi, container_selector());
+ }
+
+ halfedge_iterator begin = halfedges_begin(halfedgeGen);
+ //halfedge_descriptor ha = *begin;
+ halfedge_descriptor hb = *(++begin);
+ halfedge_descriptor hc = *(++begin);
+ halfedge_descriptor hd = *(++begin);
+ halfedge_descriptor he = *(++begin);
+ halfedge_descriptor hf = *(++begin);
+ halfedge_descriptor hg = *(++begin);
+ //halfedge_descriptor hh = *(++begin);
+ halfedge_descriptor hi = *(++begin);
+ //halfedge_descriptor hj = *(++begin);
+ set_next_helper(halfedgeGen, hc, hg, container_selector());
+ set_next_helper(halfedgeGen, hg, hb, container_selector());
+ set_next_helper(halfedgeGen, hd, he, container_selector());
+ set_next_helper(halfedgeGen, hb, hc, container_selector());
+ set_next_helper(halfedgeGen, he, hi, container_selector());
+ set_next_helper(halfedgeGen, hi, hd, container_selector());
+ BOOST_CHECK(( next_in_facet(hc, halfedgeGen) == he));
+ BOOST_CHECK(( next_at_source(hc, halfedgeGen) == hg));
+ BOOST_CHECK(( next_at_target(hc, halfedgeGen) == hf));
+ //BOOST_CHECK(( prev_in_facet(hc, halfedgeGen) == ha));
+ //BOOST_CHECK(( prev_at_source<next_in_facet_tag>(hc, halfedgeGen) == hg));
+ //BOOST_CHECK(( prev_at_target<next_in_facet_tag>(hc, halfedgeGen) == hf));
+
+ return true;
+}
+
+template <typename HalfedgeGen>
+bool halfedge_next_at_target_test() {
+
+ // Types must exist.
+ typedef typename HalfedgeGen::halfedge_selector halfedge_selector;
+ typedef typename HalfedgeGen::halfedge_descriptor halfedge_descriptor;
+ typedef typename HalfedgeGen::halfedge_iterator halfedge_iterator;
+ typedef typename HalfedgeGen::halfedge_type halfedge_type;
+ typedef typename HalfedgeGen::ContainerGen container_gen;
+ typedef typename HalfedgeGen::ContainerGen::selector container_selector;
+ typedef typename HalfedgeGen::container_type container_type;
+
+ halfedge_type fa;
+ halfedge_type fb;
+ halfedge_type fc;
+ halfedge_type fd;
+ halfedge_type fe;
+ halfedge_type ff;
+ halfedge_type fg;
+ halfedge_type fh;
+ halfedge_type fi;
+ halfedge_type fj;
+ halfedge_type array[] = { fa, fb, fc, fd, fe, ff, fg, fh, fi, fj};
+
+ // Construct a halfedge_gen object whose container contains array. Verify
+ // that halfedges_begin(), halfedges_end(), and num_halfedges() work.
+
+ container_type halfedges(array, array+10);
+ HalfedgeGen halfedgeGen;
+ halfedgeGen.m_container = halfedges;
+
+ {
+ typename container_type::iterator begin = halfedgeGen.m_container.begin();
+ halfedge_type& ha = *begin;
+ halfedge_type& hb = *(++begin);
+ halfedge_type& hc = *(++begin);
+ halfedge_type& hd = *(++begin);
+ halfedge_type& he = *(++begin);
+ halfedge_type& hf = *(++begin);
+ halfedge_type& hg = *(++begin);
+ halfedge_type& hh = *(++begin);
+ halfedge_type& hi = *(++begin);
+ halfedge_type& hj = *(++begin);
+ set_opposite_helper(ha, &hb, container_selector());
+ set_opposite_helper(hb, &ha, container_selector());
+ set_opposite_helper(hc, &hd, container_selector());
+ set_opposite_helper(hd, &hc, container_selector());
+ set_opposite_helper(he, &hf, container_selector());
+ set_opposite_helper(hf, &he, container_selector());
+ set_opposite_helper(hg, &hh, container_selector());
+ set_opposite_helper(hh, &hg, container_selector());
+ set_opposite_helper(hi, &hj, container_selector());
+ set_opposite_helper(hj, &hi, container_selector());
+ }
+
+ halfedge_iterator begin = halfedges_begin(halfedgeGen);
+ halfedge_descriptor ha = *begin;
+ halfedge_descriptor hb = *(++begin);
+ halfedge_descriptor hc = *(++begin);
+ halfedge_descriptor hd = *(++begin);
+ halfedge_descriptor he = *(++begin);
+ halfedge_descriptor hf = *(++begin);
+ halfedge_descriptor hg = *(++begin);
+ halfedge_descriptor hh = *(++begin);
+ halfedge_descriptor hi = *(++begin);
+ halfedge_descriptor hj = *(++begin);
+ set_next_helper(halfedgeGen, ha, hd, container_selector());
+ set_next_helper(halfedgeGen, hc, hf, container_selector());
+ set_next_helper(halfedgeGen, hd, hh, container_selector());
+ set_next_helper(halfedgeGen, hh, ha, container_selector());
+ set_next_helper(halfedgeGen, hj, hc, container_selector());
+ set_next_helper(halfedgeGen, hf, hj, container_selector());
+ BOOST_CHECK(( next_in_facet(hc, halfedgeGen) == he));
+ BOOST_CHECK(( next_at_source(hc, halfedgeGen) == hg));
+ BOOST_CHECK(( next_at_target(hc, halfedgeGen) == hf));
+ (void) hb;
+ (void) hi;
+ //BOOST_CHECK(( prev_in_facet(hc, halfedgeGen) == ha));
+ //BOOST_CHECK(( prev_at_source<next_in_facet_tag>(hc, halfedgeGen) == hg));
+ //BOOST_CHECK(( prev_at_target<next_in_facet_tag>(hc, halfedgeGen) == hf));
+
+ return true;
+}
+
+
 template <typename HalfedgeGen>
 bool halfedge_functions_requirements() {
     
@@ -123,16 +383,22 @@
     halfedge_type fb;
     halfedge_type fc;
     halfedge_type fd;
- halfedge_type array[] = { fa, fb, fc, fd };
+ halfedge_type fe;
+ halfedge_type ff;
+ halfedge_type fg;
+ halfedge_type fh;
+ halfedge_type fi;
+ halfedge_type fj;
+ halfedge_type array[] = { fa, fb, fc, fd, fe, ff, fg, fh, fi, fj};
     
     // Construct a halfedge_gen object whose container contains array. Verify
     // that halfedges_begin(), halfedges_end(), and num_halfedges() work.
 
- container_type halfedges(array, array+4);
+ container_type halfedges(array, array+10);
     HalfedgeGen halfedgeGen;
     halfedgeGen.m_container = halfedges;
 
- BOOST_CHECK(( num_halfedges(halfedgeGen) == 4 ));
+ BOOST_CHECK(( num_halfedges(halfedgeGen) == 10 ));
 
     BOOST_CHECK(( halfedges_begin(halfedgeGen)
                     == container_gen::container_begin(halfedgeGen.m_container)
@@ -149,10 +415,22 @@
         halfedge_type& hb = *(++begin);
         halfedge_type& hc = *(++begin);
         halfedge_type& hd = *(++begin);
+ halfedge_type& he = *(++begin);
+ halfedge_type& hf = *(++begin);
+ halfedge_type& hg = *(++begin);
+ halfedge_type& hh = *(++begin);
+ halfedge_type& hi = *(++begin);
+ halfedge_type& hj = *(++begin);
         set_opposite_helper(ha, &hb, container_selector());
         set_opposite_helper(hb, &ha, container_selector());
         set_opposite_helper(hc, &hd, container_selector());
         set_opposite_helper(hd, &hc, container_selector());
+ set_opposite_helper(he, &hf, container_selector());
+ set_opposite_helper(hf, &he, container_selector());
+ set_opposite_helper(hg, &hh, container_selector());
+ set_opposite_helper(hh, &hg, container_selector());
+ set_opposite_helper(hi, &hj, container_selector());
+ set_opposite_helper(hj, &hi, container_selector());
     }
 
     halfedge_iterator begin = halfedges_begin(halfedgeGen);
@@ -164,7 +442,7 @@
     BOOST_CHECK(( opposite(hb, halfedgeGen) == ha ));
     BOOST_CHECK(( opposite(hc, halfedgeGen) == hd ));
     BOOST_CHECK(( opposite(hd, halfedgeGen) == hc ));
-
+
     return true;
 }
 
@@ -317,6 +595,31 @@
                         noVertexS, facetS<ContainerS,false> > >
>() ));
 
+ // Check next_... functions
+ BOOST_CHECK(( halfedge_next_in_facet_test<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_next_at_source_test<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_at_source_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_at_source_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_next_at_target_test<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_at_target_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_at_target_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
     return true;
 }
 

Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_selectors.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_selectors.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_selectors.hpp 2007-07-22 13:54:11 EDT (Sun, 22 Jul 2007)
@@ -196,7 +196,7 @@
                     VertexDescriptor, FacetDescriptor, Config> {
     // TYPES
     typedef halfedgeS<ContainerS,TraversalS> halfedge_selector;
-
+
     typedef stored_halfedge<typename Config::halfedge_descriptor,
                             VertexDescriptor, FacetDescriptor,
                             Config> halfedge_type;


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