本文整理汇总了C++中Segment::angle方法的典型用法代码示例。如果您正苦于以下问题:C++ Segment::angle方法的具体用法?C++ Segment::angle怎么用?C++ Segment::angle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Segment
的用法示例。
在下文中一共展示了Segment::angle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: includes
SegmentStorage::iterator SegmentStorage::includes(const Segment& s) const {
iterator result(end);
if (s.first() != s.second()) {
auto set_it = storage_.find(s.angle());
if (set_it != storage_.end()) {
auto it = set_it->second.lower_bound(s);
for (; it != set_it->second.end(); ++it) {
if (it->includes(s)) {
result = it;
break;
}
}
}
} else { // If segment is degenerate we need to iterate all structure in any way
for (auto const& set : storage_) {
auto it = std::find_if(set.second.begin(), set.second.end(), [&s] (const Segment& segment) {
return segment.includes(s.first());
});
if (it != set.second.end()) {
result = it;
break;
}
}
}
return result;
}
示例2: erase
bool SegmentStorage::erase(const Segment& s) {
bool result = false;
auto it = storage_.find(s.angle());
if (it != storage_.end()) {
result = (0 != it->second.erase(s));
}
return result;
}
示例3: find
SegmentStorage::iterator SegmentStorage::find(const Segment& s) const {
iterator result(end);
auto set_it = storage_.find(s.angle());
if (set_it != storage_.end()) {
auto it = set_it->second.find(s);
if (it != set_it->second.end()) {
result = it;
}
}
return result;
}
示例4: insert
bool SegmentStorage::insert(const Segment& s) {
segment_set& set = storage_[s.angle()];
auto pit = set.insert(s);
return pit.second;
}