1 /*
2     This file is a part of the RepSnapper project.
3     Copyright (C) 2010 Kulitorum
4 
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License along
16     with this program; if not, write to the Free Software Foundation, Inc.,
17     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 #pragma once
21 
22 #include "stdafx.h"
23 
24 
25 class Transform3D
26 {
27 	Matrix4d m_transform;
28 	Vector3d xyz_scale;
29 	void update_transform();
30 public:
31   Transform3D();
32 	Matrix4d transform;
33 
34 	void identity();
35 	Matrix4d getTransform() const;
36 	Matrix4f getFloatTransform() const;
37 	Vector3d getTranslation() const;
38 	Matrix4d getInverse() const;
39 	void setTransform(const Matrix4f &matrf);
40 	void scale(double x);
41 	void scale_x(double x);
42 	void scale_y(double x);
43 	void scale_z(double x);
44 	void move(const Vector3d &delta);
45 	void rotate(const Vector3d &center, double x, double y, double z);
46 	void rotate_to(const Vector3d &center, double x, double y, double z);
47 	void rotate(const Vector3d &axis, double angle);
48 	void rotate(const Vector3d &center, const Vector3d &axis, double angle);
49 	void rotate_to(const Vector3d &center, const Vector3d &axis, double angle);
50 	double getRotX() const;
51 	double getRotY() const;
52 	double getRotZ() const;
get_scale()53 	double get_scale()   const {return 1/transform(3,3);};
get_scale_x()54 	double get_scale_x() const {return xyz_scale(0);};
get_scale_y()55 	double get_scale_y() const {return xyz_scale(1);};
get_scale_z()56 	double get_scale_z() const {return xyz_scale(2);};
57 };
58 
59