ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/Vector3d.cpp
Revision: 1254
Committed: Wed Jun 9 16:16:33 2004 UTC (20 years, 1 month ago) by tim
File size: 788 byte(s)
Log Message:
1. adding some useful math classes(Mat3x3d, Vector3d, Quaternion, Euler3)
 these classes use anonymous union and struct to support
 double[3], double[3][3] and double[4]
2. adding roll constraint algorithm

File Contents

# Content
1 #include "Vector3d.hpp"
2 #include "Mat3x3d.hpp"
3
4 Vector3d& Vector3d::operator*= ( const Mat3x3d & m){
5 Vector3d temp;
6
7 temp = *this;
8 x = temp.x*m.element[0][0] + temp.y*m.element[1][0] + temp.z* m.element[2][0];
9 y = temp.x*m.element[0][1] + temp.y*m.element[1][1] + temp.z* m.element[2][1];
10 z = temp.x*m.element[0][2] + temp.y*m.element[1][2] + temp.z* m.element[2][2];
11
12 return *this;
13 }
14
15 Mat3x3d outProduct(const Vector3d& v1, const Vector3d& v2){
16 Mat3x3d m;
17
18 m.element[0][0] = v1.x * v2.x;
19 m.element[0][1] = v1.x * v2.y;
20 m.element[0][2] = v1.x * v2.z;
21
22 m.element[1][0] = v1.y * v2.x;
23 m.element[1][1] = v1.y * v2.y;
24 m.element[1][2] = v1.y * v2.z;
25
26 m.element[2][0] = v1.z * v2.x;
27 m.element[2][1] = v1.z * v2.y;
28 m.element[2][2] = v1.z * v2.z;
29
30 return m;
31 }

Properties

Name Value
svn:executable *