taylor_model.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011-2014, Willow Garage, Inc.
5  * Copyright (c) 2014-2016, Open Source Robotics Foundation
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of Open Source Robotics Foundation nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 // This code is based on code developed by Stephane Redon at UNC and Inria for
37 // the CATCH library: http://graphics.ewha.ac.kr/CATCH/
38 
41 #ifndef FCL_CCD_TAYLOR_MODEL_H
42 #define FCL_CCD_TAYLOR_MODEL_H
43 
44 #include <memory>
45 #include <iostream>
46 #include "fcl/math/constants.h"
49 
50 namespace fcl
51 {
52 
57 template <typename S>
58 class FCL_EXPORT TaylorModel
59 {
61  std::shared_ptr<TimeInterval<S>> time_interval_;
62 
64  S coeffs_[4];
65 
68 
69 public:
70 
71  void setTimeInterval(S l, S r);
72 
73  void setTimeInterval(const std::shared_ptr<TimeInterval<S>>& time_interval);
74 
75  const std::shared_ptr<TimeInterval<S>>& getTimeInterval() const;
76 
77  S coeff(std::size_t i) const;
78  S& coeff(std::size_t i);
79  const Interval<S>& remainder() const;
80  Interval<S>& remainder();
81 
82  TaylorModel();
83  TaylorModel(const std::shared_ptr<TimeInterval<S>>& time_interval);
84  TaylorModel(S coeff, const std::shared_ptr<TimeInterval<S>>& time_interval);
85  TaylorModel(S coeffs[3], const Interval<S>& r, const std::shared_ptr<TimeInterval<S>>& time_interval);
86  TaylorModel(S c0, S c1, S c2, S c3, const Interval<S>& r, const std::shared_ptr<TimeInterval<S>>& time_interval);
87 
88  TaylorModel operator + (const TaylorModel& other) const;
89  TaylorModel& operator += (const TaylorModel& other);
90 
91  TaylorModel operator - (const TaylorModel& other) const;
92  TaylorModel& operator -= (const TaylorModel& other);
93 
94  TaylorModel operator + (S d) const;
95  TaylorModel& operator += (S d);
96 
97  TaylorModel operator - (S d) const;
98  TaylorModel& operator -= (S d);
99 
100  TaylorModel operator * (const TaylorModel& other) const;
101  TaylorModel operator * (S d) const;
102  TaylorModel& operator *= (const TaylorModel& other);
103  TaylorModel& operator *= (S d);
104 
105  TaylorModel operator - () const;
106 
107  void print() const;
108 
109  Interval<S> getBound() const;
110  Interval<S> getBound(S l, S r) const;
111 
112  Interval<S> getTightBound() const;
113  Interval<S> getTightBound(S l, S r) const;
114 
115  Interval<S> getBound(S t) const;
116 
117  void setZero();
118 };
119 
120 template <typename S>
121 FCL_EXPORT
123 
124 template <typename S>
125 FCL_EXPORT
127 
128 template <typename S>
129 FCL_EXPORT
131 
133 template <typename S>
134 FCL_EXPORT
135 void generateTaylorModelForCosFunc(TaylorModel<S>& tm, S w, S q0);
136 
138 template <typename S>
139 FCL_EXPORT
140 void generateTaylorModelForSinFunc(TaylorModel<S>& tm, S w, S q0);
141 
143 template <typename S>
144 FCL_EXPORT
146 
147 } // namespace fcl
148 
150 
151 #endif
fcl::generateTaylorModelForLinearFunc
template void generateTaylorModelForLinearFunc(TaylorModel< double > &tm, double p, double v)
fcl::operator-
template TMatrix3< double > operator-(const Matrix3< double > &m1, const TMatrix3< double > &m2)
fcl::TaylorModel::r_
Interval< S > r_
interval remainder
Definition: taylor_model.h:67
fcl::generateTaylorModelForSinFunc
template void generateTaylorModelForSinFunc(TaylorModel< double > &tm, double w, double q0)
fcl::TaylorModel::time_interval_
std::shared_ptr< TimeInterval< S > > time_interval_
time interval
Definition: taylor_model.h:61
interval.h
fcl::TimeInterval
Definition: time_interval.h:50
fcl::generateTaylorModelForCosFunc
template void generateTaylorModelForCosFunc(TaylorModel< double > &tm, double w, double q0)
r
S r
Definition: test_sphere_box.cpp:171
taylor_model-inl.h
fcl::operator*
template TMatrix3< double > operator*(const Matrix3< double > &m, const TaylorModel< double > &a)
fcl::TaylorModel
TaylorModel implements a third order Taylor model, i.e., a cubic approximation of a function over a t...
Definition: taylor_model.h:58
fcl::Interval
Interval class for [a, b].
Definition: interval.h:50
time_interval.h
constants.h
fcl
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
fcl::operator+
template TMatrix3< double > operator+(const Matrix3< double > &m1, const TMatrix3< double > &m2)


fcl
Author(s):
autogenerated on Tue Dec 5 2023 03:40:49