[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50515] branches/soc-2012-sushi/source/ blender/bmesh/operators/bmo_bevel.c: Clean up warnings, formatting, spelling, and remove
Howard Trickey
howard.trickey at gmail.com
Tue Sep 11 03:10:56 CEST 2012
Revision: 50515
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50515
Author: howardt
Date: 2012-09-11 01:10:53 +0000 (Tue, 11 Sep 2012)
Log Message:
-----------
Clean up warnings, formatting, spelling, and remove
debugging code.
Modified Paths:
--------------
branches/soc-2012-sushi/source/blender/bmesh/operators/bmo_bevel.c
Modified: branches/soc-2012-sushi/source/blender/bmesh/operators/bmo_bevel.c
===================================================================
--- branches/soc-2012-sushi/source/blender/bmesh/operators/bmo_bevel.c 2012-09-10 23:36:07 UTC (rev 50514)
+++ branches/soc-2012-sushi/source/blender/bmesh/operators/bmo_bevel.c 2012-09-11 01:10:53 UTC (rev 50515)
@@ -69,18 +69,18 @@
/* list of new vertices formed around v */
-typedef struct AdditionalVert{
+typedef struct AdditionalVert {
struct AdditionalVert *next, *prev;
- BMVert *v; /* parrent vertex */
+ BMVert *v; /* parent vertex */
ListBase vertices; /* List of auxiliary vertices */
- int count; /* count input edges, alse count additioanl vertex */
+ int count; /* count input edges, alse count additional vertex */
int countSelect; /* count input selection edges */
} AdditionalVert;
/* Item in the list of additional vertices */
-typedef struct VertexItem{
+typedef struct VertexItem {
struct VertexItem *next, *prev;
BMVert *v;
int onEdge; /* 1 if new vertex located on edge; edge1 = edge, edge2 = NULL
@@ -121,7 +121,7 @@
} SurfaceEdgeData;
-BMVert* bevel_create_unic_vertex(BMesh *bm, BevelParams *bp, float co[3]);
+BMVert* bevel_create_unique_vertex(BMesh *bm, BevelParams *bp, float co[3]);
static void calc_corner_co(BMLoop *l, const float fac, float r_co[3],
const short do_dist, const short do_even)
@@ -249,10 +249,10 @@
)
-void recalculate_aditional_vert(BMesh* bm, BevelParams* bp, VertexItem *vi, BMEdge* sEdge)
+void recalculate_additional_vert(BMesh* bm, BevelParams* bp, VertexItem *vi, BMEdge* sEdge)
{
- // берем минимальный отсуп
- float ve[3], sve[3], angle, lenght, viLen, vie[3];
+ /* get minimum clearance */
+ float ve[3], sve[3], angle, length, viLen, vie[3];
BMVert *v;
v = vi->parent->v;
@@ -260,55 +260,43 @@
sub_v3_v3v3(sve, BM_edge_other_vert(sEdge, v)->co, v->co);
angle = angle_v3v3(ve, sve);
- lenght = bp->offset / sin(angle);
+ length = bp->offset / sin(angle);
sub_v3_v3v3(vie, v->co, vi->v->co);
viLen = len_v3(vie);
- if (lenght < viLen){
+ if (length < viLen){
normalize_v3(ve);
- mul_v3_fl(ve, lenght);
+ mul_v3_fl(ve, length);
add_v3_v3(ve, v->co);
vi->v = BM_vert_create(bm, ve, NULL);
}
}
/* build point on edge
-* sEdge - selectes edge */
-BMVert* bevel_calc_aditional_vert(BMesh *bm, BevelParams *bp, BMEdge *sEdge, BMEdge* edge, BMVert* v)
+* sEdge - selects edge */
+BMVert* bevel_calc_additional_vert(BMesh *bm, BevelParams *bp, BMEdge *sEdge, BMEdge* edge, BMVert* v)
{
BMVert *new_Vert = NULL;
- /*float vect[3], normV[3];
- sub_v3_v3v3(vect, BM_edge_other_vert(edge, v)->co, v->co);
- normalize_v3_v3(normV, vect);
- mul_v3_fl(normV, bp->offset);
- add_v3_v3(normV, v->co);
+ float ve[3], sve[3], angle, length;
- new_Vert = bevel_create_unic_vertex(bm, bp, normV);
- return new_Vert;*/
-
- float ve[3], sve[3], angle, lenght;
-
sub_v3_v3v3(ve, BM_edge_other_vert(edge, v)->co, v->co);
sub_v3_v3v3(sve, BM_edge_other_vert(sEdge, v)->co, v->co);
angle = angle_v3v3(ve, sve);
- lenght = bp->offset / sin(angle);
+ length = bp->offset / sin(angle);
- //if (bp->maxOffset < lenght)
- // bp->maxOffset = lenght;
-
normalize_v3(ve);
- mul_v3_fl(ve, lenght);
+ mul_v3_fl(ve, length);
add_v3_v3(ve, v->co);
- new_Vert = bevel_create_unic_vertex(bm, bp, ve);
+ new_Vert = bevel_create_unique_vertex(bm, bp, ve);
return new_Vert;
}
-BMVert* bevel_create_unic_vertex(BMesh *bm, BevelParams *bp, float co[3])
+BMVert* bevel_create_unique_vertex(BMesh *bm, BevelParams *bp, float co[3])
{
float epsilon = 1e-6;
BMVert *v = NULL;
@@ -318,7 +306,7 @@
v = item->v;
}
if (!v) {
- item = (NewVertexItem*)MEM_callocN(sizeof(NewVertexItem), "VertexItem");
+ item = (NewVertexItem*)MEM_callocN(sizeof(NewVertexItem), "NewVertexItem");
item->v = BM_vert_create(bm, co, NULL);
BLI_addtail(&bp->newVertList, item);
v = item->v;
@@ -345,27 +333,14 @@
angel = angle_v3v3(norm_a, norm_b);
mul_v3_fl(norm_c, offset / sin(angel/2));
add_v3_v3(norm_c, vert->co);
- /*
- mul_v3_fl(v_c, 0.5);
- normalize_v3_v3(norm_c, v_c);
- // v_c ^ edge_a
- //cos = (v_c[0]*v_a[0] + v_c[1]*v_a[1] + v_c[2]*v_a[0]) / (len_v3(v_c)*len_v3(v_a));
- angel = angle_normalized_v3v3(norm_c, norm_a);
- //offset = offset / (sqrt(1-cos*cos));
- offset = offset / sin(angel);
-
- mul_v3_fl(norm_c, offset);
- add_v3_v3(norm_c, vert->co);
- */
-
new_vert = BM_vert_create(bm, norm_c, NULL);
return new_vert;
}
/*
-* looking neighboring unselected Edge at the face
+* look for neighboring unselected Edge on the face
*/
BMEdge* find_non_selected_adjacent_edge(BMesh *bm, BMFace *f, BMEdge *e, BMVert *v){
BMEdge *oe = NULL;
@@ -412,16 +387,10 @@
result = e;
}
- /*e = bmesh_disk_faceedge_find_first(ed, av->v);
- do {
- e = bmesh_disk_edge_next(e, av->v);
- if (BMO_elem_flag_test(bm, e, EDGE_SELECTED))
- result = e;
- } while (e != ed);*/
return result;
}
-int check_dublicated_vertex_item(AdditionalVert *item, BMFace *f)
+int check_duplicated_vertex_item(AdditionalVert *item, BMFace *f)
{
VertexItem *vItem;
int result = 0;
@@ -469,7 +438,6 @@
VertexItem* calc_support_vertex(BMEdge *e, BMVert *v, VertexItem *itemA, VertexItem *itemB)
{
VertexItem *item;
-// float vect[3], normV[3];
float M[3], N[3];
item = (VertexItem*)MEM_callocN(sizeof(VertexItem), "VertexItem");
@@ -479,13 +447,6 @@
item->f = NULL;
item->v = NULL;
- /*sub_v3_v3v3(vect, BM_edge_other_vert(e, v)->co, v->co);
- normalize_v3_v3(normV, vect);
- mul_v3_fl(normV, bp->offset);
- add_v3_v3(normV, v->co);
-
- copy_v3_v3(item->hv, normV);*/
-
calc_len_between_line(v->co, BM_edge_other_vert(e, v)->co, itemA->v->co, itemB->v->co, M, N);
copy_v3_v3(item->hv, M);
@@ -496,10 +457,9 @@
return NULL if not dublicated
return dublicated item
*/
-VertexItem* check_dublicated_vertex_item_by_edge(AdditionalVert *av, BMEdge* edge)
+VertexItem* check_duplicated_vertex_item_by_edge(AdditionalVert *av, BMEdge* edge)
{
VertexItem *vitem, *vi = NULL;
-// int result = 0;
for (vitem = av->vertices.first; vitem; vitem = vitem->next) {
if ((vitem->onEdge == 1) &&
@@ -513,7 +473,7 @@
VertexItem* find_on_edge_vertex_item(AdditionalVert* av, BMEdge *e)
{
VertexItem *item, *r = NULL;
- for (item = av->vertices.first; item; item = item->next){
+ for (item = av->vertices.first; item; item = item->next) {
if ((item->onEdge == 1) && (item->edge1 == e))
r = item;
}
@@ -524,7 +484,7 @@
VertexItem* find_between_vertex_item(AdditionalVert* av, BMEdge *e, VertexItem *exclI)
{
VertexItem *item, *r = NULL;
- for (item = av->vertices.first; item; item = item->next){
+ for (item = av->vertices.first; item; item = item->next) {
if (exclI != NULL){
if ((item->onEdge == 0) &&
(item != exclI) &&
@@ -543,15 +503,14 @@
/*
* additional construction arround the vertex
*/
-void bevel_aditional_construction_by_vert(BMesh *bm, BevelParams *bp, BMOperator *op, BMVert *v)
+void bevel_additional_construction_by_vert(BMesh *bm, BevelParams *bp, BMOperator *op, BMVert *v)
{
BMOIter siter;
- //BMIter iter;
BMEdge *e, **edges = NULL;
BLI_array_declare(edges);
- // calc count input selected edges
+ /* gather input selected edges */
BMO_ITER (e, &siter, bm, op, "geom", BM_EDGE) {
if ((e->v1 == v)|| (BM_edge_other_vert(e, e->v1) == v))
{
@@ -578,16 +537,14 @@
BMIter iter;
av->countSelect++;
- /* calc additional point, calc support vertex on edge */
- //BLI_addtail(&av->vertices, calc_support_vertex(bp, e, v));
/* point located beteween selecion edges*/
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
BMLoop *l = f->l_first;
BMEdge *adjacentE = NULL;
do {
- if ((l->e == e) && (find_selected_edge_in_face(bm, f, e, v) !=NULL )){
- if (!check_dublicated_vertex_item(av, f)) {
+ if ((l->e == e) && (find_selected_edge_in_face(bm, f, e, v) !=NULL )) {
+ if (!check_duplicated_vertex_item(av, f)) {
VertexItem *item;
item = (VertexItem*)MEM_callocN(sizeof(VertexItem), "VertexItem");
item->parent = av;
@@ -602,8 +559,8 @@
}
adjacentE = find_non_selected_adjacent_edge(bm, f, e, v);
- if ((l->e == e) && (adjacentE != NULL)){
- if (check_dublicated_vertex_item_by_edge(av, adjacentE) == NULL){
+ if ((l->e == e) && (adjacentE != NULL)) {
+ if (check_duplicated_vertex_item_by_edge(av, adjacentE) == NULL){
VertexItem *item;
item = (VertexItem*)MEM_callocN(sizeof(VertexItem), "VertexItem");
item->parent = av;
@@ -611,13 +568,14 @@
item->edge1 = adjacentE;
item->edge2 = NULL;
item->f = NULL;
- item->v = bevel_calc_aditional_vert(bm, bp, e, adjacentE, v);
+ item->v = bevel_calc_additional_vert(bm, bp, e, adjacentE, v);
BLI_addtail(&av->vertices, item);
av->count ++;
- } else{
- recalculate_aditional_vert(bm, bp, check_dublicated_vertex_item_by_edge(av, adjacentE), e);
}
+ else {
+ recalculate_additional_vert(bm, bp, check_duplicated_vertex_item_by_edge(av, adjacentE), e);
+ }
}
l = l->next;
@@ -626,18 +584,6 @@
}
- /* non seleced edge */
- /*if (!BMO_elem_flag_test(bm, e, EDGE_SELECTED)){
- VertexItem *item;
- item = (VertexItem*)MEM_callocN(sizeof(VertexItem), "VertexItem");
- item->onEdge = 1;
- item->edge1 = e;
- item->edge2 = NULL;
- item->f = NULL;
- item->v = bevel_calc_aditional_vert(bm, bp, e, v);
- BLI_addtail(&av->vertices, item);
- av->count ++;
- }*/
} while (e != edges[0]);
/* calc additional point, calc support vertex on edge */
@@ -661,7 +607,6 @@
AdditionalVert* get_additionalVert_by_vert(BevelParams *bp, BMVert *v)
{
-
AdditionalVert *item;
AdditionalVert *av = NULL;
for (item = bp->vertList.first; item ; item = item->next){
@@ -669,11 +614,10 @@
av = item;
}
return av;
-
}
/*
-* return 1 if face content e
+* return 1 if face contains e
*/
int is_edge_of_face (BMFace *f, BMEdge* e)
{
@@ -695,7 +639,6 @@
float va[3], float v[3], float vb[3])
{
float vva[3], vvb[3], angle, center[3], rv[3], axis[3], co[3];
-// float tmp1[3], tmp2[3];
sub_v3_v3v3(vva, va, v);
sub_v3_v3v3(vvb, vb, v);
@@ -713,12 +656,6 @@
sub_v3_v3v3(co, v, center);
cross_v3_v3v3(axis, rv, co); /* calculate axis */
- //---------------------------------
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list