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
00038 #ifndef FCL_CCD_INTERVAL_VECTOR_H
00039 #define FCL_CCD_INTERVAL_VECTOR_H
00040
00041 #include "fcl/ccd/interval.h"
00042 #include "fcl/math/vec_3f.h"
00043
00044 namespace fcl
00045 {
00046
00047 struct IVector3
00048 {
00049 Interval i_[3];
00050
00051 IVector3();
00052 IVector3(FCL_REAL v);
00053 IVector3(FCL_REAL x, FCL_REAL y, FCL_REAL z);
00054 IVector3(FCL_REAL xl, FCL_REAL xu, FCL_REAL yl, FCL_REAL yu, FCL_REAL zl, FCL_REAL zu);
00055 IVector3(Interval v[3]);
00056 IVector3(FCL_REAL v[3][2]);
00057 IVector3(const Interval& v1, const Interval& v2, const Interval& v3);
00058 IVector3(const Vec3f& v);
00059
00060 inline void setValue(FCL_REAL v)
00061 {
00062 i_[0].setValue(v);
00063 i_[1].setValue(v);
00064 i_[2].setValue(v);
00065 }
00066
00067 inline void setValue(FCL_REAL x, FCL_REAL y, FCL_REAL z)
00068 {
00069 i_[0].setValue(x);
00070 i_[1].setValue(y);
00071 i_[2].setValue(z);
00072 }
00073
00074 inline void setValue(FCL_REAL xl, FCL_REAL xu, FCL_REAL yl, FCL_REAL yu, FCL_REAL zl, FCL_REAL zu)
00075 {
00076 i_[0].setValue(xl, xu);
00077 i_[1].setValue(yl, yu);
00078 i_[2].setValue(zl, zu);
00079 }
00080
00081 inline void setValue(FCL_REAL v[3][2])
00082 {
00083 i_[0].setValue(v[0][0], v[0][1]);
00084 i_[1].setValue(v[1][0], v[1][1]);
00085 i_[2].setValue(v[2][0], v[2][1]);
00086 }
00087
00088 inline void setValue(Interval v[3])
00089 {
00090 i_[0] = v[0];
00091 i_[1] = v[1];
00092 i_[2] = v[2];
00093 }
00094
00095 inline void setValue(const Interval& v1, const Interval& v2, const Interval& v3)
00096 {
00097 i_[0] = v1;
00098 i_[1] = v2;
00099 i_[2] = v3;
00100 }
00101
00102 inline void setValue(const Vec3f& v)
00103 {
00104 i_[0].setValue(v[0]);
00105 i_[1].setValue(v[1]);
00106 i_[2].setValue(v[2]);
00107 }
00108
00109 inline void setValue(FCL_REAL v[3])
00110 {
00111 i_[0].setValue(v[0]);
00112 i_[1].setValue(v[1]);
00113 i_[2].setValue(v[2]);
00114 }
00115
00116 IVector3 operator + (const IVector3& other) const;
00117 IVector3& operator += (const IVector3& other);
00118
00119 IVector3 operator - (const IVector3& other) const;
00120 IVector3& operator -= (const IVector3& other);
00121
00122 Interval dot(const IVector3& other) const;
00123 IVector3 cross(const IVector3& other) const;
00124
00125 Interval dot(const Vec3f& other) const;
00126 IVector3 cross(const Vec3f& other) const;
00127
00128 inline const Interval& operator [] (size_t i) const
00129 {
00130 return i_[i];
00131 }
00132
00133 inline Interval& operator [] (size_t i)
00134 {
00135 return i_[i];
00136 }
00137
00138 inline Vec3f getLow() const
00139 {
00140 return Vec3f(i_[0][0], i_[1][0], i_[2][0]);
00141 }
00142
00143 inline Vec3f getHigh() const
00144 {
00145 return Vec3f(i_[0][1], i_[1][1], i_[2][1]);
00146 }
00147
00148 void print() const;
00149 Vec3f center() const;
00150 FCL_REAL volumn() const;
00151 void setZero();
00152
00153 void bound(const Vec3f& v);
00154 void bound(const IVector3& v);
00155
00156 bool overlap(const IVector3& v) const;
00157 bool contain(const IVector3& v) const;
00158 };
00159
00160 IVector3 bound(const IVector3& i, const Vec3f& v);
00161
00162 IVector3 bound(const IVector3& i, const IVector3& v);
00163
00164 }
00165
00166 #endif