Go to the documentation of this file.
   39 #ifndef FCL_CCD_INTERVAL_INL_H 
   40 #define FCL_CCD_INTERVAL_INL_H 
   49 struct Interval<double>;
 
   53 Interval<double> 
bound(
const Interval<double>& i, 
double v);
 
   57 Interval<double> 
bound(
const Interval<double>& i, 
const Interval<double>& other);
 
   77   i_[0] = left; i_[1] = right;
 
  102 template <
typename S>
 
  109 template <
typename S>
 
  112   if(i_[0] != other.
i_[0]) 
return false;
 
  113   if(i_[1] != other.
i_[1]) 
return false;
 
  118 template <
typename S>
 
  121   return Interval(i_[0] + other.
i_[0], i_[1] + other.
i_[1]);
 
  125 template <
typename S>
 
  128   return Interval(i_[0] - other.
i_[1], i_[1] - other.
i_[0]);
 
  132 template <
typename S>
 
  135   i_[0] += other.
i_[0];
 
  136   i_[1] += other.
i_[1];
 
  141 template <
typename S>
 
  144   i_[0] -= other.
i_[1];
 
  145   i_[1] -= other.
i_[0];
 
  150 template <
typename S>
 
  155     if(i_[0] >= 0) 
return Interval<S>(i_[0] * other.
i_[0], i_[1] * other.
i_[1]);
 
  156     if(i_[1] <= 0) 
return Interval<S>(i_[0] * other.
i_[1], i_[1] * other.
i_[0]);
 
  161     if(i_[0] >= 0) 
return Interval<S>(i_[1] * other.
i_[0], i_[0] * other.
i_[1]);
 
  162     if(i_[1] <= 0) 
return Interval<S>(i_[1] * other.
i_[1], i_[0] * other.
i_[0]);
 
  166   if(i_[0] >= 0) 
return Interval<S>(i_[1] * other.
i_[0], i_[1] * other.
i_[1]);
 
  167   if(i_[1] <= 0) 
return Interval<S>(i_[0] * other.
i_[1], i_[0] * other.
i_[0]);
 
  169   S v00 = i_[0] * other.
i_[0];
 
  170   S v11 = i_[1] * other.
i_[1];
 
  173     S v01 = i_[0] * other.
i_[1];
 
  174     S v10 = i_[1] * other.
i_[0];
 
  179   S v01 = i_[0] * other.
i_[1];
 
  180   S v10 = i_[1] * other.
i_[0];
 
  186 template <
typename S>
 
  193       i_[0] *= other.
i_[0];
 
  194       i_[1] *= other.
i_[1];
 
  198       i_[0] *= other.
i_[1];
 
  199       i_[1] *= other.
i_[0];
 
  203       i_[0] *= other.
i_[1];
 
  204       i_[1] *= other.
i_[1];
 
  214       i_[0] = i_[1] * other.
i_[0];
 
  215       i_[1] = tmp * other.
i_[1];
 
  220       i_[0] = i_[1] * other.
i_[1];
 
  221       i_[1] = tmp * other.
i_[0];
 
  226       i_[0] = i_[1] * other.
i_[0];
 
  227       i_[1] = tmp * other.
i_[0];
 
  234     i_[0] = i_[1] * other.
i_[0];
 
  235     i_[1] *= other.
i_[1];
 
  241     i_[1] = i_[0] * other.
i_[0];
 
  242     i_[0] *= other.
i_[1];
 
  246   S v00 = i_[0] * other.
i_[0];
 
  247   S v11 = i_[1] * other.
i_[1];
 
  250     S v01 = i_[0] * other.
i_[1];
 
  251     S v10 = i_[1] * other.
i_[0];
 
  265   S v01 = i_[0] * other.
i_[1];
 
  266   S v10 = i_[1] * other.
i_[0];
 
  282 template <
typename S>
 
  285   if(d >= 0) 
return Interval(i_[0] * d, i_[1] * d);
 
  286   return Interval(i_[1] * d, i_[0] * d);
 
  290 template <
typename S>
 
  309 template <
typename S>
 
  312   return *
this * 
Interval(1.0 / other.
i_[1], 1.0 / other.
i_[0]);
 
  316 template <
typename S>
 
  319   *
this *= 
Interval(1.0 / other.
i_[1], 1.0 / other.
i_[0]);
 
  324 template <
typename S>
 
  327   if(i_[1] < other.
i_[0]) 
return false;
 
  328   if(i_[0] > other.
i_[1]) 
return false;
 
  333 template <
typename S>
 
  336   if(i_[1] < other.
i_[0]) 
return false;
 
  337   if(i_[0] > other.
i_[1]) 
return false;
 
  338   if(i_[1] > other.
i_[1]) i_[1] = other.
i_[1];
 
  339   if(i_[0] < other.
i_[0]) i_[0] = other.
i_[0];
 
  344 template <
typename S>
 
  351 template <
typename S>
 
  354   if(i_[0] >= 0) 
return i_[0];
 
  355   if(i_[1] >= 0) 
return 0;
 
  360 template <
typename S>
 
  363   if(i_[0] + i_[1] >= 0) 
return i_[1];
 
  368 template <
typename S>
 
  371   if(v < i_[0]) 
return false;
 
  372   if(v > i_[1]) 
return false;
 
  377 template <
typename S>
 
  380   if(v < i_[0]) i_[0] = v;
 
  381   if(v > i_[1]) i_[1] = v;
 
  386 template <
typename S>
 
  389   if(other.
i_[0] < i_[0]) i_[0] = other.
i_[0];
 
  390   if(other.
i_[1] > i_[1]) i_[1] = other.
i_[1];
 
  395 template <
typename S>
 
  398   std::cout << 
"[" << i_[0] << 
", " << i_[1] << 
"]" << std::endl;
 
  402 template <
typename S>
 
  405   return 0.5 * (i_[0] + i_[1]);
 
  409 template <
typename S>
 
  416 template <
typename S>
 
  420   if(v < res.
i_[0]) res.
i_[0] = v;
 
  421   if(v > res.
i_[1]) res.
i_[1] = v;
 
  426 template <
typename S>
 
  430   if(other.
i_[0] < res.
i_[0]) res.
i_[0] = other.
i_[0];
 
  431   if(other.
i_[1] > res.
i_[1]) res.
i_[1] = other.
i_[1];
 
  
Interval operator*(const Interval &other) const
Interval operator+(const Interval &other) const
add two intervals
Interval & operator/=(const Interval &other)
Interval & operator-=(const Interval &other)
S operator[](size_t i) const
access the interval endpoints: 0 for left, 1 for right end
Interval & operator+=(const Interval &other)
S getAbsUpper() const
Return the farthest distance for points within the interval to zero.
Interval operator/(const Interval &other) const
other must not contain 0
bool intersect(const Interval &other)
template Interval< double > bound(const Interval< double > &i, double v)
Interval class for [a, b].
Interval & operator*=(const Interval &other)
void setValue(S a, S b)
construct interval [left, right]
Interval operator-() const
S getAbsLower() const
Return the nearest distance for points within the interval to zero.
Interval & bound(S v)
Compute the minimum interval contains v and original interval.
bool operator==(const Interval &other) const
whether two intervals are the same
bool overlap(const Interval &other) const
determine whether the intersection between intervals is empty
fcl
Author(s): 
autogenerated on Fri Mar 14 2025 02:38:17