00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __MMMATH_H__
00020 #define __MMMATH_H__
00021
00022 #include <boost/math/quaternion.hpp>
00023
00024 #include <eigen2/Eigen/Core>
00025 #include <eigen2/Eigen/Geometry>
00026 #include <OpenMesh/Core/Geometry/VectorT.hh>
00027
00031
00032 namespace MathNS {
00033
00034 USING_PART_OF_NAMESPACE_EIGEN
00035
00036 typedef OpenMesh::Vec3f Vector;
00037 typedef OpenMesh::Vec3f Point;
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 class EVector: public Vector3f {
00064 public:
00065 EVector(float x = 0, float y = 0, float z = 0) :
00066 Vector3f(x, y, z) {
00067 }
00068
00069 EVector(const Vector& v) :
00070 Vector3f(v[0], v[1], v[2]) {
00071 }
00072
00073 EVector(const Vector3f& v) :
00074 Vector3f(v) {
00075 }
00076 operator Vector() const {
00077 return Vector(x(), y(), z());
00078 }
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 EVector& operator+=(const Vector& v) {
00089 x() += v[0];
00090 y() += v[1];
00091 z() += v[2];
00092 return *this;
00093 }
00094 };
00095
00096 typedef Matrix3f EMatrix;
00097 }
00098
00099 inline MathNS::EVector operator+(const MathNS::Vector& v1, const MathNS::EVector& v2) {
00100 MathNS::EVector temp(v1);
00101 temp += v2;
00102 return temp;
00103 }
00104
00105 inline MathNS::EVector operator+(const MathNS::EVector& v1, const MathNS::Vector& v2) {
00106 MathNS::EVector temp(v1);
00107 temp += v2;
00108 return temp;
00109 }
00110
00111 #endif