-
Notifications
You must be signed in to change notification settings - Fork 6
/
Affine3.ts
209 lines (183 loc) · 5.85 KB
/
Affine3.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import { float_type, int, Mat, Mat3, Mat4, Vec3 } from './_types'
/**
* It represents a 4x4 homogeneous transformation matrix `$T$`
*
* `\\[T = \\begin{bmatrix} R & t\\\\ 0 & 1\\\\ \\end{bmatrix} \\]`
*
* where `$R$` is a 3x3 rotation matrix and `$t$` is a 3x1 translation vector.
*
* You can specify `$R$` either by a 3x3 rotation matrix or by a 3x1 rotation vector, which is
* converted to a 3x3 rotation matrix by the Rodrigues formula.
*
* To construct a matrix `$T$` representing first rotation around the axis `$r$` with rotation angle
* `$|r|$` in radian (right hand rule) and then translation by the vector `$t$`, you can use
*
* ```cpp
* cv::Vec3f r, t;
* cv::Affine3f T(r, t);
* ```
*
* If you already have the rotation matrix `$R$`, then you can use
*
* ```cpp
* cv::Matx33f R;
* cv::Affine3f T(R, t);
* ```
*
* To extract the rotation matrix `$R$` from `$T$`, use
*
* ```cpp
* cv::Matx33f R = T.rotation();
* ```
*
* To extract the translation vector `$t$` from `$T$`, use
*
* ```cpp
* cv::Vec3f t = T.translation();
* ```
*
* To extract the rotation vector `$r$` from `$T$`, use
*
* ```cpp
* cv::Vec3f r = T.rvec();
* ```
*
* Note that since the mapping from rotation vectors to rotation matrices is many to one. The returned
* rotation vector is not necessarily the one you used before to set the matrix.
*
* If you have two transformations `$T = T_1 * T_2$`, use
*
* ```cpp
* cv::Affine3f T, T1, T2;
* T = T2.concatenate(T1);
* ```
*
* To get the inverse transform of `$T$`, use
*
* ```cpp
* cv::Affine3f T, T_inv;
* T_inv = T.inv();
* ```
*
* Source:
* [opencv2/core/affine.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core/affine.hpp#L129).
*
*/
export declare class Affine3 {
public matrix: Mat4
public constructor()
public constructor(affine: Mat4)
/**
* The resulting 4x4 matrix is
*
* `\\[ \\begin{bmatrix} R & t\\\\ 0 & 1\\\\ \\end{bmatrix} \\]`
*
* @param R 3x3 rotation matrix.
*
* @param t 3x1 translation vector.
*/
public constructor(R: Mat3, t?: Vec3)
/**
* Rodrigues vector.
*
* The last row of the current matrix is set to [0,0,0,1].
*
* @param rvec 3x1 rotation vector. Its direction indicates the rotation axis and its length
* indicates the rotation angle in radian (using right hand rule).
*
* @param t 3x1 translation vector.
*/
public constructor(rvec: Vec3, t?: Vec3)
/**
* Combines all constructors above. Supports 4x4, 3x4, 3x3, 1x3, 3x1 sizes of data matrix.
*
* The last row of the current matrix is set to [0,0,0,1] when data is not 4x4.
*
* @param data 1-channel matrix. when it is 4x4, it is copied to the current matrix and t is not
* used. When it is 3x4, it is copied to the upper part 3x4 of the current matrix and t is not used.
* When it is 3x3, it is copied to the upper left 3x3 part of the current matrix. When it is 3x1 or
* 1x3, it is treated as a rotation vector and the Rodrigues formula is used to compute a 3x3 rotation
* matrix.
*
* @param t 3x1 translation vector. It is used only when data is neither 4x4 nor 3x4.
*/
public constructor(data: Mat, t?: Vec3)
public constructor(vals: float_type)
public cast(arg401: any): Affine3
public concatenate(affine: Affine3): Affine3
/**
* the inverse of the current matrix.
*/
public inv(method?: int): Affine3
/**
* Copy the 3x3 matrix L to the upper left part of the current matrix
*
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
*
* @param L 3x3 matrix.
*/
public linear(L: Mat3): Mat3
/**
* the upper left 3x3 part
*/
public linear(): Mat3
public rotate(R: Mat3): Affine3
public rotate(rvec: Vec3): Affine3
/**
* Rotation matrix.
*
* Copy the rotation matrix to the upper left 3x3 part of the current matrix. The remaining elements
* of the current matrix are not changed.
*
* @param R 3x3 rotation matrix.
*/
public rotation(R: Mat3): Mat3
/**
* Rodrigues vector.
*
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
*
* @param rvec 3x1 rotation vector. The direction indicates the rotation axis and its length
* indicates the rotation angle in radian (using the right thumb convention).
*/
public rotation(rvec: Vec3): Vec3
/**
* Combines rotation methods above. Supports 3x3, 1x3, 3x1 sizes of data matrix.
*
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
*
* @param data 1-channel matrix. When it is a 3x3 matrix, it sets the upper left 3x3 part of the
* current matrix. When it is a 1x3 or 3x1 matrix, it is used as a rotation vector. The Rodrigues
* formula is used to compute the rotation matrix and sets the upper left 3x3 part of the current
* matrix.
*/
public rotation(data: Mat): Mat
/**
* the upper left 3x3 part
*/
public rotation(): Mat3
/**
* Rodrigues vector.
*
* a vector representing the upper left 3x3 rotation matrix of the current matrix.
*
* Since the mapping between rotation vectors and rotation matrices is many to one, this function
* returns only one rotation vector that represents the current rotation matrix, which is not
* necessarily the same one set by `[rotation(const Vec3& rvec)]`.
*/
public rvec(): Vec3
public translate(t: Vec3): Affine3
/**
* Copy t to the first three elements of the last column of the current matrix
*
* It sets the upper right 3x1 part of the matrix. The remaining part is unaffected.
*
* @param t 3x1 translation vector.
*/
public translation(t: Vec3): Vec3
/**
* the upper right 3x1 part
*/
public translation(): Vec3
public static Identity(): Affine3
}