fMatrix4.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * The University of Tokyo
8  */
9 /*
10  * fMatrix4.h
11  * Create: Katsu Yamane, Univ. of Tokyo, 03.06.17
12  */
13 
14 #ifndef __F_MATRIX4_H__
15 #define __F_MATRIX4_H__
16 
17 #include "fMatrix3.h"
18 
19 class fVec4;
20 
21 class fMat44
22 {
23  friend class fVec4;
24 public:
25  fMat44() {
26  m_mat = 0;
27  m_vec = 0;
28  m_scalar = 1;
29  temp = 0;
30  }
31  fMat44(const fMat44& m) {
32  m_mat = m.m_mat;
33  m_vec = m.m_vec;
34  m_scalar = m.m_scalar;
35  temp = 0;
36  }
37  fMat44(const fMat33& m, const fVec3& v) {
38  m_mat = m;
39  m_vec = v;
40  m_scalar = 1;
41  temp = 0;
42  }
43  ~fMat44() {
44  }
45 
46  friend fMat44 inv(const fMat44& mat);
47  void inv(const fMat44& mat);
48 
49  fMat44 operator = (const fMat44& mat);
50  void operator = (double d);
51 
52  fMat33& Mat() {
53  return m_mat;
54  }
55  friend fMat33& Mat(fMat44& m) {
56  return m.m_mat;
57  }
58  fVec3& Vec() {
59  return m_vec;
60  }
61  friend fVec3& Vec(fMat44& m) {
62  return m.m_vec;
63  }
64  double& Scalar() {
65  return m_scalar;
66  }
67  friend double& Scalar(fMat44& m) {
68  return m.m_scalar;
69  }
70 
71  double& operator () (int i, int j);
72  double operator () (int i, int j) const;
73  void operator += (const fMat44&);
74  void operator -= (const fMat44&);
75  void operator *= (double);
76  void operator /= (double);
77  friend fMat44 operator - (const fMat44&);
78  friend fMat44 operator * (const fMat44&, const fMat44&);
79  friend fMat44 operator + (const fMat44&, const fMat44&);
80  friend fMat44 operator - (const fMat44&, const fMat44&);
81  friend fVec4 operator * (const fMat44&, const fVec4&);
82 
83 protected:
86  double m_scalar;
87  double temp;
88 };
89 
91 {
92  friend class fMat44;
93 public:
94  fVec4() {
95  m_vec = 0;
96  m_scalar = 1;
97  temp = 0;
98  }
99  fVec4(const fVec4& v) {
100  m_vec = v.m_vec;
101  m_scalar = v.m_scalar;
102  temp = 0;
103  }
104  fVec4(const fVec3& v) {
105  m_vec = v;
106  m_scalar = 1;
107  temp = 0;
108  }
109  ~fVec4() {
110  }
111 
112  fVec4 operator = (const fVec4& vec);
113  void operator = (double d);
114 
115  friend fVec3& Vec(fVec4& vec) {
116  return vec.m_vec;
117  }
118  fVec3& Vec() {
119  return m_vec;
120  }
121  friend double& Scalar(fVec4& vec) {
122  return vec.m_scalar;
123  }
124  double& Scalar() {
125  return m_scalar;
126  }
127  void set(const fVec3& v, double s) {
128  m_scalar = s;
129  m_vec = v;
130  }
131  void set(double s1, double s2, double s3, double s4) {
132  m_vec.set(s1, s2, s3);
133  m_scalar = s4;
134  }
135 
136  friend ostream& operator << (ostream& ost, const fVec4& mat);
137 
138  double& operator () (int i);
139  double operator () (int i) const;
140  void operator += (const fVec4&);
141  void operator -= (const fVec4&);
142  void operator *= (double);
143  void operator /= (double);
144  friend fVec4 operator - (const fVec4&);
145  friend double operator * (const fVec4&, const fVec4&);
146  friend fVec4 operator * (double, const fVec4&);
147  friend fVec4 operator + (const fVec4&, const fVec4&);
148  friend fVec4 operator - (const fVec4&, const fVec4&);
149 
150  void mul(fVec4& _vec, double d);
151 
152  void zero();
153 
154  void sub(const fVec4& vec1, const fVec4& vec2);
155  void add(const fVec4& vec1, const fVec4& vec2);
156 
157  void cross(const fVec4& vec1, const fVec4& vec2);
158 
159 protected:
161  double m_scalar;
162  double temp;
163 };
164 
165 #endif
3x3 matrix class.
Definition: fMatrix3.h:29
double m_scalar
Definition: fMatrix4.h:86
#define HRPBASE_EXPORT
png_voidp s1
Definition: png.h:2110
friend fVec3 & Vec(fVec4 &vec)
Definition: fMatrix4.h:115
void operator*=(double)
Definition: fMatrix4.cpp:89
friend fMat44 operator*(const fMat44 &, const fMat44 &)
Definition: fMatrix4.cpp:112
fVec3 & Vec()
Definition: fMatrix4.h:118
friend fMat44 operator+(const fMat44 &, const fMat44 &)
Definition: fMatrix4.cpp:121
friend double & Scalar(fVec4 &vec)
Definition: fMatrix4.h:121
fMat44(const fMat33 &m, const fVec3 &v)
Definition: fMatrix4.h:37
fVec3 & Vec()
Definition: fMatrix4.h:58
double & operator()(int i, int j)
Definition: fMatrix4.cpp:30
friend double & Scalar(fMat44 &m)
Definition: fMatrix4.h:67
fMat33 & Mat()
Definition: fMatrix4.h:52
void operator-=(const fMat44 &)
Definition: fMatrix4.cpp:82
void set(double *v)
Set element values from array or three values.
Definition: fMatrix3.h:314
png_uint_32 i
Definition: png.h:2735
~fVec4()
Definition: fMatrix4.h:109
fMat44 operator=(const fMat44 &mat)
Definition: fMatrix4.cpp:67
fVec4(const fVec4 &v)
Definition: fMatrix4.h:99
friend fVec3 & Vec(fMat44 &m)
Definition: fMatrix4.h:61
friend fMat44 operator-(const fMat44 &)
Definition: fMatrix4.cpp:103
double temp
Definition: fMatrix4.h:87
void operator+=(const fMat44 &)
Definition: fMatrix4.cpp:75
double & Scalar()
Definition: fMatrix4.h:124
def j(str, encoding="cp932")
fMat44(const fMat44 &m)
Definition: fMatrix4.h:31
fVec3 m_vec
Definition: fMatrix4.h:85
double m_scalar
Definition: fMatrix4.h:161
Definition: fMatrix4.h:90
std::ostream & operator<<(std::ostream &ost, const Point &p)
Definition: DistFuncs.cpp:3
3x3 matrix and 3-element vector classes.
fVec4()
Definition: fMatrix4.h:94
Vector3 cross(const Vector3 &v1, const Vector3 &v2)
Definition: Tvmet2Eigen.h:15
png_voidp png_voidp s2
Definition: png.h:2110
friend fMat44 inv(const fMat44 &mat)
fMat44()
Definition: fMatrix4.h:25
3-element vector class.
Definition: fMatrix3.h:206
double temp
Definition: fMatrix4.h:162
~fMat44()
Definition: fMatrix4.h:43
fVec4(const fVec3 &v)
Definition: fMatrix4.h:104
fVec3 m_vec
Definition: fMatrix4.h:160
friend fMat33 & Mat(fMat44 &m)
Definition: fMatrix4.h:55
fMat33 m_mat
Definition: fMatrix4.h:84
double & Scalar()
Definition: fMatrix4.h:64
void operator/=(double)
Definition: fMatrix4.cpp:96


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:37