static inline bool apply(Point const& point, PointOfSegment const& s1, PointOfSegment const& s2, counter& state) { state.add_to_area(get<0>(s2) * get<1>(s1) - get<0>(s1) * get<1>(s2)); int count = check_segment<1>(point, s1, s2, state); if (count != 0) { int side = strategy_side_type::apply(s1, s2, point); if (side == 0) { // Point is lying on segment state.m_touches = true; state.m_count = 0; return false; } // Side is NEG for right, POS for left. // The count is -2 for down, 2 for up (or -1/1) // Side positive thus means UP and LEFTSIDE or DOWN and RIGHTSIDE // See accompagnying figure (TODO) if (side * count > 0) { state.m_count += count; } } return ! state.m_touches; }
static inline int result(counter const& state) { return state.code(); }
void operator() (void) { c.increment(); }
void change_count() { int i = c.increment(); boost::mutex::scoped_lock scoped_lock(io_mutex); std::cout << "count == " << i << std::endl; }
void change_count() { std::cout << "count == " << c.increment() << std::endl; }
void add(const counter<T>& counts) { for (const_iterator it = counts.begin(); it != counts.end(); ++it) { (*this)[it->first] += it->second; } }
void f(counter & cnt) { for(int i=0;i<100;i++) { cnt.increment(); } return; }