Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00037 #include "fcl/ccd/taylor_vector.h"
00038
00039 namespace fcl
00040 {
00041
00042 TVector3::TVector3()
00043 {
00044 }
00045
00046 TVector3::TVector3(const boost::shared_ptr<TimeInterval>& time_interval)
00047 {
00048 setTimeInterval(time_interval);
00049 }
00050
00051 TVector3::TVector3(TaylorModel v[3])
00052 {
00053 i_[0] = v[0];
00054 i_[1] = v[1];
00055 i_[2] = v[2];
00056 }
00057
00058 TVector3::TVector3(const TaylorModel& v1, const TaylorModel& v2, const TaylorModel& v3)
00059 {
00060 i_[0] = v1;
00061 i_[1] = v2;
00062 i_[2] = v3;
00063 }
00064
00065 TVector3::TVector3(const Vec3f& v, const boost::shared_ptr<TimeInterval>& time_interval)
00066 {
00067 i_[0] = TaylorModel(v[0], time_interval);
00068 i_[1] = TaylorModel(v[1], time_interval);
00069 i_[2] = TaylorModel(v[2], time_interval);
00070 }
00071
00072 void TVector3::setZero()
00073 {
00074 i_[0].setZero();
00075 i_[1].setZero();
00076 i_[2].setZero();
00077 }
00078
00079 TVector3 TVector3::operator + (const TVector3& other) const
00080 {
00081 return TVector3(i_[0] + other.i_[0], i_[1] + other.i_[1], i_[2] + other.i_[2]);
00082 }
00083
00084 TVector3 TVector3::operator + (FCL_REAL d) const
00085 {
00086 return TVector3(i_[0], i_[1], i_[2] + d);
00087 }
00088
00089 TVector3& TVector3::operator += (FCL_REAL d)
00090 {
00091 i_[2] += d;
00092 return *this;
00093 }
00094
00095 TVector3 TVector3::operator - (const TVector3& other) const
00096 {
00097 return TVector3(i_[0] - other.i_[0], i_[1] - other.i_[1], i_[2] - other.i_[2]);
00098 }
00099
00100 TVector3& TVector3::operator += (const TVector3& other)
00101 {
00102 i_[0] += other.i_[0];
00103 i_[1] += other.i_[1];
00104 i_[2] += other.i_[2];
00105 return *this;
00106 }
00107
00108 TVector3& TVector3::operator -= (const TVector3& other)
00109 {
00110 i_[0] -= other.i_[0];
00111 i_[1] -= other.i_[1];
00112 i_[2] -= other.i_[2];
00113 return *this;
00114 }
00115
00116 TVector3 TVector3::operator * (const TaylorModel& d) const
00117 {
00118 return TVector3(i_[0] * d, i_[1] * d, i_[2] * d);
00119 }
00120
00121 TVector3& TVector3::operator *= (const TaylorModel& d)
00122 {
00123 i_[0] *= d;
00124 i_[1] *= d;
00125 i_[2] *= d;
00126 return *this;
00127 }
00128
00129 TVector3 TVector3::operator * (FCL_REAL d) const
00130 {
00131 return TVector3(i_[0] * d, i_[1] * d, i_[2] * d);
00132 }
00133
00134 TVector3& TVector3::operator *= (FCL_REAL d)
00135 {
00136 i_[0] *= d;
00137 i_[1] *= d;
00138 i_[2] *= d;
00139 return *this;
00140 }
00141
00142 const TaylorModel& TVector3::operator [] (size_t i) const
00143 {
00144 return i_[i];
00145 }
00146
00147 TaylorModel& TVector3::operator [] (size_t i)
00148 {
00149 return i_[i];
00150 }
00151
00152 TaylorModel TVector3::dot(const TVector3& other) const
00153 {
00154 return i_[0] * other.i_[0] + i_[1] * other.i_[1] + i_[2] * other.i_[2];
00155 }
00156
00157 TVector3 TVector3::cross(const TVector3& other) const
00158 {
00159 return TVector3(i_[1] * other.i_[2] - i_[2] * other.i_[1],
00160 i_[2] * other.i_[0] - i_[0] * other.i_[2],
00161 i_[0] * other.i_[1] - i_[1] * other.i_[0]);
00162 }
00163
00164 TaylorModel TVector3::dot(const Vec3f& other) const
00165 {
00166 return i_[0] * other[0] + i_[1] * other[1] + i_[2] * other[2];
00167 }
00168
00169 TVector3 TVector3::cross(const Vec3f& other) const
00170 {
00171 return TVector3(i_[1] * other[2] - i_[2] * other[1],
00172 i_[2] * other[0] - i_[0] * other[2],
00173 i_[0] * other[1] - i_[1] * other[0]);
00174 }
00175
00176 FCL_REAL TVector3::volumn() const
00177 {
00178 return i_[0].getBound().diameter() * i_[1].getBound().diameter() * i_[2].getBound().diameter();
00179 }
00180
00181 IVector3 TVector3::getBound() const
00182 {
00183 return IVector3(i_[0].getBound(), i_[1].getBound(), i_[2].getBound());
00184 }
00185
00186 void TVector3::print() const
00187 {
00188 i_[0].print();
00189 i_[1].print();
00190 i_[2].print();
00191 }
00192
00193 IVector3 TVector3::getBound(FCL_REAL t) const
00194 {
00195 return IVector3(i_[0].getBound(t), i_[1].getBound(t), i_[2].getBound(t));
00196 }
00197
00198 TaylorModel TVector3::squareLength() const
00199 {
00200 return i_[0] * i_[0] + i_[1] * i_[1] + i_[2] * i_[2];
00201 }
00202
00203 void TVector3::setTimeInterval(const boost::shared_ptr<TimeInterval>& time_interval)
00204 {
00205 i_[0].setTimeInterval(time_interval);
00206 i_[1].setTimeInterval(time_interval);
00207 i_[2].setTimeInterval(time_interval);
00208 }
00209
00210 void generateTVector3ForLinearFunc(TVector3& v, const Vec3f& position, const Vec3f& velocity)
00211 {
00212 generateTaylorModelForLinearFunc(v.i_[0], position[0], velocity[0]);
00213 generateTaylorModelForLinearFunc(v.i_[1], position[1], velocity[1]);
00214 generateTaylorModelForLinearFunc(v.i_[2], position[2], velocity[2]);
00215 }
00216
00217
00218
00219
00220
00221 }