00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef __GNUC__
00025 #warning You are including deprecated math stuff
00026 #endif
00027
00028 enum {Dimension = SizeAtCompileTime};
00029 typedef typename ei_to_vcgtype<Matrix>::type EquivVcgType;
00030 typedef vcg::VoidType ParamType;
00031 typedef Matrix PointType;
00032 using Base::V;
00033
00034
00035
00036 operator EquivVcgType& () { return *reinterpret_cast<EquivVcgType*>(this); }
00037 operator const EquivVcgType& () const { return *reinterpret_cast<const EquivVcgType*>(this); }
00038
00040
00041
00042
00043 template<typename OtherDerived>
00044 inline void Import(const MatrixBase<OtherDerived>& b)
00045 {
00046 ei_import_selector<Matrix,OtherDerived>::run(*this,b.derived());
00047 }
00048
00050 template<typename OtherDerived>
00051 static inline Matrix Construct(const MatrixBase<OtherDerived>& b)
00052 { Matrix p; p.Import(b); return p; }
00053
00055 template<typename OtherDerived>
00056 inline void ImportHomo(const MatrixBase<OtherDerived>& b)
00057 {
00058 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Matrix);
00059 EIGEN_STATIC_ASSERT_FIXED_SIZE(Matrix);
00060 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,SizeAtCompileTime-1);
00061
00062 this->template start<SizeAtCompileTime-1> = b;
00063 data()[SizeAtCompileTime-1] = Scalar(1.0);
00064 }
00065
00067 template<typename OtherDerived>
00068 static inline Matrix ConstructHomo(const MatrixBase<OtherDerived>& b)
00069 { Matrix p; p.ImportHomo(b); return p; }
00070
00071 inline const Scalar &X() const { return data()[0]; }
00072 inline const Scalar &Y() const { return data()[1]; }
00073 inline const Scalar &Z() const { assert(SizeAtCompileTime>2); return data()[2]; }
00074 inline Scalar &X() { return data()[0]; }
00075 inline Scalar &Y() { return data()[1]; }
00076 inline Scalar &Z() { assert(SizeAtCompileTime>2); return data()[2]; }
00077
00079 inline Scalar& W() { return data()[SizeAtCompileTime-1]; }
00081 inline const Scalar& W() const { return data()[SizeAtCompileTime-1]; }
00082
00084 EIGEN_DEPRECATED Scalar* V() { return data(); }
00086 EIGEN_DEPRECATED const Scalar* V() const { return data(); }
00087
00089
00090 EIGEN_DEPRECATED inline const Scalar& V( const int i ) const
00091 {
00092 assert(i>=0 && i<SizeAtCompileTime);
00093 return data()[i];
00094 }
00095
00096
00097
00098
00099
00102 inline Matrix LocalToGlobal(ParamType p) const { return *this; }
00105 inline ParamType GlobalToLocal(PointType ) const { return ParamType(); }
00106
00117 void ToPolar(Scalar &ro, Scalar &theta, Scalar &phi) const
00118 {
00119 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix,3);
00120 ro = this->norm();
00121 theta = (Scalar)atan2(data()[2], data()[0]);
00122 phi = (Scalar)asin(data()[1]/ro);
00123 }
00124
00135 void FromPolar(const Scalar &ro, const Scalar &theta, const Scalar &phi)
00136 {
00137 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix,3);
00138 data()[0]= ro*ei_cos(theta)*ei_cos(phi);
00139 data()[1]= ro*ei_sin(phi);
00140 data()[2]= ro*ei_sin(theta)*ei_cos(phi);
00141 }