File: matrix2d.h

package info (click to toggle)
gnome-chemistry-utils 0.14.15-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,080 kB
  • sloc: cpp: 77,295; xml: 6,360; sh: 4,248; makefile: 1,573; ansic: 1,061
file content (91 lines) | stat: -rw-r--r-- 2,547 bytes parent folder | download | duplicates (6)
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
// -*- C++ -*-

/*
 * Gnome Chemistry Utils
 * matrix2d.h
 *
 * Copyright (C) 2004-2008 Jean Bréfort <jean.brefort@normalesup.org>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
 * USA
 */

#ifndef GCU_MATRIX2D_H
#define GCU_MATRIX2D_H
/*!\file*/

namespace gcu
{

/*!\class Matrix2D gcu/matrix2d.h
This class provides some operations related to transformations in a plane. The matrices are 2x2.
*/
class Matrix2D
{
public:

/*!
Default constructor. Members are not initialized. This constructor is rarely used.
*/
	Matrix2D();
/*!
The destructor of Matrix.
*/
	virtual ~Matrix2D();
/*!
@param Angle: rotation angle.
@param Deg: if true, Angle is expressed in degrees, otherwise in radians.
Default is true.

Constructs a Matrix2D representing a rotation.
*/
	Matrix2D(double Angle, bool Deg = true);
/*!
@param x11: value to use at first line and first column of the matrix.
@param x12: value to use at first line and second column of the matrix.
@param x21: value to use at second line and first column of the matrix.
@param x22: value to use at second line and second column of the matrix.

Constructs a matrix from its components.
*/
	Matrix2D(double x11, double x12, double x21, double x22);
/*!
@param cMat: a Matrix2D instance to use in the multiplication.

The matricial multiplication operator.
*/
	Matrix2D& operator*(Matrix2D& cMat);
/*!
@param cMat: the Matrix2D instance to copy.

Copies a Matrix instance into another one.
*/
	Matrix2D& operator=(Matrix2D& cMat);
/*!
@param dx: the x coordinate.
@param dy: the y coordinate.

Initially, dx and dy are the components of the vector to transform (multiply) by the matrix and
after execution of this method, dx, dy and dz are the components of the transformed vector. So initial values are lost.
*/
	void Transform(double &dx, double &dy);

private :
	double x[2][2];
};

}	//namespace gcu

#endif //GCRYSTAL_MATRIX2D_H