本文整理匯總了C++中Interval::isEmpty方法的典型用法代碼示例。如果您正苦於以下問題:C++ Interval::isEmpty方法的具體用法?C++ Interval::isEmpty怎麽用?C++ Interval::isEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Interval
的用法示例。
在下文中一共展示了Interval::isEmpty方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: EMPTY
Interval
atan2(Interval yInterval, Interval xInterval) {
if (yInterval.isEmpty() || xInterval.isEmpty()) {
return Interval::EMPTY();
} else if (xInterval.lowerBound() > 0.0) {
return atan(yInterval / xInterval);
} else if (yInterval.lowerBound() > 0.0) {
return atan(-xInterval / yInterval) + M_PI / 2;
} else if (yInterval.upperBound() < 0.0) {
return atan(-xInterval / yInterval) - M_PI / 2;
} else {
return Interval(-M_PI, M_PI);
}
}
示例2: unionize
Intervals Interval::unionize(Interval& other) {
Intervals result;
if (isEmpty()) {
result.push_back(other);
return result;
}
else if (other.isEmpty()) {
result.push_back(*this);
return result;
}
else if (intersects(*this, other)) {
//std::cout << "intersecting" << std::endl;
Interval newInt(std::min(_min, other._min), std::max(_max, other._max));
result.push_back(newInt);
return result;
}
else {
if (_min < other._min) {
result.push_back(*this);
result.push_back(other);
return result;
}
else {
result.push_back(other);
result.push_back(*this);
return result;
}
}
return result;
}
示例3:
bool Interval::operator == ( const Interval& other ) const
{
if ( isEmpty() && other.isEmpty() )
return true ;
return _lower == other._lower && _upper == other._upper ;
}
示例4: intersects
bool Interval::intersects( const Interval & other ) const
{
//empty intervals never intersects
if ( isEmpty() || other.isEmpty() )
return false ;
return ! ( _lower > other._upper || _upper < other._lower ) ;
}
示例5: intersect
Interval Interval::intersect(Interval& other) {
Interval result;
if (isEmpty() || other.isEmpty()) {
return result;
}
if (intersects(*this, other)) {
result = Interval(std::max(_min, other._min), std::min(_max, other._max));
}
return result;
}
示例6: expandToInclude
void Interval::expandToInclude( const Interval & other )
{
//ignore empty interval
if ( other.isEmpty() )
return ;
if ( isEmpty() ){
(*this) = other ;
}else{
_lower = std::min( _lower, other._lower );
_upper = std::max( _upper, other._upper );
}
}
示例7: difference
Intervals Interval::difference(Interval& diff) {
Intervals result;
if (isEmpty()) {
return result;
}
else if (diff.isEmpty()) {
result.push_back(*this);
return result;
}
if (intersects(*this, diff)) {
if (_min < diff._min) {
Interval temp(_min, diff._min);
result.push_back(temp);
}
if (_max > diff._max) {
Interval temp(diff._max, _max);
result.push_back(temp);
}
}
else {
result.push_back(*this);
}
return result;
}