style cleanup

This commit is contained in:
Campbell Barton 2012-11-03 18:14:14 +00:00
parent ff014a3077
commit a18ead1521

@ -49,15 +49,15 @@
#define SMOOTH_LAPLACIAN_MIN_EDGE_PERCENTAGE 0.15
struct BLaplacianSystem {
float *eweights; /* Length weights per Edge */
float *eweights; /* Length weights per Edge */
float (*fweights)[3]; /* Cotangent weights per face */
float *ring_areas; /* Total area per ring*/
float *vlengths; /* Total sum of lengths(edges) per vertice*/
float *vweights; /* Total sum of weights per vertice*/
int numEdges; /* Number of edges*/
int numFaces; /* Number of faces*/
int numVerts; /* Number of verts*/
short *zerola; /* Is zero area or length*/
float *ring_areas; /* Total area per ring*/
float *vlengths; /* Total sum of lengths(edges) per vertice*/
float *vweights; /* Total sum of weights per vertice*/
int numEdges; /* Number of edges*/
int numFaces; /* Number of faces*/
int numVerts; /* Number of verts*/
short *zerola; /* Is zero area or length*/
/* Pointers to data*/
BMesh *bm;
@ -72,13 +72,13 @@ typedef struct BLaplacianSystem LaplacianSystem;
static float compute_volume(BMesh *bm);
static float cotan_weight(float *v1, float *v2, float *v3);
static int vert_is_boundary(BMVert *v);
static LaplacianSystem * init_laplacian_system( int a_numEdges, int a_numFaces, int a_numVerts);
static void init_laplacian_matrix(LaplacianSystem * sys);
static void delete_laplacian_system(LaplacianSystem * sys);
static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, int a_numVerts);
static void init_laplacian_matrix(LaplacianSystem *sys);
static void delete_laplacian_system(LaplacianSystem *sys);
static void delete_void_pointer(void *data);
static void fill_laplacian_matrix(LaplacianSystem * sys);
static void fill_laplacian_matrix(LaplacianSystem *sys);
static void memset_laplacian_system(LaplacianSystem *sys, int val);
static void validate_solution(LaplacianSystem * sys, int usex, int usey, int usez, int volumepreservation);
static void validate_solution(LaplacianSystem *sys, int usex, int usey, int usez, int volumepreservation);
static void volume_preservation(BMesh *bm, BMOperator *op, float vini, float vend, int usex, int usey, int usez);
static void delete_void_pointer(void *data)
@ -89,7 +89,7 @@ static void delete_void_pointer(void *data)
}
}
static void delete_laplacian_system(LaplacianSystem * sys)
static void delete_laplacian_system(LaplacianSystem *sys)
{
delete_void_pointer(sys->eweights);
delete_void_pointer(sys->fweights);
@ -115,9 +115,9 @@ static void memset_laplacian_system(LaplacianSystem *sys, int val)
memset(sys->zerola, val, sizeof(short) * sys->numVerts);
}
static LaplacianSystem * init_laplacian_system( int a_numEdges, int a_numFaces, int a_numVerts)
static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, int a_numVerts)
{
LaplacianSystem * sys;
LaplacianSystem *sys;
sys = MEM_callocN(sizeof(LaplacianSystem), "ModLaplSmoothSystem");
sys->numEdges = a_numEdges;
sys->numFaces = a_numFaces;
@ -172,15 +172,15 @@ static LaplacianSystem * init_laplacian_system( int a_numEdges, int a_numFaces,
* \ | /
* \ | /
* * v_neighbor
*/
*/
static void init_laplacian_matrix(LaplacianSystem * sys)
static void init_laplacian_matrix(LaplacianSystem *sys)
{
float areaf;
float *v1, *v2, *v3, *v4;
float w1, w2, w3, w4;
int i, j;
int has_4_vert ;
int has_4_vert;
unsigned int idv1, idv2, idv3, idv4, idv[4];
BMEdge *e;
BMFace *f;
@ -292,12 +292,12 @@ static void init_laplacian_matrix(LaplacianSystem * sys)
}
}
static void fill_laplacian_matrix(LaplacianSystem * sys)
static void fill_laplacian_matrix(LaplacianSystem *sys)
{
float *v1, *v2, *v3, *v4;
float w2, w3, w4;
int i, j;
int has_4_vert ;
int has_4_vert;
unsigned int idv1, idv2, idv3, idv4, idv[4];
BMEdge *e;
@ -403,7 +403,7 @@ static int vert_is_boundary(BMVert *v)
BMFace *f;
BMIter ei;
BMIter fi;
BM_ITER_ELEM(ed, &ei, v, BM_EDGES_OF_VERT) {
BM_ITER_ELEM (ed, &ei, v, BM_EDGES_OF_VERT) {
if (BM_edge_is_boundary(ed)) {
return 1;
}
@ -443,13 +443,13 @@ static float compute_volume(BMesh *bm)
y3 = vf[2]->co[1];
z3 = vf[2]->co[2];
vol += (1.0 / 6.0) * (0.0 - x3*y2*z1 + x2*y3*z1 + x3*y1*z2 - x1*y3*z2 - x2*y1*z3 + x1*y2*z3);
vol += (1.0 / 6.0) * (0.0 - x3 * y2 * z1 + x2 * y3 * z1 + x3 * y1 * z2 - x1 * y3 * z2 - x2 * y1 * z3 + x1 * y2 * z3);
if (i == 4) {
x4 = vf[3]->co[0];
y4 = vf[3]->co[1];
z4 = vf[3]->co[2];
vol += (1.0 / 6.0) * (x1*y3*z4 - x1*y4*z3 - x3*y1*z4 + x3*z1*y4 + y1*x4*z3 - x4*y3*z1);
vol += (1.0 / 6.0) * (x1 * y3 * z4 - x1 * y4 * z3 - x3 * y1 * z4 + x3 * z1 * y4 + y1 * x4 * z3 - x4 * y3 * z1);
}
}
return fabs(vol);
@ -462,7 +462,7 @@ static void volume_preservation(BMesh *bm, BMOperator *op, float vini, float ven
BMVert *v;
if (vend != 0.0f) {
beta = pow (vini / vend, 1.0f / 3.0f);
beta = pow(vini / vend, 1.0f / 3.0f);
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
if (usex) {
v->co[0] *= beta;
@ -478,7 +478,7 @@ static void volume_preservation(BMesh *bm, BMOperator *op, float vini, float ven
}
}
static void validate_solution(LaplacianSystem * sys, int usex, int usey, int usez, int volumepreservation)
static void validate_solution(LaplacianSystem *sys, int usex, int usey, int usez, int volumepreservation)
{
int m_vertex_id;
float leni, lene;
@ -503,7 +503,7 @@ static void validate_solution(LaplacianSystem * sys, int usex, int usey, int use
ve2[2] = nlGetVariable(2, idv2);
leni = len_v3v3(vi1, vi2);
lene = len_v3v3(ve1, ve2);
if ( lene > leni* SMOOTH_LAPLACIAN_MAX_EDGE_PERCENTAGE || lene < leni*SMOOTH_LAPLACIAN_MIN_EDGE_PERCENTAGE) {
if (lene > leni * SMOOTH_LAPLACIAN_MAX_EDGE_PERCENTAGE || lene < leni * SMOOTH_LAPLACIAN_MIN_EDGE_PERCENTAGE) {
sys->zerola[idv1] = 1;
sys->zerola[idv2] = 1;
}
@ -542,7 +542,7 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
float w;
BMOIter siter;
BMVert *v;
LaplacianSystem * sys;
LaplacianSystem *sys;
sys = init_laplacian_system(bm->totedge, bm->totface, bm->totvert);
if (!sys) return;