本文整理汇总了C++中rect::left方法的典型用法代码示例。如果您正苦于以下问题:C++ rect::left方法的具体用法?C++ rect::left怎么用?C++ rect::left使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rect
的用法示例。
在下文中一共展示了rect::left方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clop
inline pos2<T> clop(const pos2<T>& pos, const rect<T>& r, T resolution=1) {
pos2<T> cloped(pos);
if (cloped.x_ >= r.right()) cloped.x_ = r.right() - resolution;
if (cloped.y_ >= r.bottom()) cloped.y_ = r.bottom() - resolution;
if (cloped.x_ < r.left()) cloped.x_ = r.left();
if (cloped.y_ < r.top()) cloped.y_ = r.top();
return cloped;
}
示例2: contains
constexpr bool contains(
rect< PositionType, SizeType > const& reference,
rect< PositionType, SizeType > const& test
){
return
test.left() >= reference.left() &&
test.top() >= reference.top() &&
test.right() <= reference.right() &&
test.bottom() <= reference.bottom();
}
示例3: join
constexpr rect< PositionType, SizeType > join(
rect< PositionType, SizeType > const& lhs,
rect< PositionType, SizeType > const& rhs
){
return rect< PositionType, SizeType >(
point< PositionType >(
std::min(lhs.left(), rhs.left()),
std::min(lhs.top(), rhs.top())
),
point< PositionType >(
std::max(lhs.right(), rhs.right()),
std::max(lhs.bottom(), rhs.bottom())
)
);
}
示例4: hit_test
int rect::hit_test(const rect& other) const
{
int intersect_other = 0;
if (other.hit_test(left(), top())) intersect_other++;
if (other.hit_test(left(), bottom())) intersect_other++;
if (other.hit_test(right(), top())) intersect_other++;
if (other.hit_test(right(), bottom())) intersect_other++;
if (intersect_other == 0)
return outside;
else if (intersect_other == 4)
return inside;
intersect_other = 0;
if (hit_test(other.left(), other.top())) intersect_other++;
if (hit_test(other.left(), other.bottom())) intersect_other++;
if (hit_test(other.right(), other.top())) intersect_other++;
if (hit_test(other.right(), other.bottom())) intersect_other++;
if (intersect_other == 4)
return contain;
else //
return intersect;
}