File: transform3d.h

package info (click to toggle)
gnome-chemistry-utils 0.14.9-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 17,836 kB
  • ctags: 7,337
  • sloc: cpp: 72,977; sh: 11,381; xml: 6,304; makefile: 1,663; ansic: 1,061
file content (125 lines) | stat: -rw-r--r-- 3,243 bytes parent folder | download | duplicates (4)
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
// -*- C++ -*-

/*
 * Gnome Chemistry Utils
 * transform3d.h - Handle 3D transformations in space groups.
 *
 * Copyright (C) 2007-2010 by Jean Bréfort
 *
 * This file was originally part of the Open Babel project.
 * For more information, see <http://openbabel.sourceforge.net/>
 *
 * 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.
 */

#ifndef GCU_TRANSFORM_3D_H
#define GCU_TRANSFORM_3D_H

#include "matrix.h"
#include "vector.h"
#include <list>
#include <string>

namespace gcu
{

/*!\class Transform3d gcu/transform3d.h
@brief Handle 3D transformations, such as space group definitions
@since version 0.12
@sa SpaceGroup

Describes a spatial trnasformation obtained by the combination of a symmetry
operation and a translation.
*/
class Transform3d: private Matrix, private Vector
{
public:
/*!
The default constructor. Initializes all coordinates to 0.
*/
	Transform3d ();
/*!
@param m a symmetry operation matrix.
@param v a translation vector.

Constructs a new Transform3d from its symmetry operation matrix and its
translation vector.
*/
	Transform3d (Matrix const &m, Vector const &v);
/*!
@param s a scalar.

Constructs a new Transform3d from a scalar matrix and a null translation vector.
*/
	Transform3d (double s);
/*!
@param row1 first matrix row.
@param row2 second matrix row.
@param row3 third matrix row.
@param translation the translation vector.

Constructs a new Transform3d from the three rows of its symmetry operation
matrix and its translation vector.
*/
	Transform3d (Vector row1, Vector row2, Vector row3, Vector translation);
/*!
@param d the coefficients of a symmetry operation matrix.
@param t the coefficients of a translation vector.

Constructs a new Transform3d from the coefficients of its symmetry operation
matrix and its translation vector.
*/
	Transform3d (double d[3][3], double t[3]);

/*!
The destructor.
*/
	virtual ~Transform3d ();

/*!
@param v the vector to transform.

Transforms a vector (multiply by the symmetry matrix and add the
translation vector).
@return the transformed vector.
*/
	Vector operator* (Vector const &v) const;

/*!
@param t a Transform3d.

Combines two Transform3d instances a vector.
@return the combination of the two transforms.
*/
	Transform3d operator* (Transform3d const &t) const;

/*!
@return the transform dexcription in CIF convention, such as "x,y,z".
*/
	std::string DescribeAsString() const;
/*!
@return the transform description in CML convention, limiting to the twelve
first values, such as "1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0".
*/
	std::string DescribeAsValues() const;

/*!
Ensure that the translation vector coordinates are all in the interval [0,1[.
*/
	void Normalize();
};

}

#endif // GCU_TRANSFORM_3D_H

//! \file transform3d.h
//! \brief Handle 3D transformations in space groups.