1 /* EXTRAITS DE LA LICENCE 2 Copyright CEA, contributeurs : Luc BILLARD et Damien 3 CALISTE, laboratoire L_Sim, (2001-2005) 4 5 Adresse mèl : 6 BILLARD, non joignable par mèl ; 7 CALISTE, damien P caliste AT cea P fr. 8 9 Ce logiciel est un programme informatique servant à visualiser des 10 structures atomiques dans un rendu pseudo-3D. 11 12 Ce logiciel est régi par la licence CeCILL soumise au droit français et 13 respectant les principes de diffusion des logiciels libres. Vous pouvez 14 utiliser, modifier et/ou redistribuer ce programme sous les conditions 15 de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA 16 sur le site "http://www.cecill.info". 17 18 Le fait que vous puissiez accéder à cet en-tête signifie que vous avez 19 pris connaissance de la licence CeCILL, et que vous en avez accepté les 20 termes (cf. le fichier Documentation/licence.fr.txt fourni avec ce logiciel). 21 */ 22 23 /* LICENCE SUM UP 24 Copyright CEA, contributors : Luc BILLARD et Damien 25 CALISTE, laboratoire L_Sim, (2001-2005) 26 27 E-mail address: 28 BILLARD, not reachable any more ; 29 CALISTE, damien P caliste AT cea P fr. 30 31 This software is a computer program whose purpose is to visualize atomic 32 configurations in 3D. 33 34 This software is governed by the CeCILL license under French law and 35 abiding by the rules of distribution of free software. You can use, 36 modify and/ or redistribute the software under the terms of the CeCILL 37 license as circulated by CEA, CNRS and INRIA at the following URL 38 "http://www.cecill.info". 39 40 The fact that you are presently reading this means that you have had 41 knowledge of the CeCILL license and that you accept its terms. You can 42 find a copy of this licence shipped with this software at Documentation/licence.en.txt. 43 */ 44 45 #ifndef TOOLMATRIX_H 46 #define TOOLMATRIX_H 47 48 #include <glib.h> 49 #include <glib-object.h> 50 51 G_BEGIN_DECLS 52 53 /** 54 * TOOL_XYZ_MASK_X: 55 * 56 * This value can be used to create a mask for methods that 57 * require one for reading xyz coordinates array. This value actually 58 * correspond to the x direction. 59 * 60 * Since: 3.3 61 */ 62 #define TOOL_XYZ_MASK_X (1 << 0) 63 /** 64 * TOOL_XYZ_MASK_Y: 65 * 66 * This value can be used to create a mask for methods that 67 * require one for reading xyz coordinates array. This value actually 68 * correspond to the y direction. 69 * 70 * Since: 3.3 71 */ 72 #define TOOL_XYZ_MASK_Y (1 << 1) 73 /** 74 * TOOL_XYZ_MASK_Z: 75 * 76 * This value can be used to create a mask for methods that 77 * require one for reading xyz coordinates array. This value actually 78 * correspond to the z direction. 79 * 80 * Since: 3.3 81 */ 82 #define TOOL_XYZ_MASK_Z (1 << 2) 83 /** 84 * TOOL_XYZ_MASK_ALL: 85 * 86 * This value can be used to create a mask for methods that 87 * require one for reading xyz coordinates array. This value is a 88 * shortcut for #TOOL_XYZ_MASK_X | #TOOL_XYZ_MASK_Y | #TOOL_XYZ_MASK_Z. 89 * 90 * Since: 3.3 91 */ 92 #define TOOL_XYZ_MASK_ALL (7) 93 94 /** 95 * ToolXyzDir: 96 * @TOOL_XYZ_X: the x axis; 97 * @TOOL_XYZ_Y: the y axis; 98 * @TOOL_XYZ_Z: the z axis. 99 * 100 * The three space axis. 101 * 102 * Since: 3.8 103 */ 104 typedef enum { 105 TOOL_XYZ_X, 106 TOOL_XYZ_Y, 107 TOOL_XYZ_Z 108 } ToolXyzDir; 109 110 /** 111 * TOOL_PI180: 112 * 113 * Value of pi / 180. 114 */ 115 #define TOOL_PI180 0.017453292522 116 117 void tool_matrix_setIdentity(float mat[3][3]); 118 void tool_matrix_set(float mat[3][3], float orig[3][3]); 119 void tool_matrix_dtof(float mf[3][3], double md[3][3]); 120 void tool_matrix_productMatrix(float matRes[3][3], float matA[3][3], float matB[3][3]); 121 void tool_matrix_productVector(float vectRes[3], float mat[3][3], float vect[3]); 122 gboolean tool_matrix_invert(float inv[3][3], float mat[3][3]); 123 float tool_matrix_determinant(float mat[3][3]); 124 void tool_matrix_rotate(float mat[3][3], float angle, ToolXyzDir dir); 125 126 gboolean tool_matrix_reducePrimitiveVectors(double reduced[6], double full[3][3]); 127 gboolean tool_matrix_getRotationFromFull(float rot[3][3], 128 double full[3][3], double box[6]); 129 130 /** 131 * ToolMatrixSphericalCoord: 132 * @TOOL_MATRIX_SPHERICAL_MODULUS: the modulus of a spherical vector. 133 * @TOOL_MATRIX_SPHERICAL_THETA: the theta angle of a spherical vector. 134 * @TOOL_MATRIX_SPHERICAL_PHI: the phi angle of a spherical vector. 135 * 136 * This is used to access the ordering of the vectors with 137 * tool_matrix_cartesianToSpherical() or with 138 * tool_matrix_sphericalToCartesian(). 139 * 140 * Since: 3.6 141 */ 142 typedef enum 143 { 144 TOOL_MATRIX_SPHERICAL_MODULUS, 145 TOOL_MATRIX_SPHERICAL_THETA, 146 TOOL_MATRIX_SPHERICAL_PHI 147 } ToolMatrixSphericalCoord; 148 void tool_matrix_cartesianToSpherical(float spherical[3], const float cartesian[3]); 149 void tool_matrix_sphericalToCartesian(float cartesian[3], const float spherical[3]); 150 float tool_vector_spherical(const float cart[3], ToolMatrixSphericalCoord at); 151 152 /** 153 * ToolMatrixScalingFlag: 154 * @TOOL_MATRIX_SCALING_LINEAR: a linear convertion from [min,max] to [0,1] ; 155 * @TOOL_MATRIX_SCALING_LOG: a TOOL_MATRIX_SCALING_LOGic transformation from [min,max] to [0,1], the 156 * formula is -(f(x) - f(m) / f(m) where f(x) = 157 * ln((x-xmin)/(xmax-xmin)) ; 158 * @TOOL_MATRIX_SCALING_ZERO_CENTRED_LOG: a TOOL_MATRIX_SCALING_LOGic transformation for data that are 159 * zero centred, the formula is 160 * 0.5+s*(log(MAX*SEUIL)-log(max(abs(x),MAX*SEUIL)))/(2*log(SEUIL)) 161 * where s is the sign, max=max(xmax,-xmin) and seuil a parameter 162 * (1e-5). 163 * @TOOL_MATRIX_SCALING_N_VALUES: number of available scale functions. 164 * 165 * Flag used to specify the transformation for maps, see scalarFieldDraw_map() 166 * routine. 167 * 168 * Since: 3.4 169 */ 170 typedef enum 171 { 172 TOOL_MATRIX_SCALING_LINEAR, 173 TOOL_MATRIX_SCALING_LOG, 174 TOOL_MATRIX_SCALING_ZERO_CENTRED_LOG, 175 TOOL_MATRIX_SCALING_N_VALUES 176 } ToolMatrixScalingFlag; 177 /** 178 * tool_matrix_getScaledValue: 179 * @x: the initial value ; 180 * @minmax: the boundaries for the @x argument. 181 * 182 * Transform @x into [0;1] using the given @minmax values. 183 * 184 * Returns: a value into [0;1]. 185 * 186 * Since: 3.4 187 */ 188 typedef float (*tool_matrix_getScaledValue)(float x, float minmax[2]); 189 float tool_matrix_getScaledLinear(float x, float minmax[2]); 190 float tool_matrix_getScaledLog(float x, float minmax[2]); 191 float tool_matrix_getScaledZeroCentredLog(float x, float minmax[2]); 192 193 float tool_matrix_getScaledLinearInv(float x, float minmax[2]); 194 float tool_matrix_getScaledLogInv(float x, float minmax[2]); 195 float tool_matrix_getScaledZeroCentredLogInv(float x, float minmax[2]); 196 197 gboolean tool_matrix_getInter2D(float *lambda, 198 float a[2], float b[2], float A[2], float B[2]); 199 gboolean tool_matrix_getInter2DFromList(float i[2], float *lambda, 200 float a[2], float b[2], GList *set); 201 202 /* These structures are used for bindings. */ 203 #define TOOL_TYPE_VECTOR (tool_vector_get_type()) 204 GType tool_vector_get_type(void); 205 206 gboolean tool_vector_set(float dest[3], const float orig[3]); 207 208 float* tool_vector_new(const float orig[3]); 209 210 /* typedef gfloat[3] ToolVector; */ 211 212 /* typedef struct _ToolVector ToolVector; */ 213 /* struct _ToolVector */ 214 /* { */ 215 /* float vect[3]; */ 216 /* }; */ 217 typedef struct _ToolGridSize ToolGridSize; 218 struct _ToolGridSize 219 { 220 guint grid[3]; 221 }; 222 223 void tool_matrix_init(void); 224 225 /* These structures are used for bindings. */ 226 #define TOOL_TYPE_MINMAX (tool_minmax_get_type()) 227 GType tool_minmax_get_type(void); 228 229 void tool_minmax(float global[2], const float minmax[2]); 230 void tool_minmax_fromDbl(float global[2], const double minmax[2]); 231 232 /** 233 * ToolScalingId: 234 * @TOOL_SCALING_NORMALIZE: input data are converted into [0;1] using input min/max values. 235 * @TOOL_SCALING_MINMAX: input data are converted into [0;1] using user defined min/max values. 236 * 237 * Control how input data are converted into [0;1], after conversion, 238 * values are clamped if needed. 239 */ 240 typedef enum 241 { 242 TOOL_SCALING_NORMALIZE, 243 TOOL_SCALING_MINMAX 244 } ToolScalingId; 245 246 G_END_DECLS 247 248 #endif 249