コード例 #1
0
    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;
    }
コード例 #2
0
 static inline int result(counter const& state)
 {
     return state.code();
 }
コード例 #3
0
 void operator() (void) {
     c.increment();
 }
コード例 #4
0
ファイル: mutex.cpp プロジェクト: 00liujj/dealii
void change_count()
{
    int i = c.increment();
    boost::mutex::scoped_lock scoped_lock(io_mutex);
    std::cout << "count == " << i << std::endl;
}
コード例 #5
0
ファイル: recursive_mutex.cpp プロジェクト: iceberry/flyffsf
void change_count()
{
    std::cout << "count == " << c.increment() << std::endl;
}
コード例 #6
0
ファイル: counter.hpp プロジェクト: gologo13/jubatus
 void add(const counter<T>& counts) {
   for (const_iterator it = counts.begin(); it != counts.end(); ++it) {
     (*this)[it->first] += it->second;
   }
 }
コード例 #7
0
ファイル: main.cpp プロジェクト: shengyushen/learnEDA
void f(counter &  cnt) {
	for(int i=0;i<100;i++) {
		cnt.increment();
	}
	return;
}