-inline void draw_semicircle(const std::size_t segments, const float radius, iterator_type start, remap_policy remap)
-{
- const float increment = c_pi / (double)(segments << 2);
-
- std::size_t count = 0;
- iterator_type pxpy(start);
- iterator_type pypx(pxpy + (segments << 1));
- iterator_type pynx(pxpy + (segments << 1));
- iterator_type nxpy(pypx + (segments << 1));
- iterator_type nxny(pypx + (segments << 1));
- iterator_type nynx(nxpy + (segments << 1));
- iterator_type nypx(nxpy + (segments << 1));
- iterator_type pxny(start);
- while(count < segments)
- {
- const float theta = increment * count;
- const float x = radius * cos(theta);
- const float y = radius * sin(theta);
-
- remap_policy::set((*pxpy), x, y, 0);
- remap_policy::set((*pxny), x,-y, 0);
- remap_policy::set((*nxpy),-x, y, 0);
- remap_policy::set((*nxny),-x,-y, 0);
-
- //remap_policy::set((*pypx), y, x, 0);
- //remap_policy::set((*pynx), y,-x, 0);
- //remap_policy::set((*nypx),-y, x, 0);
- //remap_policy::set((*nynx),-y,-x, 0);
- }
-}
+ inline void draw_circle( const std::size_t segments, const float radius, iterator_type start, remap_policy remap ){
+ const float increment = c_pi / (double)( segments << 2 );
+
+ std::size_t count = 0;
+ iterator_type pxpy( start );
+ iterator_type pypx( pxpy + ( segments << 1 ) );
+ iterator_type pynx( pxpy + ( segments << 1 ) );
+ iterator_type nxpy( pypx + ( segments << 1 ) );
+ iterator_type nxny( pypx + ( segments << 1 ) );
+ iterator_type nynx( nxpy + ( segments << 1 ) );
+ iterator_type nypx( nxpy + ( segments << 1 ) );
+ iterator_type pxny( start );
+ while ( count < segments )
+ {
+ const float theta = increment * count;
+ const float x = radius * cos( theta );
+ const float y = radius * sin( theta );
+
+ remap_policy::set( ( *pxpy ), x, y, 0 );
+ remap_policy::set( ( *pxny ), x,-y, 0 );
+ remap_policy::set( ( *nxpy ),-x, y, 0 );
+ remap_policy::set( ( *nxny ),-x,-y, 0 );
+
+ remap_policy::set( ( *pypx ), y, x, 0 );
+ remap_policy::set( ( *pynx ), y,-x, 0 );
+ remap_policy::set( ( *nypx ),-y, x, 0 );
+ remap_policy::set( ( *nynx ),-y,-x, 0 );
+ }
+ }
+
+ template<typename remap_policy, typename iterator_type
+ inline void draw_semicircle( const std::size_t segments, const float radius, iterator_type start, remap_policy remap )
+ {
+ const float increment = c_pi / (double)( segments << 2 );
+
+ std::size_t count = 0;
+ iterator_type pxpy( start );
+ iterator_type pypx( pxpy + ( segments << 1 ) );
+ iterator_type pynx( pxpy + ( segments << 1 ) );
+ iterator_type nxpy( pypx + ( segments << 1 ) );
+ iterator_type nxny( pypx + ( segments << 1 ) );
+ iterator_type nynx( nxpy + ( segments << 1 ) );
+ iterator_type nypx( nxpy + ( segments << 1 ) );
+ iterator_type pxny( start );
+ while ( count < segments )
+ {
+ const float theta = increment * count;
+ const float x = radius * cos( theta );
+ const float y = radius * sin( theta );
+
+ remap_policy::set( ( *pxpy ), x, y, 0 );
+ remap_policy::set( ( *pxny ), x,-y, 0 );
+ remap_policy::set( ( *nxpy ),-x, y, 0 );
+ remap_policy::set( ( *nxny ),-x,-y, 0 );
+
+ //remap_policy::set((*pypx), y, x, 0);
+ //remap_policy::set((*pynx), y,-x, 0);
+ //remap_policy::set((*nypx),-y, x, 0);
+ //remap_policy::set((*nynx),-y,-x, 0);
+ }
+ }