Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-04 10:31:30 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-04 10:31:30 +0300
commit44505b38df557a5711703613685a1dec9fc2c3d9 (patch)
tree3f05bebcc7bfadf56569f2dcca7f95fc56b1b0d0 /source/blender/editors/uvedit/uvedit_parametrizer.c
parent6654e109df952be3a3128fae2508a02c196ae593 (diff)
Cleanup: strip trailing space in editors
Diffstat (limited to 'source/blender/editors/uvedit/uvedit_parametrizer.c')
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c168
1 files changed, 84 insertions, 84 deletions
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index c510c12ae53..1d2583cf9d4 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -113,7 +113,7 @@ typedef struct PVert {
float uv[2];
unsigned char flag;
-} PVert;
+} PVert;
typedef struct PEdge {
struct PEdge *nextlink;
@@ -242,8 +242,8 @@ typedef struct PHandle {
*/
static int PHashSizes[] = {
- 1, 3, 5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209,
- 16411, 32771, 65537, 131101, 262147, 524309, 1048583, 2097169,
+ 1, 3, 5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209,
+ 16411, 32771, 65537, 131101, 262147, 524309, 1048583, 2097169,
4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459
};
@@ -294,7 +294,7 @@ static void phash_insert(PHash *ph, PHashLink *link)
link->next = lookup->next;
lookup->next = link;
}
-
+
ph->size++;
if (ph->size > (size * 3)) {
@@ -323,7 +323,7 @@ static PHashLink *phash_lookup(PHash *ph, PHashKey key)
return link;
else if (PHASH_hash(ph, link->key) != hash)
return NULL;
-
+
return link;
}
@@ -336,7 +336,7 @@ static PHashLink *phash_next(PHash *ph, PHashKey key, PHashLink *link)
return link;
else if (PHASH_hash(ph, link->key) != hash)
return NULL;
-
+
return link;
}
@@ -562,7 +562,7 @@ static PEdge *p_wheel_edge_next(PEdge *e)
}
static PEdge *p_wheel_edge_prev(PEdge *e)
-{
+{
return (e->pair) ? e->pair->next : NULL;
}
@@ -619,7 +619,7 @@ static void p_chart_topological_sanity_check(PChart *chart)
for (v = chart->verts; v; v = v->nextlink)
param_test_equals_ptr("v->edge->vert", v, v->edge->vert);
-
+
for (e = chart->edges; e; e = e->nextlink) {
if (e->pair) {
param_test_equals_ptr("e->pair->pair", e, e->pair->pair);
@@ -867,7 +867,7 @@ static PBool p_edge_implicit_seam(PEdge *e, PEdge *ep)
ep->flag |= PEDGE_SEAM;
return P_TRUE;
}
-
+
return P_FALSE;
}
@@ -881,7 +881,7 @@ static PBool p_edge_has_pair(PHandle *handle, PEdge *e, PEdge **pair, PBool impl
if (e->flag & PEDGE_SEAM)
return P_FALSE;
-
+
key = PHASH_edge(key1, key2);
pe = (PEdge *)phash_lookup(handle->hash_edges, key);
*pair = NULL;
@@ -999,7 +999,7 @@ static void p_split_vert(PChart *chart, PEdge *e)
lastwe = e;
for (we = p_wheel_edge_prev(e); we && (we != e); we = p_wheel_edge_prev(we))
lastwe = we;
-
+
/* go over all edges in wheel */
for (we = lastwe; we; we = p_wheel_edge_next(we)) {
if (we->flag & PEDGE_VERTEX_SPLIT)
@@ -1202,7 +1202,7 @@ static PBool p_quad_split_direction(PHandle *handle, float **co, PHashKey *vkeys
/* Construction: boundary filling */
static void p_chart_boundaries(PChart *chart, int *nboundaries, PEdge **outer)
-{
+{
PEdge *e, *be;
float len, maxlen = -1.0;
@@ -1327,7 +1327,7 @@ static void p_chart_fill_boundary(PChart *chart, PEdge *be, int nedges)
}
else {
ne2->vert->edge = ne2;
-
+
ne2->u.heaplink = BLI_heap_insert(heap, p_edge_boundary_angle(ne2), ne2);
e2->u.heaplink = BLI_heap_insert(heap, p_edge_boundary_angle(e2), e2);
}
@@ -1412,7 +1412,7 @@ static void p_polygon_kernel_clip(float (*oldpoints)[2], int noldpoints, float (
newpoints[*nnewpoints][1] = p2[1];
(*nnewpoints)++;
}
-
+
p1in = p2in;
p1 = p2;
}
@@ -1422,7 +1422,7 @@ static void p_polygon_kernel_center(float (*points)[2], int npoints, float *cent
{
int i, size, nnewpoints = npoints;
float (*oldpoints)[2], (*newpoints)[2], *p1, *p2;
-
+
size = npoints * 3;
oldpoints = MEM_mallocN(sizeof(float) * 2 * size, "PPolygonOldPoints");
newpoints = MEM_mallocN(sizeof(float) * 2 * size, "PPolygonNewPoints");
@@ -1486,7 +1486,7 @@ static void p_polygon_kernel_center(float (*points)[2], int npoints, float *cent
int NCOLLAPSE = 1;
int NCOLLAPSEX = 0;
-
+
static float p_vert_cotan(float *v1, float *v2, float *v3)
{
float a[3], b[3], c[3], clen;
@@ -1499,10 +1499,10 @@ static float p_vert_cotan(float *v1, float *v2, float *v3)
if (clen == 0.0f)
return 0.0f;
-
+
return dot_v3v3(a, b) / clen;
}
-
+
static PBool p_vert_flipped_wheel_triangle(PVert *v)
{
PEdge *e = v->edge;
@@ -1530,7 +1530,7 @@ static PBool p_vert_map_harmonic_weights(PVert *v)
do {
float t1, t2, weight;
PVert *v1, *v2;
-
+
v1 = e->next->vert;
v2 = e->next->next->vert;
t1 = p_vert_cotan(v2->co, e->vert->co, v1->co);
@@ -1563,7 +1563,7 @@ static PBool p_vert_map_harmonic_weights(PVert *v)
weightsum += t1 + t2;
positionsum[0] += (v2->uv[1] - v1->uv[1]) + (t1 * v2->uv[0] + t2 * v1->uv[0]);
positionsum[1] += (v1->uv[0] - v2->uv[0]) + (t1 * v2->uv[1] + t2 * v1->uv[1]);
-
+
e = p_wheel_edge_next(e);
} while (e && (e != v->edge));
}
@@ -1617,20 +1617,20 @@ static void p_vert_harmonic_insert(PVert *v)
do {
PEdge *nexte = p_wheel_edge_next(e);
- points[i][0] = e->next->vert->uv[0];
- points[i][1] = e->next->vert->uv[1];
+ points[i][0] = e->next->vert->uv[0];
+ points[i][1] = e->next->vert->uv[1];
if (nexte == NULL) {
i++;
- points[i][0] = e->next->next->vert->uv[0];
- points[i][1] = e->next->next->vert->uv[1];
+ points[i][0] = e->next->next->vert->uv[0];
+ points[i][1] = e->next->next->vert->uv[1];
break;
}
e = nexte;
i++;
} while (e != v->edge);
-
+
p_polygon_kernel_center(points, npoints, v->uv);
MEM_freeN(points);
@@ -1653,7 +1653,7 @@ static void p_vert_fix_edge_pointer(PVert *v)
/* set v->edge pointer to the edge with no pair, if there is one */
while (v->edge->pair) {
v->edge = p_wheel_edge_prev(v->edge);
-
+
if (v->edge == start)
break;
}
@@ -1699,7 +1699,7 @@ static void p_collapse_edge(PEdge *edge, PEdge *pair)
else
keepv->edge = pair->next->pair->next;
}
-
+
/* update pairs and v->edge pointers */
if (edge) {
PEdge *e1 = edge->next, *e2 = e1->next;
@@ -1821,7 +1821,7 @@ static PBool p_collapse_allowed_topologic(PEdge *edge, PEdge *pair)
* the chart) */
else if (!p_vert_interior(oldv) && !p_vert_interior(keepv))
return P_FALSE;
-
+
return P_TRUE;
}
@@ -1868,7 +1868,7 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair)
if (p_collapse_normal_flipped(v1->co, v2->co, oldv->co, keepv->co))
return P_FALSE;
-
+
a[0] = angle;
a[1] = p_vec_angle(v2->co, v1->co, oldv->co);
a[2] = M_PI - a[0] - a[1];
@@ -1903,7 +1903,7 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair)
/* abf++ criterion 2: avoid collapsing verts inwards */
if (p_vert_interior(keepv))
return P_FALSE;
-
+
/* don't collapse significant boundary changes */
angle = p_vec_angle(v1->co, oldv->co, v2->co);
if (angle < (M_PI * 160.0 / 180.0))
@@ -1921,7 +1921,7 @@ static PBool p_collapse_allowed(PEdge *edge, PEdge *pair)
if (oldv->flag & PVERT_PIN)
return P_FALSE;
-
+
return (p_collapse_allowed_topologic(edge, pair) &&
p_collapse_allowed_geometric(edge, pair));
}
@@ -2010,7 +2010,7 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
return cost;
}
-
+
static void p_collapse_cost_vertex(PVert *vert, float *mincost, PEdge **mine)
{
PEdge *e, *enext, *pair;
@@ -2172,7 +2172,7 @@ static void p_chart_simplify_compute(PChart *chart)
for (v = chart->verts; v; v = v->nextlink) {
float cost;
PEdge *e = NULL;
-
+
p_collapse_cost_vertex(v, &cost, &e);
if (e)
@@ -2237,7 +2237,7 @@ static void p_chart_simplify_compute(PChart *chart)
BLI_heap_remove(heap, v->u.heaplink);
v->u.heaplink = NULL;
}
-
+
p_collapse_cost_vertex(v, &cost, &collapse);
if (collapse)
@@ -2331,7 +2331,7 @@ static void p_abf_setup_system(PAbfSystem *sys)
for (i = 0; i < sys->ninterior; i++)
sys->lambdaLength[i] = 1.0;
-
+
sys->minangle = 1.0 * M_PI / 180.0;
sys->maxangle = (float)M_PI - sys->minangle;
}
@@ -2649,7 +2649,7 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart)
dlambda1 = pre[0] + pre[1] + pre[2];
dlambda1 = sys->dstar[f->u.id] * (sys->bstar[f->u.id] - dlambda1);
-
+
sys->lambdaTriangle[f->u.id] += dlambda1;
dalpha = (sys->bAlpha[e1->u.id] - dlambda1);
@@ -2914,7 +2914,7 @@ static PBool p_chart_symmetry_pins(PChart *chart, PEdge *outer, PVert **pin1, PV
if (!maxe1 || !maxe2 || (maxlen < 0.5f * totlen))
return P_FALSE;
-
+
/* find pin1 in the split vertices */
be1 = maxe1;
be2 = maxe2;
@@ -3212,7 +3212,7 @@ static void p_chart_lscm_end(PChart *chart)
{
if (chart->u.lscm.context)
EIG_linear_solver_delete(chart->u.lscm.context);
-
+
if (chart->u.lscm.abf_alpha) {
MEM_freeN(chart->u.lscm.abf_alpha);
chart->u.lscm.abf_alpha = NULL;
@@ -3250,7 +3250,7 @@ static float p_face_stretch(PFace *f)
if (area <= 0.0f) /* flipped face -> infinite stretch */
return 1e10f;
-
+
w = 1.0f / (2.0f * area);
/* compute derivatives */
@@ -3682,7 +3682,7 @@ static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, f
if (ntri <= 10 || depth >= 15)
return node;
-
+
t1 = MEM_mallocN(sizeof(*t1) * ntri, "PNodeTri1");
t2 = MEM_mallocN(sizeof(*t2) * ntri, "PNodeTri1");
@@ -3707,7 +3707,7 @@ static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, f
MEM_freeN(t2);
return node;
}
-
+
node->tri = NULL;
node->ntri = 0;
MEM_freeN(tri);
@@ -3782,7 +3782,7 @@ static float p_smooth_median_edge_length(PChart *chart)
/* ok, so i'm lazy */
for (i = 0, e = chart->edges; e; e = e->nextlink, i++)
lengths[i] = p_edge_length(e);
-
+
qsort(lengths, i, sizeof(float), p_compare_float);
median = lengths[i / 2];
@@ -3876,7 +3876,7 @@ static void p_smooth(PChart *chart)
if ((gridx <= 2) || (gridy <= 2))
return;
-
+
edgesx = gridx - 1;
edgesy = gridy - 1;
nsize = gridx * gridy;
@@ -3936,7 +3936,7 @@ static void p_smooth(PChart *chart)
float p[2], b[3];
i = x + y * gridx;
-
+
p[0] = nodesx[i];
p[1] = nodesy[i];
@@ -3979,7 +3979,7 @@ static void p_smooth(PChart *chart)
for (it2 = 0; it2 < maxiter2; it2++) {
d = 0.0f;
totiter += 1;
-
+
memcpy(oldnodesx, nodesx, sizeof(float) * nsize);
memcpy(oldnodesy, nodesy, sizeof(float) * nsize);
@@ -4011,7 +4011,7 @@ static void p_smooth(PChart *chart)
sum1 += vedges[j] * oldnodesy[i + gridx];
nodesy[i] = sum1 / sum2;
-
+
p[0] = nodesx[i];
p[1] = nodesy[i];
@@ -4089,8 +4089,8 @@ static void p_smooth(PChart *chart)
t2->co3[0] = t->co3[0]; t2->co3[1] = t->co3[1];
t2->oco3[0] = t->oco3[0]; t2->oco3[1] = t->oco3[1];
- *trip = t; trip++; t++;
- *trip = t; trip++; t++;
+ *trip = t; trip++; t++;
+ *trip = t; trip++; t++;
}
}
@@ -4107,7 +4107,7 @@ static void p_smooth(PChart *chart)
p_node_delete(root);
BLI_memarena_free(arena);
-
+
MEM_freeN(triangles);
}
@@ -4149,7 +4149,7 @@ void param_delete(ParamHandle *handle)
for (i = 0; i < phandle->ncharts; i++)
p_chart_delete(phandle->charts[i]);
-
+
if (phandle->charts)
MEM_freeN(phandle->charts);
@@ -4496,24 +4496,24 @@ static void param_pack_rotate(ParamHandle *handle)
}
void param_pack(ParamHandle *handle, float margin, bool do_rotate)
-{
+{
/* box packing variables */
BoxPack *boxarray, *box;
float tot_width, tot_height, scale;
-
+
PChart *chart;
int i, unpacked = 0;
float trans[2];
double area = 0.0;
-
+
PHandle *phandle = (PHandle *)handle;
-
+
if (phandle->ncharts == 0)
return;
-
+
if (phandle->aspx != phandle->aspy)
param_scale(handle, 1.0f / phandle->aspx, 1.0f / phandle->aspy);
-
+
/* this could be its own function */
if (do_rotate) {
param_pack_rotate(handle);
@@ -4521,33 +4521,33 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate)
/* we may not use all these boxes */
boxarray = MEM_mallocN(phandle->ncharts * sizeof(BoxPack), "BoxPack box");
-
-
+
+
for (i = 0; i < phandle->ncharts; i++) {
chart = phandle->charts[i];
-
+
if (chart->flag & PCHART_NOPACK) {
unpacked++;
continue;
}
-
+
box = boxarray + (i - unpacked);
-
+
p_chart_uv_bbox(chart, trans, chart->u.pack.size);
-
+
trans[0] = -trans[0];
trans[1] = -trans[1];
-
+
p_chart_uv_translate(chart, trans);
-
+
box->w = chart->u.pack.size[0] + trans[0];
box->h = chart->u.pack.size[1] + trans[1];
box->index = i; /* warning this index skips PCHART_NOPACK boxes */
-
+
if (margin > 0.0f)
area += (double)sqrtf(box->w * box->h);
}
-
+
if (margin > 0.0f) {
/* multiply the margin by the area to give predictable results not dependent on UV scale,
* ...Without using the area running pack multiple times also gives a bad feedback loop.
@@ -4556,12 +4556,12 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate)
unpacked = 0;
for (i = 0; i < phandle->ncharts; i++) {
chart = phandle->charts[i];
-
+
if (chart->flag & PCHART_NOPACK) {
unpacked++;
continue;
}
-
+
box = boxarray + (i - unpacked);
trans[0] = margin;
trans[1] = margin;
@@ -4570,19 +4570,19 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate)
box->h += margin * 2;
}
}
-
+
BLI_box_pack_2d(boxarray, phandle->ncharts - unpacked, &tot_width, &tot_height);
-
+
if (tot_height > tot_width)
scale = 1.0f / tot_height;
else
scale = 1.0f / tot_width;
-
+
for (i = 0; i < phandle->ncharts - unpacked; i++) {
box = boxarray + i;
trans[0] = box->x;
trans[1] = box->y;
-
+
chart = phandle->charts[box->index];
p_chart_uv_translate(chart, trans);
p_chart_uv_scale(chart, scale);
@@ -4601,54 +4601,54 @@ void param_average(ParamHandle *handle)
float tot_fac, fac;
float minv[2], maxv[2], trans[2];
PHandle *phandle = (PHandle *)handle;
-
+
if (phandle->ncharts == 0)
return;
-
+
for (i = 0; i < phandle->ncharts; i++) {
PFace *f;
chart = phandle->charts[i];
if (chart->flag & PCHART_NOPACK)
continue;
-
+
chart->u.pack.area = 0.0f; /* 3d area */
chart->u.pack.rescale = 0.0f; /* UV area, abusing rescale for tmp storage, oh well :/ */
-
+
for (f = chart->faces; f; f = f->nextlink) {
chart->u.pack.area += p_face_area(f);
chart->u.pack.rescale += fabsf(p_face_uv_area_signed(f));
}
-
+
tot_facearea += chart->u.pack.area;
tot_uvarea += chart->u.pack.rescale;
}
-
+
if (tot_facearea == tot_uvarea || tot_facearea == 0.0f || tot_uvarea == 0.0f) {
/* nothing to do */
return;
}
-
+
tot_fac = tot_facearea / tot_uvarea;
-
+
for (i = 0; i < phandle->ncharts; i++) {
chart = phandle->charts[i];
if (chart->flag & PCHART_NOPACK)
continue;
-
+
if (chart->u.pack.area != 0.0f && chart->u.pack.rescale != 0.0f) {
fac = chart->u.pack.area / chart->u.pack.rescale;
-
+
/* Get the island center */
p_chart_uv_bbox(chart, minv, maxv);
trans[0] = (minv[0] + maxv[0]) / -2.0f;
trans[1] = (minv[1] + maxv[1]) / -2.0f;
-
+
/* Move center to 0,0 */
p_chart_uv_translate(chart, trans);
p_chart_uv_scale(chart, sqrtf(fac / tot_fac));
-
+
/* Move to original center */
trans[0] = -trans[0];
trans[1] = -trans[1];