41 #ifndef FCL_CCD_TAYLOR_MODEL_INL_H 42 #define FCL_CCD_TAYLOR_MODEL_INL_H 55 TaylorModel<double>
operator * (
double d,
const TaylorModel<double>& a);
59 TaylorModel<double>
operator + (
double d,
const TaylorModel<double>& a);
63 TaylorModel<double>
operator - (
double d,
const TaylorModel<double>& a);
81 time_interval_->setValue(l, r);
88 time_interval_ = time_interval;
95 return time_interval_;
106 template <
typename S>
113 template <
typename S>
120 template <
typename S>
127 template <
typename S>
130 coeffs_[0] = coeffs_[1] = coeffs_[2] = coeffs_[3] = 0;
134 template <
typename S>
141 template <
typename S>
149 template <
typename S>
161 template <
typename S>
173 template <
typename S>
180 template <
typename S>
188 template <
typename S>
195 template <
typename S>
203 template <
typename S>
211 template <
typename S>
219 template <
typename S>
232 template <
typename S>
258 template <
typename S>
267 template <
typename S>
274 template <
typename S>
312 template <
typename S>
324 template <
typename S>
331 template <
typename S>
338 template <
typename S>
345 template <
typename S>
356 template <
typename S>
363 template <
typename S>
373 if(a <= t1 && a >= t0)
381 S minQ = LQ, maxQ = RQ;
388 if(minQ > AQ) minQ = AQ;
389 if(maxQ < AQ) maxQ = AQ;
400 if(LQ > RQ) polybounds.
setValue(RQ, LQ);
404 return polybounds +
r_;
426 S r1 = (-coeffs_[2]-sqrt(delta))/(3*coeffs_[3]);
427 S r2 = (-coeffs_[2]+sqrt(delta))/(3*coeffs_[3]);
429 if(r1 <= t1 && r1 >= t0)
431 S Q = coeffs_[0] + r1 * (coeffs_[1] + r1 * (coeffs_[2] + r1 * coeffs_[3]));
433 else if(Q > RQ) RQ = Q;
436 if(r2 <= t1 && r2 >= t0)
438 S Q = coeffs_[0] + r2 * (coeffs_[1] + r2 * (coeffs_[2] + r2 * coeffs_[3]));
440 else if(Q > RQ) RQ = Q;
448 template <
typename S>
455 template <
typename S>
463 template <
typename S>
476 template <
typename S>
483 template <
typename S>
490 template <
typename S>
501 tm.
coeff(0) = fa-a*(fda-0.5*a*(fdda-1.0/3.0*a*fddda));
502 tm.
coeff(1) = fda-a*fdda+0.5*a*a*fddda;
503 tm.
coeff(2) = 0.5*(fdda-a*fddda);
504 tm.
coeff(3) = 1.0/6.0*fddda;
514 if(cosQL < cosQR) fddddBounds.
setValue(cosQL, cosQR);
515 else fddddBounds.
setValue(cosQR, cosQL);
518 fddddBounds[0] -= 1e-15;
519 fddddBounds[1] += 1e-15;
530 if(ceil(k2) - floor(k1) > 1) fddddBounds[1] = 1;
533 if(ceil(k2) - floor(k1) > 1) fddddBounds[0] = -1;
537 if(ceil(k1) - floor(k2) > 1) fddddBounds[1] = 1;
540 if(ceil(k1) - floor(k2) > 1) fddddBounds[0] = -1;
548 S midSize2 = midSize * midSize;
549 S midSize4 = midSize2 * midSize2;
552 if(fddddBounds[0] > 0)
553 tm.
remainder().setValue(0, fddddBounds[1] * midSize4 * (1.0 / 24));
554 else if(fddddBounds[0] < 0)
555 tm.
remainder().setValue(fddddBounds[0] * midSize4 * (1.0 / 24), 0);
557 tm.
remainder().setValue(fddddBounds[0] * midSize4 * (1.0 / 24), fddddBounds[1] * midSize4 * (1.0 / 24));
561 template <
typename S>
572 tm.
coeff(0) = fa-a*(fda-0.5*a*(fdda-1.0/3.0*a*fddda));
573 tm.
coeff(1) = fda-a*fdda+0.5*a*a*fddda;
574 tm.
coeff(2) = 0.5*(fdda-a*fddda);
575 tm.
coeff(3) = 1.0/6.0*fddda;
587 if(sinQL < sinQR) fddddBounds.
setValue(sinQL, sinQR);
588 else fddddBounds.
setValue(sinQR, sinQL);
591 fddddBounds[0] -= 1e-15;
592 fddddBounds[1] += 1e-15;
602 if(ceil(k2) - floor(k1) > 1) fddddBounds[1] = 1;
605 if(ceil(k2) - floor(k1) > 1) fddddBounds[0] = -1;
609 if(ceil(k1) - floor(k2) > 1) fddddBounds[1] = 1;
612 if(ceil(k1) - floor(k2) > 1) fddddBounds[0] = -1;
619 S midSize2 = midSize * midSize;
620 S midSize4 = midSize2 * midSize2;
623 if(fddddBounds[0] > 0)
624 tm.
remainder().setValue(0, fddddBounds[1] * midSize4 * (1.0 / 24));
625 else if(fddddBounds[0] < 0)
626 tm.
remainder().setValue(fddddBounds[0] * midSize4 * (1.0 / 24), 0);
628 tm.
remainder().setValue(fddddBounds[0] * midSize4 * (1.0 / 24), fddddBounds[1] * midSize4 * (1.0 / 24));
633 template <
typename S>
void setTimeInterval(S l, S r)
Interval< S > getBound() const
S coeff(std::size_t i) const
template void generateTaylorModelForSinFunc(TaylorModel< double > &tm, double w, double q0)
template TMatrix3< double > operator+(const Matrix3< double > &m1, const TMatrix3< double > &m2)
template TMatrix3< double > operator-(const Matrix3< double > &m1, const TMatrix3< double > &m2)
template void generateTaylorModelForLinearFunc(TaylorModel< double > &tm, double p, double v)
Interval< S > getTightBound() const
const Interval< S > & remainder() const
TaylorModel operator*(const TaylorModel &other) const
Taylor model multiplication: f(t) = c0+c1*t+c2*t^2+c3*t^3+[a,b] g(t) = c0'+c1'*t+c2'*t^2+c3'*t^2+[c,d] f(t)g(t)= c0c0'+ (c0c1'+c1c0')t+ (c0c2'+c1c1'+c2c0')t^2+ (c0c3'+c1c2'+c2c1'+c3c0')t^3+ [a,b][c,d]+ (c1c3'+c2c2'+c3c1')t^4+ (c2c3'+c3c2')t^5+ (c3c3')t^6+ (c0+c1*t+c2*t^2+c3*t^3)[c,d]+ (c0'+c1'*t+c2'*t^2+c3'*c^3)[a,b].
TaylorModel & operator*=(const TaylorModel &other)
Interval class for [a, b].
TaylorModel operator-() const
template class FCL_EXPORT TaylorModel< double >
template void generateTaylorModelForCosFunc(TaylorModel< double > &tm, double w, double q0)
TaylorModel operator+(const TaylorModel &other) const
S coeffs_[4]
Coefficients of the cubic polynomial approximation.
void setValue(S a, S b)
construct interval [left, right]
const std::shared_ptr< TimeInterval< S > > & getTimeInterval() const
std::shared_ptr< TimeInterval< S > > time_interval_
time interval
TaylorModel & operator-=(const TaylorModel &other)
template TMatrix3< double > operator*(const Matrix3< double > &m, const TaylorModel< double > &a)
Interval< S > r_
interval remainder
TaylorModel implements a third order Taylor model, i.e., a cubic approximation of a function over a t...
TaylorModel & operator+=(const TaylorModel &other)