fMatrix4.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
00003  * All rights reserved. This program is made available under the terms of the
00004  * Eclipse Public License v1.0 which accompanies this distribution, and is
00005  * available at http://www.eclipse.org/legal/epl-v10.html
00006  * Contributors:
00007  * The University of Tokyo
00008  */
00009 /*
00010  * fMatrix4.h
00011  * Create: Katsu Yamane, Univ. of Tokyo, 03.06.17
00012  */
00013 
00014 #ifndef __F_MATRIX4_H__
00015 #define __F_MATRIX4_H__
00016 
00017 #include "fMatrix3.h"
00018 
00019 class fVec4;
00020 
00021 class fMat44
00022 {
00023         friend class fVec4;
00024 public:
00025         fMat44() {
00026                 m_mat = 0;
00027                 m_vec = 0;
00028                 m_scalar = 1;
00029                 temp = 0;
00030         }
00031         fMat44(const fMat44& m) {
00032                 m_mat = m.m_mat;
00033                 m_vec = m.m_vec;
00034                 m_scalar = m.m_scalar;
00035                 temp = 0;
00036         }
00037         fMat44(const fMat33& m, const fVec3& v) {
00038                 m_mat = m;
00039                 m_vec = v;
00040                 m_scalar = 1;
00041                 temp = 0;
00042         }
00043         ~fMat44() {
00044         }
00045 
00046         friend fMat44 inv(const fMat44& mat);
00047         void inv(const fMat44& mat);
00048 
00049         fMat44 operator = (const fMat44& mat);
00050         void operator = (double d);
00051         
00052         fMat33& Mat() {
00053                 return m_mat;
00054         }
00055         friend fMat33& Mat(fMat44& m) {
00056                 return m.m_mat;
00057         }
00058         fVec3& Vec() {
00059                 return m_vec;
00060         }
00061         friend fVec3& Vec(fMat44& m) {
00062                 return m.m_vec;
00063         }
00064         double& Scalar() {
00065                 return m_scalar;
00066         }
00067         friend double& Scalar(fMat44& m) {
00068                 return m.m_scalar;
00069         }
00070 
00071         double& operator () (int i, int j);
00072         double operator () (int i, int j) const;
00073         void operator += (const fMat44&);
00074         void operator -= (const fMat44&);
00075         void operator *= (double);
00076         void operator /= (double);
00077         friend fMat44 operator - (const fMat44&);
00078         friend fMat44 operator * (const fMat44&, const fMat44&);
00079         friend fMat44 operator + (const fMat44&, const fMat44&);
00080         friend fMat44 operator - (const fMat44&, const fMat44&);
00081         friend fVec4 operator * (const fMat44&, const fVec4&);
00082 
00083 protected:
00084         fMat33 m_mat;
00085         fVec3 m_vec;
00086         double m_scalar;
00087         double temp;
00088 };
00089 
00090 class HRPBASE_EXPORT fVec4
00091 {
00092         friend class fMat44;
00093 public:
00094         fVec4() {
00095                 m_vec = 0;
00096                 m_scalar = 1;
00097                 temp = 0;
00098         }
00099         fVec4(const fVec4& v) {
00100                 m_vec = v.m_vec;
00101                 m_scalar = v.m_scalar;
00102                 temp = 0;
00103         }
00104         fVec4(const fVec3& v) {
00105                 m_vec = v;
00106                 m_scalar = 1;
00107                 temp = 0;
00108         }
00109         ~fVec4() {
00110         }
00111 
00112         fVec4 operator = (const fVec4& vec);
00113         void operator = (double d);
00114 
00115         friend fVec3& Vec(fVec4& vec) {
00116                 return vec.m_vec;
00117         }
00118         fVec3& Vec() {
00119                 return m_vec;
00120         }
00121         friend double& Scalar(fVec4& vec) {
00122                 return vec.m_scalar;
00123         }
00124         double& Scalar() {
00125                 return m_scalar;
00126         }
00127         void set(const fVec3& v, double s) {
00128                 m_scalar = s;
00129                 m_vec = v;
00130         }
00131         void set(double s1, double s2, double s3, double s4) {
00132                 m_vec.set(s1, s2, s3);
00133                 m_scalar = s4;
00134         }
00135 
00136         friend ostream& operator << (ostream& ost, const fVec4& mat);
00137         
00138         double& operator () (int i);
00139         double operator () (int i) const;
00140         void operator += (const fVec4&);
00141         void operator -= (const fVec4&);
00142         void operator *= (double);
00143         void operator /= (double);
00144         friend fVec4 operator - (const fVec4&);
00145         friend double operator * (const fVec4&, const fVec4&);
00146         friend fVec4 operator * (double, const fVec4&);
00147         friend fVec4 operator + (const fVec4&, const fVec4&);
00148         friend fVec4 operator - (const fVec4&, const fVec4&);
00149 
00150         void mul(fVec4& _vec, double d);
00151 
00152         void zero();
00153 
00154         void sub(const fVec4& vec1, const fVec4& vec2);
00155         void add(const fVec4& vec1, const fVec4& vec2);
00156 
00157         void cross(const fVec4& vec1, const fVec4& vec2);
00158         
00159 protected:
00160         fVec3 m_vec;
00161         double m_scalar;
00162         double temp;
00163 };
00164 
00165 #endif


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sun Apr 2 2017 03:43:53