Bsoft
2.1.0
Bernard's software package
Transform.h
Go to the documentation of this file.
1
9
#ifndef _Transform_
10
#define _Transform_
11
12
#include "
Vector3.h
"
13
#include "
Quaternion.h
"
14
#include "
Matrix3.h
"
15
#include "
Matrix.h
"
16
17
/************************************************************************
18
@Object: class Transform
19
@Description:
20
Transformation parameter structure.
21
@Features:
22
This defines a full affine transformation.
23
*************************************************************************/
24
class
Transform
{
25
public
:
26
Transform
*
next
;
// Next in linked list
27
Vector3<double>
origin
;
// Rotation origin
28
Vector3<double>
axis
;
// Rotation axis
29
double
angle
;
// Rotation angle
30
Vector3<double>
trans
;
// Translation
31
Vector3<double>
scale
;
// Scale
32
double
fom
;
// A figure-of-merit associated with the transform
33
private
:
34
void
from_quaternion(
Quaternion
q) {
35
next
= NULL;
origin
=0;
scale
=
Vector3<double>
(1, 1, 1);
trans
= 0;
36
axis
= q.
axis
();
37
axis
.
normalize
();
38
angle
= 2*acos(q[0]);
39
fom
= 0;
40
}
41
public
:
42
Transform
() {
next
=NULL;
origin
=0;
scale
=
Vector3<double>
(1, 1, 1);
43
trans
= 0;
axis
=
Vector3<double>
(0, 0, 1);
angle
= 0;
fom
= 0; }
44
Transform
(
Quaternion
& q) {
45
from_quaternion(q);
46
}
47
Transform
(
Matrix3
& m) {
48
Quaternion
q = m.
quaternion
();
49
from_quaternion(q);
50
}
51
Vector3<double>
operator*
(
Vector3<double>
v) {
52
Matrix3
m(
Matrix3
(
axis
,
angle
));
53
v -=
origin
;
54
v = m * v;
55
v +=
origin
+
trans
;
56
return
v;
57
}
58
} ;
59
#endif
60
61
// Function prototypes
62
Transform
transform_matrix_solve
(
Matrix
a, vector<double>& bx,
63
vector<double>& by, vector<double>& bz,
int
flag);
64
Transform
transform_find
(
int
n,
Vector3<double>
* vector1,
Vector3<double>
* vector2,
int
shift);
65
Transform::Transform
Transform(Quaternion &q)
Definition:
Transform.h:44
Quaternion
Definition:
Quaternion.h:25
Transform::operator*
Vector3< double > operator*(Vector3< double > v)
Definition:
Transform.h:51
Transform::Transform
Transform()
Definition:
Transform.h:42
Vector3< double >
Matrix3.h
3x3 Matrix manipulation functions
Transform::origin
Vector3< double > origin
Definition:
Transform.h:27
Transform::fom
double fom
Definition:
Transform.h:32
transform_find
Transform transform_find(int n, Vector3< double > *vector1, Vector3< double > *vector2, int shift)
Determines the transformation between two sets of vectors.
Definition:
Transform.cpp:109
Matrix3
Definition:
Matrix3.h:18
Vector3::normalize
double normalize()
Definition:
Vector3.h:238
Quaternion.h
Class for quaternions.
Vector3.h
Class for 3-value vectors.
Transform::scale
Vector3< double > scale
Definition:
Transform.h:31
transform_matrix_solve
Transform transform_matrix_solve(Matrix a, vector< double > &bx, vector< double > &by, vector< double > &bz, int flag)
Solves a 3D geometry fit matrix.
Definition:
Transform.cpp:30
Transform::trans
Vector3< double > trans
Definition:
Transform.h:30
Quaternion::axis
Vector3< double > axis()
Definition:
Quaternion.h:144
Matrix.h
Generalized matrix class.
Transform::axis
Vector3< double > axis
Definition:
Transform.h:28
Transform::angle
double angle
Definition:
Transform.h:29
Transform::Transform
Transform(Matrix3 &m)
Definition:
Transform.h:47
Transform
Definition:
Transform.h:24
Matrix
Definition:
Matrix.h:22
Matrix3::quaternion
Quaternion quaternion() const
Definition:
Matrix3.h:129
Transform::next
Transform * next
Definition:
Transform.h:26
include
Transform.h
Generated on Mon Oct 26 2020 09:24:42 for Bsoft by
1.8.20