#include "memory_macroses.h"
#include "debug_macroses.h"
Go to the source code of this file.
Defines | |
#define | CALC_VECTOR(N_S, N_E, V) (V)[0] = (N_E).array[0] - (N_S).array[0];(V)[2] = (N_E).array[2] - (N_S).array[2];(V)[1] = (N_E).array[1] - (N_S).array[1]; |
calculate vector from begin and end points, N_S -- start point, N_E -- end point, V -- output vector | |
#define | CALC_TRIANGLE_AREA(V1, V2) (0.5 * fabs((V1)[1] * (V2)[2] - (V1)[2] * (V2)[1] + (V1)[2] * (V2)[0] - (V1)[0] * (V2)[2] + (V1)[0] * (V2)[1] - (V1)[1] * (V2)[0])) |
calculate triange area, V1 -- first vector, V2 -- second vector | |
#define | CALC_VECT_MULT(V1, V2, R) |
calculate vect mult | |
#define | CALC_VECT_NORM(V) sqrt((V)[0] * (V)[0] + (V)[1] * (V)[1] + (V)[2] * (V)[2]) |
calculate vect norm | |
#define | CALC_GEOM_AVERAGE(D1, D2) ((D1) * (D2) / ((D1) + (D2))) |
calculate geometric average | |
#define | CALC_IJK_FROM_INDEX(IND, NX, NY, NZ, I, J, K) |
calculate cell ijk index from linear index IND -- linear index, NX, NY, NZ -- dimens, I, J, K -- output indexes | |
#define | CALC_INDEX_FROM_IJK(IND, NX, NY, NZ, I, J, K) IND = I + J * NX + K * NX * NY \ |
calculate cell ijk index from linear index IND -- linear index, NX, NY, NZ -- dimens, I, J, K -- output indexes | |
#define | MIN(a, b) ((a)<(b)?(a):(b)) |
Minimum of a and b. | |
#define | MAX(a, b) ((a)<(b)?(b):(a)) |
Maximum of a and b. |
Desribe
#define CALC_GEOM_AVERAGE | ( | D1, | |||
D2 | ) | ((D1) * (D2) / ((D1) + (D2))) |
calculate geometric average
#define CALC_IJK_FROM_INDEX | ( | IND, | |||
NX, | |||||
NY, | |||||
NZ, | |||||
I, | |||||
J, | |||||
K | ) |
Value:
(K) = (int)((IND) / ((NX) * (NY))); \ (IND) -= (K) * (NX) * (NY); \ (J) = (int)((IND) / (NX)); \ (I) = (IND) - (J) * (NX);
#define CALC_INDEX_FROM_IJK | ( | IND, | |||
NX, | |||||
NY, | |||||
NZ, | |||||
I, | |||||
J, | |||||
K | ) | IND = I + J * NX + K * NX * NY \ |
calculate cell ijk index from linear index IND -- linear index, NX, NY, NZ -- dimens, I, J, K -- output indexes
#define CALC_TRIANGLE_AREA | ( | V1, | |||
V2 | ) | (0.5 * fabs((V1)[1] * (V2)[2] - (V1)[2] * (V2)[1] + (V1)[2] * (V2)[0] - (V1)[0] * (V2)[2] + (V1)[0] * (V2)[1] - (V1)[1] * (V2)[0])) |
calculate triange area, V1 -- first vector, V2 -- second vector
#define CALC_VECT_MULT | ( | V1, | |||
V2, | |||||
R | ) |
Value:
R[0] = (V1)[1] * (V2)[2] - (V1)[2] * (V2)[1]; \ R[1] = (V1)[2] * (V2)[0] - (V1)[0] * (V2)[2]; \ R[2] = (V1)[0] * (V2)[1] - (V1)[1] * (V2)[0];
#define CALC_VECT_NORM | ( | V | ) | sqrt((V)[0] * (V)[0] + (V)[1] * (V)[1] + (V)[2] * (V)[2]) |
calculate vect norm
#define CALC_VECTOR | ( | N_S, | |||
N_E, | |||||
V | ) | (V)[0] = (N_E).array[0] - (N_S).array[0];(V)[2] = (N_E).array[2] - (N_S).array[2];(V)[1] = (N_E).array[1] - (N_S).array[1]; |
calculate vector from begin and end points, N_S -- start point, N_E -- end point, V -- output vector
#define MAX | ( | a, | |||
b | ) | ((a)<(b)?(b):(a)) |
Maximum of a and b.
#define MIN | ( | a, | |||
b | ) | ((a)<(b)?(a):(b)) |
Minimum of a and b.