typedef int coordinate_type;<br>
<br>
static inline coordinate_type get(const CPoint& point, <br>
-
+
orientation_2d orient) {<br>
if(orient == HORIZONTAL)<br>
return point.x;<br>
<br>
template <><br>
struct point_mutable_traits<CPoint> {<br>
- static inline void set(CPoint& point, orientation_2d orient,
+ typedef int coordinate_type;<br>
+<br>
+ static inline void set(CPoint& point, orientation_2d orient,
int value) {<br>
if(orient == HORIZONTAL)<br>
point.x = value;<br>
//expects stl style iterators<br>
template <typename iT><br>
static inline CPolygon& set_points(CPolygon& t, <br>
-
+
iT input_begin, iT input_end) {<br>
t.clear();<br>
while(input_begin != input_end) {<br>
namespace boost { namespace polygon {<br>
//first we register CPolygonSet as a polygon set<br>
template <><br>
- struct geometry_concept<CPolygonSet> { typedef polygon_set_concept type;
+ struct geometry_concept<CPolygonSet> { typedef polygon_set_concept type;
};<br>
<br>
//next we map to the concept through traits<br>
typedef CPolygonSet::const_iterator iterator_type;<br>
typedef CPolygonSet operator_arg_type;<br>
<br>
- static inline iterator_type begin(const CPolygonSet&
+ static inline iterator_type begin(const CPolygonSet&
polygon_set) {<br>
return polygon_set.begin();<br>
}<br>
<br>
- static inline iterator_type end(const CPolygonSet&
+ static inline iterator_type end(const CPolygonSet&
polygon_set) {<br>
return polygon_set.end();<br>
}<br>
<br>
//don't worry about these, just return false from them<br>
- static inline bool clean(const CPolygonSet& polygon_set) {
+ static inline bool clean(const CPolygonSet& polygon_set) {
return false; }<br>
- static inline bool sorted(const CPolygonSet& polygon_set) {
+ static inline bool sorted(const CPolygonSet& polygon_set) {
return false; }<br>
};<br>
<br>
template <><br>
struct polygon_set_mutable_traits<CPolygonSet> {<br>
template <typename input_iterator_type><br>
- static inline void set(CPolygonSet& polygon_set,
+ static inline void set(CPolygonSet& polygon_set,
input_iterator_type input_begin, input_iterator_type input_end) {<br>
polygon_set.clear();<br>
- //this is kind of cheesy. I am copying the
+ //this is kind of cheesy. I am copying the
unknown input geometry<br>
- //into my own polygon set and then calling get to
+ //into my own polygon set and then calling get to
populate the<br>
//deque<br>
polygon_set_data<int> ps;<br>
ps.insert(input_begin, input_end);<br>
ps.get(polygon_set);<br>
- //if you had your own odd-ball polygon set you
+ //if you had your own odd-ball polygon set you
would probably have<br>
- //to iterate through each polygon at this point
+ //to iterate through each polygon at this point
and do something<br>
//extra<br>
}<br>
long long diff1 = c2 - c1;<br>
long long diff2 = c3 - c2;<br>
if(diff1 > 0 && diff2)<br>
- std::cout << "library polygon_set_data is " <<
-float(diff1)/float(diff2) << "X faster than custom polygon set deque of CPolygon"
+ std::cout << "library polygon_set_data is " <<
+float(diff1)/float(diff2) << "X faster than custom polygon set deque of CPolygon"
<< std::endl;<br>
else<br>
std::cout << "operation was too fast" << std::endl;<br>
return 0;<br>
}</font></p>
-<p><font face="Courier New">//Now you know how to map your own data type to
+<p><font face="Courier New">//Now you know how to map your own data type to
polygon set concept<br>
//Now you also know how to make your application code that operates on geometry<br>
//data type agnostic from point through polygon set
</tr>
<tr class="field">
<th class="docinfo-name">License:</th>
- <td class="field-body">Distributed under the Boost Software License,
+ <td class="field-body">Distributed under the Boost Software License,
Version 1.0. (See accompanying file <tt class="literal">
<span class="pre">LICENSE_1_0.txt</span></tt> or copy at
<a class="reference" target="_top" href="http://www.boost.org/LICENSE_1_0.txt">