Fix malformed CUDA version macro check
[alexxy/gromacs.git] / include / 3dview.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2004, The GROMACS development team,
6  * check out http://www.gromacs.org for more information.
7  * Copyright (c) 2012,2013, by the GROMACS development team, led by
8  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9  * others, as listed in the AUTHORS file in the top-level source
10  * directory and at http://www.gromacs.org.
11  *
12  * GROMACS is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public License
14  * as published by the Free Software Foundation; either version 2.1
15  * of the License, or (at your option) any later version.
16  *
17  * GROMACS is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with GROMACS; if not, see
24  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
26  *
27  * If you want to redistribute modifications to GROMACS, please
28  * consider that scientific software is very special. Version
29  * control is crucial - bugs must be traceable. We will be happy to
30  * consider code for inclusion in the official distribution, but
31  * derived work must not be called official GROMACS. Details are found
32  * in the README & COPYING files - if they are missing, get the
33  * official version at http://www.gromacs.org.
34  *
35  * To help us fund GROMACS development, we humbly ask that you cite
36  * the research papers on the package. Check out http://www.gromacs.org.
37  */
38
39 #ifndef _3dview_h
40 #define _3dview_h
41 #include "visibility.h"
42 #include "typedefs.h"
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 #define WW 3
49
50 typedef real vec4[4];
51
52 typedef real mat4[4][4];
53
54 typedef int  iv2[2];
55
56 typedef struct {
57     matrix box;
58     int    ecenter;     /* enum for centering, see pbc.h        */
59     vec4   eye, origin; /* The eye and origin position          */
60     mat4   proj;        /* Projection matrix            */
61     mat4   Rot;         /* Total rotation matrix                */
62     real   sc_x, sc_y;  /* Scaling for aspect ratio             */
63     mat4   RotP[DIM];   /* state for 3d rotations  */
64     mat4   RotM[DIM];
65 } t_3dview;
66
67 GMX_LIBGMX_EXPORT
68 extern void print_m4(FILE *fp, const char *s, mat4 A);
69
70 extern void print_v4(FILE *fp, char *s, int dim, real *a);
71
72 GMX_LIBGMX_EXPORT
73 extern void m4_op(mat4 m, rvec x, vec4 v);
74
75 extern void unity_m4(mat4 m);
76
77 GMX_LIBGMX_EXPORT
78 extern void mult_matrix(mat4 A, mat4 B, mat4 C);
79
80 GMX_LIBGMX_EXPORT
81 extern void rotate(int axis, real angle, mat4 A);
82
83 GMX_LIBGMX_EXPORT
84 extern void translate(real tx, real ty, real tz, mat4 A);
85
86 GMX_LIBGMX_EXPORT
87 extern void m4_op(mat4 m, rvec x, vec4 v);
88
89 extern void calculate_view(t_3dview *view);
90
91 extern t_3dview *init_view(matrix box);
92 /* Generate the view matrix from the eye pos and the origin,
93  * applying also the scaling for the aspect ration.
94  * There is no accompanying done_view routine: the struct can simply
95  * be sfree'd.
96  */
97
98 /* The following options are present on the 3d struct:
99  * zoom (scaling)
100  * rotate around the center of the box
101  * reset the view
102  */
103
104 extern gmx_bool zoom_3d(t_3dview *view, real fac);
105 /* Zoom in or out with factor fac, returns TRUE when zoom successful,
106  * FALSE otherwise.
107  */
108
109 extern void init_rotate_3d(t_3dview *view);
110 /* Initiates the state of 3d rotation matrices in the structure */
111
112 extern void rotate_3d(t_3dview *view, int axis, gmx_bool bPositive);
113 /* Rotate the eye around the center of the box, around axis */
114
115 extern void translate_view(t_3dview *view, int axis, gmx_bool bPositive);
116 /* Translate the origin at which one is looking */
117
118 extern void reset_view(t_3dview *view);
119 /* Reset the viewing to the initial view */
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif