Style Cleanup
This commit is contained in:
@@ -317,14 +317,14 @@ static double UNUSED_FUNCTION(dist_to_line_segment_v2_d)(double v1[3], double v2
|
||||
|
||||
rc[0] = v3[0] - v2[0];
|
||||
rc[1] = v3[1] - v2[1];
|
||||
len = rc[0]*rc[0]+ rc[1]*rc[1];
|
||||
len = rc[0] * rc[0] + rc[1] * rc[1];
|
||||
if (len == 0.0) {
|
||||
rc[0] = v1[0] - v2[0];
|
||||
rc[1] = v1[1] - v2[1];
|
||||
return sqrt(rc[0] * rc[0] + rc[1] * rc[1]);
|
||||
}
|
||||
|
||||
labda = (rc[0]*(v1[0]-v2[0]) + rc[1]*(v1[1]-v2[1])) / len;
|
||||
labda = (rc[0] * (v1[0] - v2[0]) + rc[1] * (v1[1] - v2[1])) / len;
|
||||
if (labda <= 0.0) {
|
||||
pt[0] = v2[0];
|
||||
pt[1] = v2[1];
|
||||
@@ -334,20 +334,20 @@ static double UNUSED_FUNCTION(dist_to_line_segment_v2_d)(double v1[3], double v2
|
||||
pt[1] = v3[1];
|
||||
}
|
||||
else {
|
||||
pt[0] = labda*rc[0]+v2[0];
|
||||
pt[1] = labda*rc[1]+v2[1];
|
||||
pt[0] = labda * rc[0] + v2[0];
|
||||
pt[1] = labda * rc[1] + v2[1];
|
||||
}
|
||||
|
||||
rc[0] = pt[0]-v1[0];
|
||||
rc[1] = pt[1]-v1[1];
|
||||
return sqrt(rc[0]*rc[0]+ rc[1]*rc[1]);
|
||||
rc[0] = pt[0] - v1[0];
|
||||
rc[1] = pt[1] - v1[1];
|
||||
return sqrt(rc[0] * rc[0] + rc[1] * rc[1]);
|
||||
}
|
||||
|
||||
|
||||
MINLINE double line_point_side_v2_d(const double *l1, const double *l2, const double *pt)
|
||||
{
|
||||
return ((l1[0]-pt[0]) * (l2[1]-pt[1])) -
|
||||
((l2[0]-pt[0]) * (l1[1]-pt[1]));
|
||||
return ((l1[0] - pt[0]) * (l2[1] - pt[1])) -
|
||||
((l2[0] - pt[0]) * (l1[1] - pt[1]));
|
||||
}
|
||||
|
||||
/* point in quad - only convex quads */
|
||||
@@ -650,10 +650,10 @@ void BM_multires_smooth_bounds(BMesh *bm, BMFace *f)
|
||||
|
||||
sides = (int)sqrt(mdp->totdisp);
|
||||
for (y = 0; y < sides; y++) {
|
||||
add_v3_v3v3(co1, mdn->disps[y*sides], mdl->disps[y]);
|
||||
add_v3_v3v3(co1, mdn->disps[y * sides], mdl->disps[y]);
|
||||
mul_v3_fl(co1, 0.5);
|
||||
|
||||
copy_v3_v3(mdn->disps[y*sides], co1);
|
||||
copy_v3_v3(mdn->disps[y * sides], co1);
|
||||
copy_v3_v3(mdl->disps[y], co1);
|
||||
}
|
||||
}
|
||||
@@ -692,8 +692,8 @@ void BM_multires_smooth_bounds(BMesh *bm, BMFace *f)
|
||||
int a1, a2, o1, o2;
|
||||
|
||||
if (l->v != l->radial_next->v) {
|
||||
a1 = sides*y + sides-2;
|
||||
a2 = (sides-2)*sides + y;
|
||||
a1 = sides * y + sides - 2;
|
||||
a2 = (sides - 2) * sides + y;
|
||||
|
||||
o1 = sides * y + sides - 1;
|
||||
o2 = (sides - 1) * sides + y;
|
||||
|
||||
@@ -62,7 +62,7 @@ static void recount_totsels(BMesh *bm)
|
||||
int *tots[3];
|
||||
int i;
|
||||
|
||||
/* recount tot*sel variables */
|
||||
/* recount (tot * sel) variables */
|
||||
bm->totvertsel = bm->totedgesel = bm->totfacesel = 0;
|
||||
tots[0] = &bm->totvertsel;
|
||||
tots[1] = &bm->totedgesel;
|
||||
|
||||
@@ -410,7 +410,7 @@ BMFace *BM_Split_Face(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, BMLoop **nl,
|
||||
* @returns The New Edge
|
||||
*/
|
||||
|
||||
BMEdge* BM_Collapse_Vert_Faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, const int join_faces)
|
||||
BMEdge *BM_Collapse_Vert_Faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, const int join_faces)
|
||||
{
|
||||
BMEdge *ne = NULL;
|
||||
BMVert *tv = bmesh_edge_getothervert(ke, kv);
|
||||
|
||||
@@ -523,7 +523,7 @@ void BM_Kill_Face_Edges(BMesh *bm, BMFace *f)
|
||||
|
||||
void BM_Kill_Face_Verts(BMesh *bm, BMFace *f)
|
||||
{
|
||||
BMVert**verts = NULL;
|
||||
BMVert **verts = NULL;
|
||||
BLI_array_staticdeclare(verts, BM_NGON_STACK_SIZE);
|
||||
BMLoop *l_iter;
|
||||
BMLoop *l_first;
|
||||
|
||||
@@ -1216,7 +1216,7 @@ int BMO_VInitOpf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
|
||||
def = opdefines[i];
|
||||
|
||||
i = 0;
|
||||
state = 1; //0: not inside slotcode name, 1: inside slotcode name
|
||||
state = 1; /* 0: not inside slotcode name, 1: inside slotcode name */
|
||||
|
||||
while (*fmt) {
|
||||
if (state) {
|
||||
@@ -1336,7 +1336,7 @@ int BMO_VInitOpf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"%s: unrecognized bmop format char: %c, %d in '%s'\n",
|
||||
__func__, *fmt, (int)(fmt-ofmt), ofmt);
|
||||
__func__, *fmt, (int)(fmt - ofmt), ofmt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1350,7 +1350,7 @@ error:
|
||||
/* non urgent todo - explain exactly what is failing */
|
||||
fprintf(stderr,
|
||||
"%s: error parsing formatting string, %d in '%s'\n see - %s:%d\n",
|
||||
__func__, (int)(fmt-ofmt), _fmt, __FILE__, lineno);
|
||||
__func__, (int)(fmt - ofmt), _fmt, __FILE__, lineno);
|
||||
MEM_freeN(ofmt);
|
||||
|
||||
BMO_Finish_Op(bm, op);
|
||||
|
||||
@@ -60,13 +60,15 @@
|
||||
|
||||
static short testedgeside(const double v1[2], const double v2[2], const double v3[2])
|
||||
{
|
||||
/* is v3 to the right of v1-v2 ? With exception: v3 == v1 || v3 == v2 */
|
||||
/* is v3 to the right of v1 - v2 ? With exception: v3 == v1 || v3 == v2 */
|
||||
double inp;
|
||||
|
||||
//inp = (v2[cox] - v1[cox]) * (v1[coy] - v3[coy]) + (v1[coy] - v2[coy]) * (v1[cox] - v3[cox]);
|
||||
inp = (v2[0]-v1[0]) * (v1[1]-v3[1]) + (v1[1] - v2[1]) * (v1[0] - v3[0]);
|
||||
inp = (v2[0] - v1[0]) * (v1[1] - v3[1]) + (v1[1] - v2[1]) * (v1[0] - v3[0]);
|
||||
|
||||
if (inp < 0.0) return 0;
|
||||
if (inp < 0.0) {
|
||||
return 0;
|
||||
}
|
||||
else if (inp == 0) {
|
||||
if (v1[0] == v3[0] && v1[1] == v3[1]) return 0;
|
||||
if (v2[0] == v3[0] && v2[1] == v3[1]) return 0;
|
||||
@@ -76,10 +78,10 @@ static short testedgeside(const double v1[2], const double v2[2], const double v
|
||||
|
||||
static short testedgesidef(const float v1[2], const float v2[2], const float v3[2])
|
||||
{
|
||||
/* is v3 to the right of v1-v2 ? With exception: v3 == v1 || v3 == v2 */
|
||||
/* is v3 to the right of v1 - v2 ? With exception: v3 == v1 || v3 == v2 */
|
||||
double inp;
|
||||
|
||||
//inp = (v2[cox]-v1[cox])*(v1[coy]-v3[coy]) + (v1[coy]-v2[coy])*(v1[cox]-v3[cox]);
|
||||
//inp = (v2[cox] - v1[cox]) * (v1[coy] - v3[coy]) + (v1[coy] - v2[coy]) * (v1[cox] - v3[cox]);
|
||||
inp = (v2[0] - v1[0]) * (v1[1] - v3[1]) + (v1[1] - v2[1]) * (v1[0] - v3[0]);
|
||||
|
||||
if (inp < 0.0) {
|
||||
@@ -662,15 +664,17 @@ static int linecrossesf(const float v1[2], const float v2[2], const float v3[2],
|
||||
/* do an interval test on the x and y axe */
|
||||
/* first do x axi */
|
||||
#define T FLT_EPSILON * 15
|
||||
if (ABS(v1[1]-v2[1]) < T && ABS(v3[1]-v4[1]) < T &&
|
||||
ABS(v1[1]-v3[1]) < T)
|
||||
if ( ABS(v1[1] - v2[1]) < T &&
|
||||
ABS(v3[1] - v4[1]) < T &&
|
||||
ABS(v1[1] - v3[1]) < T)
|
||||
{
|
||||
return (mv4[0] >= mv1[0] && mv3[0] <= mv2[0]);
|
||||
}
|
||||
|
||||
/* now do y axi */
|
||||
if (ABS(v1[0]-v2[0]) < T && ABS(v3[0]-v4[0]) < T &&
|
||||
ABS(v1[0]-v3[0]) < T)
|
||||
if ( ABS(v1[0] - v2[0]) < T &&
|
||||
ABS(v3[0] - v4[0]) < T &&
|
||||
ABS(v1[0] - v3[0]) < T)
|
||||
{
|
||||
return (mv4[1] >= mv1[1] && mv3[1] <= mv2[1]);
|
||||
}
|
||||
@@ -809,15 +813,18 @@ static BMLoop *find_ear(BMesh *UNUSED(bm), BMFace *f, float (*verts)[3], const i
|
||||
}
|
||||
|
||||
if (isear) {
|
||||
/* angle = angle_v3v3v3(verts[v1->head.eflag2], verts[v2->head.eflag2], verts[v3->head.eflag2]);
|
||||
#if 0
|
||||
angle = angle_v3v3v3(verts[v1->head.eflag2], verts[v2->head.eflag2], verts[v3->head.eflag2]);
|
||||
if (!bestear || ABS(angle-45.0f) < bestangle) {
|
||||
bestear = l;
|
||||
bestangle = ABS(45.0f-angle);
|
||||
bestangle = ABS(45.0f - angle);
|
||||
}
|
||||
|
||||
if (angle > 20 && angle < 90) break;
|
||||
if (angle < 100 && i > 5) break;
|
||||
i += 1; */
|
||||
i += 1;
|
||||
#endif
|
||||
|
||||
bestear = l_iter;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ void *BMW_walk(BMWalker *walker)
|
||||
* worklist for processing.
|
||||
*/
|
||||
|
||||
void* BMW_currentstate(BMWalker *walker)
|
||||
void *BMW_currentstate(BMWalker *walker)
|
||||
{
|
||||
bmesh_walkerGeneric *currentstate = walker->states.first;
|
||||
if (currentstate) {
|
||||
@@ -237,7 +237,7 @@ void BMW_removestate(BMWalker *walker)
|
||||
* breadth-first walks.
|
||||
*/
|
||||
|
||||
void* BMW_addstate(BMWalker *walker)
|
||||
void *BMW_addstate(BMWalker *walker)
|
||||
{
|
||||
bmesh_walkerGeneric *newstate;
|
||||
newstate = BLI_mempool_alloc(walker->worklist);
|
||||
|
||||
@@ -181,7 +181,7 @@ static void rotsys_reverse(struct BMEdge *UNUSED(e), struct BMVert *v, EdgeData
|
||||
|
||||
totedge = BLI_array_count(edges);
|
||||
for (i = 0; i < totedge / 2; i++) {
|
||||
SWAP(BMEdge*, edges[i], edges[totedge - 1 - i]);
|
||||
SWAP(BMEdge *, edges[i], edges[totedge - 1 - i]);
|
||||
}
|
||||
|
||||
vdata[BM_GetIndex(v)].e = NULL;
|
||||
@@ -535,11 +535,11 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
|
||||
}
|
||||
if (dot_v3v3(n1, n2) < 0.0f) {
|
||||
if (dot_v3v3(n1, n3) >= 0.0f + FLT_EPSILON * 10) {
|
||||
SWAP(BMEdge*, edges[i], edges[(i + 1) % totedge]);
|
||||
SWAP(BMEdge *, edges[i], edges[(i + 1) % totedge]);
|
||||
}
|
||||
else {
|
||||
SWAP(BMEdge*, edges[(i + totedge - 1) % totedge], edges[(i + 1) % totedge])
|
||||
SWAP(BMEdge*, edges[i], edges[(i + 1) % totedge])
|
||||
SWAP(BMEdge *, edges[(i + totedge - 1) % totedge], edges[(i + 1) % totedge])
|
||||
SWAP(BMEdge *, edges[i], edges[(i + 1) % totedge])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,16 +469,16 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
/* new Vertex block */
|
||||
if (bm->totvert == 0) mvert = NULL;
|
||||
else mvert = MEM_callocN(bm->totvert*sizeof(MVert), "loadeditbMesh vert");
|
||||
else mvert = MEM_callocN(bm->totvert * sizeof(MVert), "loadeditbMesh vert");
|
||||
|
||||
/* new Edge block */
|
||||
if (bm->totedge == 0) medge = NULL;
|
||||
else medge = MEM_callocN(bm->totedge*sizeof(MEdge), "loadeditbMesh edge");
|
||||
else medge = MEM_callocN(bm->totedge * sizeof(MEdge), "loadeditbMesh edge");
|
||||
|
||||
/* build ngon dat */
|
||||
/* new Ngon Face block */
|
||||
if (bm->totface == 0) mpoly = NULL;
|
||||
else mpoly = MEM_callocN(bm->totface*sizeof(MPoly), "loadeditbMesh poly");
|
||||
else mpoly = MEM_callocN(bm->totface * sizeof(MPoly), "loadeditbMesh poly");
|
||||
|
||||
/* find number of loops to allocat */
|
||||
totloop = 0;
|
||||
@@ -487,7 +487,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
if (totloop == 0) mloop = NULL;
|
||||
else mloop = MEM_callocN(totloop*sizeof(MLoop), "loadeditbMesh loop");
|
||||
else mloop = MEM_callocN(totloop * sizeof(MLoop), "loadeditbMesh loop");
|
||||
|
||||
/* lets save the old verts just in case we are actually working on
|
||||
* a key ... we now do processing of the keys at the end */
|
||||
@@ -862,7 +862,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
currkey->flag &= ~KEYBLOCK_MISSING;
|
||||
|
||||
fp = newkey = MEM_callocN(me->key->elemsize*bm->totvert, "currkey->data");
|
||||
fp = newkey = MEM_callocN(me->key->elemsize * bm->totvert, "currkey->data");
|
||||
oldkey = currkey->data;
|
||||
|
||||
eve = BMIter_New(&iter, bm, BM_VERTS_OF_MESH, NULL);
|
||||
|
||||
@@ -321,7 +321,7 @@ void bmesh_create_uvsphere_exec(BMesh *bm, BMOperator *op)
|
||||
/* Going in this direction, then edge extruding, makes normals face outward */
|
||||
vec[0] = -dia * sinf(phi);
|
||||
vec[1] = 0.0;
|
||||
vec[2] = dia*cosf(phi);
|
||||
vec[2] = dia * cosf(phi);
|
||||
eve = BM_Make_Vert(bm, vec, NULL);
|
||||
BMO_SetFlag(bm, eve, VERT_MARK);
|
||||
|
||||
@@ -493,8 +493,8 @@ void bmesh_create_circle_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
BMO_Get_Mat4(op, "mat", mat);
|
||||
|
||||
phid = 2.0f*(float)M_PI / segs;
|
||||
phi = .25f*(float)M_PI;
|
||||
phid = 2.0f * (float)M_PI / segs;
|
||||
phi = .25f * (float)M_PI;
|
||||
|
||||
if (cap_ends) {
|
||||
vec[0] = vec[1] = 0.0f;
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
BLI_srandom(seed);
|
||||
|
||||
wid = (params->numcuts + 2);
|
||||
dp = perc*wid;
|
||||
dp = perc * wid;
|
||||
wid /= 2;
|
||||
d = lvl = 0;
|
||||
while (1) {
|
||||
@@ -183,7 +183,7 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const subdpar
|
||||
float len, nor[3], nor1[3], nor2[3], smooth = params->smooth;
|
||||
|
||||
sub_v3_v3v3(nor, vsta->co, vend->co);
|
||||
len = 0.5f*normalize_v3(nor);
|
||||
len = 0.5f * normalize_v3(nor);
|
||||
|
||||
copy_v3_v3(nor1, vsta->no);
|
||||
copy_v3_v3(nor2, vend->no);
|
||||
@@ -197,7 +197,7 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const subdpar
|
||||
madd_v3_v3fl(tvec, nor2, fac);
|
||||
|
||||
/* falloff for multi subdivide */
|
||||
smooth *= sqrtf(fabsf(1.0f - 2.0f*fabsf(0.5f-perc)));
|
||||
smooth *= sqrtf(fabsf(1.0f - 2.0f * fabsf(0.5f-perc)));
|
||||
|
||||
mul_v3_fl(tvec, smooth * len);
|
||||
|
||||
@@ -212,7 +212,7 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const subdpar
|
||||
float len = len_v3v3(vsta->co, vend->co);
|
||||
float vec2[3] = {0.0f, 0.0f, 0.0f}, co2[3];
|
||||
|
||||
fac = params->fractal*len;
|
||||
fac = params->fractal * len;
|
||||
|
||||
add_v3_v3(vec2, vsta->no);
|
||||
add_v3_v3(vec2, vend->no);
|
||||
|
||||
@@ -378,15 +378,15 @@ static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l,
|
||||
maxfactor = vtd1->maxfactor;
|
||||
}
|
||||
else {
|
||||
maxfactor = scale*BME_bevel_project_vec(vec1, vec2, up_vec, forward, td);
|
||||
maxfactor = scale * BME_bevel_project_vec(vec1, vec2, up_vec, forward, td);
|
||||
if (vtd->maxfactor > 0 && vtd->maxfactor < maxfactor) {
|
||||
maxfactor = vtd->maxfactor;
|
||||
}
|
||||
}
|
||||
|
||||
dis = BMO_TestFlag(bm, v1, BME_BEVEL_ORIG) ? len / 3 : len / 2;
|
||||
if (is_edge || dis > maxfactor*value) {
|
||||
dis = maxfactor*value;
|
||||
if (is_edge || dis > maxfactor * value) {
|
||||
dis = maxfactor * value;
|
||||
}
|
||||
madd_v3_v3v3fl(sv->co, v->co, vec1, dis);
|
||||
sub_v3_v3v3(vec1, sv->co, vtd1->org);
|
||||
@@ -1002,7 +1002,7 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i
|
||||
else {
|
||||
d = value;
|
||||
}
|
||||
madd_v3_v3v3fl(v->co, vtd->org, vtd->vec, vtd->factor*d);
|
||||
madd_v3_v3v3fl(v->co, vtd->org, vtd->vec, vtd->factor * d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user