code cleanup: change C naming convention (so py and C api match), eg:

C: BM_face_calc_area(f), Py: BMFace.calc_area()
This commit is contained in:
2012-04-23 01:19:50 +00:00
parent c498c0eb42
commit 16ff7e40e6
19 changed files with 109 additions and 108 deletions

View File

@@ -579,7 +579,7 @@ void BM_editselection_center(float r_center[3], BMEditSelection *ese)
} }
else if (ese->htype == BM_FACE) { else if (ese->htype == BM_FACE) {
BMFace *efa = (BMFace *)ese->ele; BMFace *efa = (BMFace *)ese->ele;
BM_face_center_bounds_calc(efa, r_center); BM_face_calc_center_bounds(efa, r_center);
} }
} }

View File

@@ -584,6 +584,18 @@ void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *fu
} }
/**
* Return the amount of element of type 'type' in a given bmesh.
*/
int BM_mesh_elem_count(BMesh *bm, const char htype)
{
if (htype == BM_VERT) return bm->totvert;
else if (htype == BM_EDGE) return bm->totedge;
else if (htype == BM_FACE) return bm->totface;
return 0;
}
/** /**
* Remaps the vertices, edges and/or faces of the bmesh as indicated by vert/edge/face_idx arrays * Remaps the vertices, edges and/or faces of the bmesh as indicated by vert/edge/face_idx arrays
* (xxx_idx[org_index] = new_index). * (xxx_idx[org_index] = new_index).

View File

@@ -43,6 +43,8 @@ void bmesh_edit_end(BMesh *bm, int flag);
void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag); void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag);
void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *func, void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *func,
const char *msg_a, const char *msg_b); const char *msg_a, const char *msg_b);
int BM_mesh_elem_count(BMesh *bm, const char htype);
void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx); void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx);
BMVert *BM_vert_at_index(BMesh *bm, const int index); BMVert *BM_vert_at_index(BMesh *bm, const int index);

View File

@@ -817,7 +817,7 @@ int BM_face_validate(BMesh *bm, BMFace *face, FILE *err)
* *
* \note #BM_edge_rotate_check must have already run. * \note #BM_edge_rotate_check must have already run.
*/ */
void BM_edge_rotate_calc(BMEdge *e, int ccw, void BM_edge_calc_rotate(BMEdge *e, int ccw,
BMLoop **r_l1, BMLoop **r_l2) BMLoop **r_l1, BMLoop **r_l2)
{ {
BMVert *v1, *v2; BMVert *v1, *v2;
@@ -889,7 +889,7 @@ int BM_edge_rotate_check(BMEdge *e)
* 2) does the newly formed edge cause a zero area corner (or close enough to be almost zero) * 2) does the newly formed edge cause a zero area corner (or close enough to be almost zero)
* *
* \param l1,l2 are the loops of the proposed verts to rotate too and should * \param l1,l2 are the loops of the proposed verts to rotate too and should
* be the result of calling #BM_edge_rotate_calc * be the result of calling #BM_edge_calc_rotate
*/ */
int BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2) int BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2)
{ {
@@ -1016,7 +1016,7 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_
return NULL; return NULL;
} }
BM_edge_rotate_calc(e, ccw, &l1, &l2); BM_edge_calc_rotate(e, ccw, &l1, &l2);
/* the loops will be freed so assign verts */ /* the loops will be freed so assign verts */
v1 = l1->v; v1 = l1->v;

View File

@@ -59,7 +59,7 @@ BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts);
int BM_face_validate(BMesh *bm, BMFace *face, FILE *err); int BM_face_validate(BMesh *bm, BMFace *face, FILE *err);
void BM_edge_rotate_calc(BMEdge *e, int ccw, void BM_edge_calc_rotate(BMEdge *e, int ccw,
BMLoop **r_l1, BMLoop **r_l2); BMLoop **r_l1, BMLoop **r_l2);
int BM_edge_rotate_check(BMEdge *e); int BM_edge_rotate_check(BMEdge *e);
int BM_edge_rotate_check_degenerate(BMEdge *e, int BM_edge_rotate_check_degenerate(BMEdge *e,

View File

@@ -75,7 +75,7 @@ static short testedgesidef(const float v1[2], const float v2[2], const float v3[
* polygon See Graphics Gems for * polygon See Graphics Gems for
* computing newell normal. * computing newell normal.
*/ */
static void compute_poly_normal(float normal[3], float verts[][3], int nverts) static void calc_poly_normal(float normal[3], float verts[][3], int nverts)
{ {
float const *v_prev = verts[nverts - 1]; float const *v_prev = verts[nverts - 1];
float const *v_curr = verts[0]; float const *v_curr = verts[0];
@@ -95,9 +95,9 @@ static void compute_poly_normal(float normal[3], float verts[][3], int nverts)
/** /**
* \brief COMPUTE POLY NORMAL (BMFace) * \brief COMPUTE POLY NORMAL (BMFace)
* *
* Same as #compute_poly_normal but operates directly on a bmesh face. * Same as #calc_poly_normal but operates directly on a bmesh face.
*/ */
static void bm_face_compute_poly_normal(BMFace *f) static void bm_face_calc_poly_normal(BMFace *f)
{ {
BMLoop *l_first = BM_FACE_FIRST_LOOP(f); BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
BMLoop *l_iter = l_first; BMLoop *l_iter = l_first;
@@ -123,11 +123,11 @@ static void bm_face_compute_poly_normal(BMFace *f)
/** /**
* \brief COMPUTE POLY NORMAL (BMFace) * \brief COMPUTE POLY NORMAL (BMFace)
* *
* Same as #compute_poly_normal and #bm_face_compute_poly_normal * Same as #calc_poly_normal and #bm_face_calc_poly_normal
* but takes an array of vertex locations. * but takes an array of vertex locations.
*/ */
static void bm_face_compute_poly_normal_vertex_cos(BMFace *f, float n[3], static void bm_face_calc_poly_normal_vertex_cos(BMFace *f, float n[3],
float const (*vertexCos)[3]) float const (*vertexCos)[3])
{ {
BMLoop *l_first = BM_FACE_FIRST_LOOP(f); BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
BMLoop *l_iter = l_first; BMLoop *l_iter = l_first;
@@ -153,7 +153,7 @@ static void bm_face_compute_poly_normal_vertex_cos(BMFace *f, float n[3],
/** /**
* get the area of the face * get the area of the face
*/ */
float BM_face_area_calc(BMFace *f) float BM_face_calc_area(BMFace *f)
{ {
BMLoop *l; BMLoop *l;
BMIter iter; BMIter iter;
@@ -175,7 +175,7 @@ float BM_face_area_calc(BMFace *f)
area = area_quad_v3(verts[0], verts[1], verts[2], verts[3]); area = area_quad_v3(verts[0], verts[1], verts[2], verts[3]);
} }
else { else {
compute_poly_normal(normal, verts, f->len); calc_poly_normal(normal, verts, f->len);
area = area_poly_v3(f->len, verts, normal); area = area_poly_v3(f->len, verts, normal);
} }
@@ -187,7 +187,7 @@ float BM_face_area_calc(BMFace *f)
/** /**
* compute the perimeter of an ngon * compute the perimeter of an ngon
*/ */
float BM_face_perimeter_calc(BMFace *f) float BM_face_calc_perimeter(BMFace *f)
{ {
BMLoop *l_iter, *l_first; BMLoop *l_iter, *l_first;
float perimeter = 0.0f; float perimeter = 0.0f;
@@ -203,7 +203,7 @@ float BM_face_perimeter_calc(BMFace *f)
/** /**
* computes center of face in 3d. uses center of bounding box. * computes center of face in 3d. uses center of bounding box.
*/ */
void BM_face_center_bounds_calc(BMFace *f, float r_cent[3]) void BM_face_calc_center_bounds(BMFace *f, float r_cent[3])
{ {
BMLoop *l_iter; BMLoop *l_iter;
BMLoop *l_first; BMLoop *l_first;
@@ -222,7 +222,7 @@ void BM_face_center_bounds_calc(BMFace *f, float r_cent[3])
/** /**
* computes the center of a face, using the mean average * computes the center of a face, using the mean average
*/ */
void BM_face_center_mean_calc(BMFace *f, float r_cent[3]) void BM_face_calc_center_mean(BMFace *f, float r_cent[3])
{ {
BMLoop *l_iter; BMLoop *l_iter;
BMLoop *l_first; BMLoop *l_first;
@@ -245,7 +245,7 @@ void BM_face_center_mean_calc(BMFace *f, float r_cent[3])
* a plane defined by the average * a plane defined by the average
* of its edges cross products * of its edges cross products
*/ */
void compute_poly_plane(float (*verts)[3], const int nverts) void calc_poly_plane(float (*verts)[3], const int nverts)
{ {
float avgc[3], norm[3], mag, avgn[3]; float avgc[3], norm[3], mag, avgn[3];
@@ -432,7 +432,7 @@ void BM_face_normal_update(BMFace *f)
} }
default: default:
{ {
bm_face_compute_poly_normal(f); bm_face_calc_poly_normal(f);
break; break;
} }
} }
@@ -474,7 +474,7 @@ void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3],
} }
default: default:
{ {
bm_face_compute_poly_normal_vertex_cos(f, no, vertexCos); bm_face_calc_poly_normal_vertex_cos(f, no, vertexCos);
break; break;
} }
} }
@@ -610,9 +610,9 @@ int BM_face_point_inside_test(BMFace *f, const float co[3])
return crosses % 2 != 0; return crosses % 2 != 0;
} }
static int goodline(float const (*projectverts)[3], BMFace *f, static int bm_face_goodline(float const (*projectverts)[3], BMFace *f,
int v1i, int v2i, int v3i, int v1i, int v2i, int v3i,
int UNUSED(nvert)) int UNUSED(nvert))
{ {
BMLoop *l_iter; BMLoop *l_iter;
BMLoop *l_first; BMLoop *l_first;
@@ -697,9 +697,9 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int nvert, const int
if (BM_edge_exists(v1, v3)) { if (BM_edge_exists(v1, v3)) {
isear = FALSE; isear = FALSE;
} }
else if (!goodline((float const (*)[3])verts, f, else if (!bm_face_goodline((float const (*)[3])verts, f,
BM_elem_index_get(v1), BM_elem_index_get(v2), BM_elem_index_get(v3), BM_elem_index_get(v1), BM_elem_index_get(v2), BM_elem_index_get(v3),
nvert)) nvert))
{ {
isear = FALSE; isear = FALSE;
} }
@@ -765,12 +765,12 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3],
///bmesh_face_normal_update(bm, f, f->no, projectverts); ///bmesh_face_normal_update(bm, f, f->no, projectverts);
compute_poly_normal(f->no, projectverts, f->len); calc_poly_normal(f->no, projectverts, f->len);
poly_rotate_plane(f->no, projectverts, i); poly_rotate_plane(f->no, projectverts, i);
nvert = f->len; nvert = f->len;
//compute_poly_plane(projectverts, i); //calc_poly_plane(projectverts, i);
for (i = 0; i < nvert; i++) { for (i = 0; i < nvert; i++) {
projectverts[i][2] = 0.0f; projectverts[i][2] = 0.0f;
} }
@@ -879,7 +879,7 @@ void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len)
a++; a++;
} }
compute_poly_normal(no, projverts, f->len); calc_poly_normal(no, projverts, f->len);
poly_rotate_plane(no, projverts, f->len); poly_rotate_plane(no, projverts, f->len);
poly_rotate_plane(no, edgeverts, len * 2); poly_rotate_plane(no, edgeverts, len * 2);

View File

@@ -27,10 +27,10 @@
* \ingroup bmesh * \ingroup bmesh
*/ */
float BM_face_area_calc(BMFace *f); float BM_face_calc_area(BMFace *f);
float BM_face_perimeter_calc(BMFace *f); float BM_face_calc_perimeter(BMFace *f);
void BM_face_center_bounds_calc(BMFace *f, float center[3]); void BM_face_calc_center_bounds(BMFace *f, float center[3]);
void BM_face_center_mean_calc(BMFace *f, float center[3]); void BM_face_calc_center_mean(BMFace *f, float center[3]);
void BM_face_normal_update(BMFace *f); void BM_face_normal_update(BMFace *f);
void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3], void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3],

View File

@@ -65,7 +65,7 @@ int bmesh_disk_count(BMVert *v);
#define BM_ELEM_API_FLAG_DISABLE(element, f) ((element)->oflags[0].pflag &= ~(f)) #define BM_ELEM_API_FLAG_DISABLE(element, f) ((element)->oflags[0].pflag &= ~(f))
#define BM_ELEM_API_FLAG_TEST(element, f) ((element)->oflags[0].pflag & (f)) #define BM_ELEM_API_FLAG_TEST(element, f) ((element)->oflags[0].pflag & (f))
void compute_poly_plane(float (*verts)[3], const int nverts); void calc_poly_plane(float (*verts)[3], const int nverts);
void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nverts); void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nverts);
/* include the rest of our private declarations */ /* include the rest of our private declarations */

View File

@@ -41,18 +41,6 @@
#define BM_OVERLAP (1 << 13) #define BM_OVERLAP (1 << 13)
/**
* Return the amount of element of type 'type' in a given bmesh.
*/
int BM_mesh_elem_count(BMesh *bm, const char htype)
{
if (htype == BM_VERT) return bm->totvert;
else if (htype == BM_EDGE) return bm->totedge;
else if (htype == BM_FACE) return bm->totface;
return 0;
}
/** /**
* Returns whether or not a given vertex is * Returns whether or not a given vertex is
* is part of a given edge. * is part of a given edge.
@@ -364,7 +352,7 @@ BMEdge *BM_vert_other_disk_edge(BMVert *v, BMEdge *e_first)
/** /**
* Returms edge length * Returms edge length
*/ */
float BM_edge_length_calc(BMEdge *e) float BM_edge_calc_length(BMEdge *e)
{ {
return len_v3v3(e->v1->co, e->v2->co); return len_v3v3(e->v1->co, e->v2->co);
} }
@@ -779,7 +767,7 @@ void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
* *
* \return angle in radians * \return angle in radians
*/ */
float BM_loop_face_angle(BMLoop *l) float BM_loop_calc_face_angle(BMLoop *l)
{ {
return angle_v3v3v3(l->prev->v->co, return angle_v3v3v3(l->prev->v->co,
l->v->co, l->v->co,
@@ -787,7 +775,7 @@ float BM_loop_face_angle(BMLoop *l)
} }
/** /**
* \brief BM_loop_face_normal * \brief BM_loop_calc_face_normal
* *
* Calculate the normal at this loop corner or fallback to the face normal on straignt lines. * Calculate the normal at this loop corner or fallback to the face normal on straignt lines.
* *
@@ -795,7 +783,7 @@ float BM_loop_face_angle(BMLoop *l)
* \param l The loop to calculate the normal at * \param l The loop to calculate the normal at
* \param r_normal Resulting normal * \param r_normal Resulting normal
*/ */
void BM_loop_face_normal(BMLoop *l, float r_normal[3]) void BM_loop_calc_face_normal(BMLoop *l, float r_normal[3])
{ {
if (normal_tri_v3(r_normal, if (normal_tri_v3(r_normal,
l->prev->v->co, l->prev->v->co,
@@ -810,7 +798,7 @@ void BM_loop_face_normal(BMLoop *l, float r_normal[3])
} }
/** /**
* \brief BM_loop_face_tangent * \brief BM_loop_calc_face_tangent
* *
* Calculate the tangent at this loop corner or fallback to the face normal on straignt lines. * Calculate the tangent at this loop corner or fallback to the face normal on straignt lines.
* This vector always points inward into the face. * This vector always points inward into the face.
@@ -819,7 +807,7 @@ void BM_loop_face_normal(BMLoop *l, float r_normal[3])
* \param l The loop to calculate the tangent at * \param l The loop to calculate the tangent at
* \param r_tangent Resulting tangent * \param r_tangent Resulting tangent
*/ */
void BM_loop_face_tangent(BMLoop *l, float r_tangent[3]) void BM_loop_calc_face_tangent(BMLoop *l, float r_tangent[3])
{ {
float v_prev[3]; float v_prev[3];
float v_next[3]; float v_next[3];
@@ -853,7 +841,7 @@ void BM_loop_face_tangent(BMLoop *l, float r_tangent[3])
* *
* \return angle in radians * \return angle in radians
*/ */
float BM_edge_face_angle(BMEdge *e) float BM_edge_calc_face_angle(BMEdge *e)
{ {
if (BM_edge_is_manifold(e)) { if (BM_edge_is_manifold(e)) {
BMLoop *l1 = e->l; BMLoop *l1 = e->l;
@@ -871,13 +859,13 @@ float BM_edge_face_angle(BMEdge *e)
* Calculate the tangent at this loop corner or fallback to the face normal on straignt lines. * Calculate the tangent at this loop corner or fallback to the face normal on straignt lines.
* This vector always points inward into the face. * This vector always points inward into the face.
* *
* \brief BM_edge_face_tangent * \brief BM_edge_calc_face_tangent
* \param e * \param e
* \param e_loop The loop to calculate the tangent at, * \param e_loop The loop to calculate the tangent at,
* used to get the face and winding direction. * used to get the face and winding direction.
*/ */
void BM_edge_face_tangent(BMEdge *e, BMLoop *e_loop, float r_tangent[3]) void BM_edge_calc_face_tangent(BMEdge *e, BMLoop *e_loop, float r_tangent[3])
{ {
float tvec[3]; float tvec[3];
BMVert *v1, *v2; BMVert *v1, *v2;
@@ -897,7 +885,7 @@ void BM_edge_face_tangent(BMEdge *e, BMLoop *e_loop, float r_tangent[3])
* *
* \returns the angle in radians * \returns the angle in radians
*/ */
float BM_vert_edge_angle(BMVert *v) float BM_vert_calc_edge_angle(BMVert *v)
{ {
BMEdge *e1, *e2; BMEdge *e1, *e2;
@@ -905,9 +893,9 @@ float BM_vert_edge_angle(BMVert *v)
* get the edges and count them both at once */ * get the edges and count them both at once */
if ((e1 = v->e) && if ((e1 = v->e) &&
(e2 = bmesh_disk_edge_next(e1, v)) && (e2 = bmesh_disk_edge_next(e1, v)) &&
/* make sure we come full circle and only have 2 connected edges */ /* make sure we come full circle and only have 2 connected edges */
(e1 == bmesh_disk_edge_next(e2, v))) (e1 == bmesh_disk_edge_next(e2, v)))
{ {
BMVert *v1 = BM_edge_other_vert(e1, v); BMVert *v1 = BM_edge_other_vert(e1, v);
BMVert *v2 = BM_edge_other_vert(e2, v); BMVert *v2 = BM_edge_other_vert(e2, v);
@@ -923,7 +911,7 @@ float BM_vert_edge_angle(BMVert *v)
* \note this isn't optimal to run on an array of verts, * \note this isn't optimal to run on an array of verts,
* see 'solidify_add_thickness' for a function which runs on an array. * see 'solidify_add_thickness' for a function which runs on an array.
*/ */
float BM_vert_shell_factor(BMVert *v) float BM_vert_calc_shell_factor(BMVert *v)
{ {
BMIter iter; BMIter iter;
BMLoop *l; BMLoop *l;
@@ -931,7 +919,7 @@ float BM_vert_shell_factor(BMVert *v)
float accum_angle = 0.0f; float accum_angle = 0.0f;
BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
const float face_angle = BM_loop_face_angle(l); const float face_angle = BM_loop_calc_face_angle(l);
accum_shell += shell_angle_to_dist(angle_normalized_v3v3(v->no, l->f->no)) * face_angle; accum_shell += shell_angle_to_dist(angle_normalized_v3v3(v->no, l->f->no)) * face_angle;
accum_angle += face_angle; accum_angle += face_angle;
} }

View File

@@ -27,8 +27,6 @@
* \ingroup bmesh * \ingroup bmesh
*/ */
int BM_mesh_elem_count(BMesh *bm, const char htype);
int BM_vert_in_face(BMFace *f, BMVert *v); int BM_vert_in_face(BMFace *f, BMVert *v);
int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len); int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len);
@@ -37,7 +35,7 @@ int BM_edge_in_face(BMFace *f, BMEdge *e);
int BM_vert_in_edge(BMEdge *e, BMVert *v); int BM_vert_in_edge(BMEdge *e, BMVert *v);
int BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e); int BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e);
float BM_edge_length_calc(BMEdge *e); float BM_edge_calc_length(BMEdge *e);
int BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb); int BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb);
int BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb); int BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb);
BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v); BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v);
@@ -58,15 +56,15 @@ int BM_vert_is_manifold(BMVert *v);
int BM_edge_is_manifold(BMEdge *e); int BM_edge_is_manifold(BMEdge *e);
int BM_edge_is_boundary(BMEdge *e); int BM_edge_is_boundary(BMEdge *e);
float BM_loop_face_angle(BMLoop *l); float BM_loop_calc_face_angle(BMLoop *l);
void BM_loop_face_normal(BMLoop *l, float r_normal[3]); void BM_loop_calc_face_normal(BMLoop *l, float r_normal[3]);
void BM_loop_face_tangent(BMLoop *l, float r_tangent[3]); void BM_loop_calc_face_tangent(BMLoop *l, float r_tangent[3]);
float BM_edge_face_angle(BMEdge *e); float BM_edge_calc_face_angle(BMEdge *e);
void BM_edge_face_tangent(BMEdge *e, BMLoop *e_loop, float r_tangent[3]); void BM_edge_calc_face_tangent(BMEdge *e, BMLoop *e_loop, float r_tangent[3]);
float BM_vert_edge_angle(BMVert *v); float BM_vert_calc_edge_angle(BMVert *v);
float BM_vert_shell_factor(BMVert *v); float BM_vert_calc_shell_factor(BMVert *v);
BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2); BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2);

View File

@@ -486,10 +486,10 @@ void dummy_exec(BMesh *bm, BMOperator *op)
* convert angles [0-PI/2] -> [0-1], multiply together, then convert back to radians. */ * convert angles [0-PI/2] -> [0-1], multiply together, then convert back to radians. */
float bm_vert_edge_face_angle(BMVert *v) float bm_vert_edge_face_angle(BMVert *v)
{ {
const float angle = BM_vert_edge_angle(v); const float angle = BM_vert_calc_edge_angle(v);
/* note: could be either edge, it doesn't matter */ /* note: could be either edge, it doesn't matter */
if (v->e && BM_edge_is_manifold(v->e)) { if (v->e && BM_edge_is_manifold(v->e)) {
return ((angle * ANGLE_TO_UNIT) * (BM_edge_face_angle(v->e) * ANGLE_TO_UNIT)) * UNIT_TO_ANGLE; return ((angle * ANGLE_TO_UNIT) * (BM_edge_calc_face_angle(v->e) * ANGLE_TO_UNIT)) * UNIT_TO_ANGLE;
} }
else { else {
return angle; return angle;
@@ -528,7 +528,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
/* go through and split edge */ /* go through and split edge */
for (i = 0, tot_found = 0; i < einput->len; i++) { for (i = 0, tot_found = 0; i < einput->len; i++) {
BMEdge *e = ((BMEdge **)einput->data.p)[i]; BMEdge *e = ((BMEdge **)einput->data.p)[i];
const float angle = BM_edge_face_angle(e); const float angle = BM_edge_calc_face_angle(e);
if (angle < angle_limit) { if (angle < angle_limit) {
tot_found++; tot_found++;
@@ -546,7 +546,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
if (/* may have become non-manifold */ if (/* may have become non-manifold */
BM_edge_is_manifold(e) && BM_edge_is_manifold(e) &&
/* check twice because cumulative effect could dissolve over angle limit */ /* check twice because cumulative effect could dissolve over angle limit */
(BM_edge_face_angle(e) < angle_limit)) (BM_edge_calc_face_angle(e) < angle_limit))
{ {
BMFace *nf = BM_faces_join_pair(bm, e->l->f, BMFace *nf = BM_faces_join_pair(bm, e->l->f,
e->l->radial_next->f, e->l->radial_next->f,

View File

@@ -90,7 +90,7 @@ float bm_vert_avg_tag_dist(BMVert *v)
BM_ITER_ELEM_INDEX (e, &iter, v, BM_EDGES_OF_VERT, tot) { BM_ITER_ELEM_INDEX (e, &iter, v, BM_EDGES_OF_VERT, tot) {
BMVert *v_other = BM_edge_other_vert(e, v); BMVert *v_other = BM_edge_other_vert(e, v);
if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) { if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) {
length += BM_edge_length_calc(e); length += BM_edge_calc_length(e);
} }
} }
@@ -173,7 +173,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
i = BM_elem_index_get(e); i = BM_elem_index_get(e);
if (i != -1) { if (i != -1) {
/* calc edge-split info */ /* calc edge-split info */
es->length = BM_edge_length_calc(e); es->length = BM_edge_calc_length(e);
es->e_old = e; es->e_old = e;
es++; es++;
/* initialize no and e_new after */ /* initialize no and e_new after */
@@ -194,7 +194,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
/* calc edge-split info */ /* calc edge-split info */
es->e_new = es->l->e; es->e_new = es->l->e;
BM_edge_face_tangent(es->e_new, es->l, es->no); BM_edge_calc_face_tangent(es->e_new, es->l, es->no);
if (es->e_new == es->e_old) { /* happens on boundary edges */ if (es->e_new == es->e_old) { /* happens on boundary edges */
/* take care here, we're creating this double edge which _must_ have its verts replaced later on */ /* take care here, we're creating this double edge which _must_ have its verts replaced later on */
@@ -516,7 +516,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
} }
/* do in 2 passes so moving the verts doesn't feed back into face angle checks /* do in 2 passes so moving the verts doesn't feed back into face angle checks
* which BM_vert_shell_factor uses. */ * which BM_vert_calc_shell_factor uses. */
/* over allocate */ /* over allocate */
varr_co = MEM_callocN(sizeof(*varr_co) * bm->totvert, __func__); varr_co = MEM_callocN(sizeof(*varr_co) * bm->totvert, __func__);
@@ -525,7 +525,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
if (BM_elem_flag_test(v, BM_ELEM_TAG)) { if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
const float fac = (depth * const float fac = (depth *
(use_relative_offset ? bm_vert_avg_tag_dist(v) : 1.0f) * (use_relative_offset ? bm_vert_avg_tag_dist(v) : 1.0f) *
(use_even_boundry ? BM_vert_shell_factor(v) : 1.0f)); (use_even_boundry ? BM_vert_calc_shell_factor(v) : 1.0f));
madd_v3_v3v3fl(varr_co[i], v->co, v->no, fac); madd_v3_v3v3fl(varr_co[i], v->co, v->no, fac);
} }
} }

View File

@@ -322,7 +322,7 @@ void bmo_righthandfaces_exec(BMesh *bm, BMOperator *op)
if (!startf) startf = f; if (!startf) startf = f;
BM_face_center_bounds_calc(f, cent); BM_face_calc_center_bounds(f, cent);
if ((maxx_test = dot_v3v3(cent, cent)) > maxx) { if ((maxx_test = dot_v3v3(cent, cent)) > maxx) {
maxx = maxx_test; maxx = maxx_test;
@@ -332,7 +332,7 @@ void bmo_righthandfaces_exec(BMesh *bm, BMOperator *op)
if (!startf) return; if (!startf) return;
BM_face_center_bounds_calc(startf, cent); BM_face_calc_center_bounds(startf, cent);
/* make sure the starting face has the correct winding */ /* make sure the starting face has the correct winding */
if (dot_v3v3(cent, startf->no) < 0.0f) { if (dot_v3v3(cent, startf->no) < 0.0f) {
@@ -473,7 +473,7 @@ static float ngon_fake_area(BMFace *f)
float v[3], sv[3], c[3]; float v[3], sv[3], c[3];
float area = 0.0f; float area = 0.0f;
BM_face_center_mean_calc(f, c); BM_face_calc_center_mean(f, c);
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
if (num_verts == 0) { if (num_verts == 0) {
@@ -563,12 +563,12 @@ void bmo_similarfaces_exec(BMesh *bm, BMOperator *op)
switch (type) { switch (type) {
case SIMFACE_PERIMETER: case SIMFACE_PERIMETER:
/* set the perimeter */ /* set the perimeter */
f_ext[i].perim = BM_face_perimeter_calc(f_ext[i].f); f_ext[i].perim = BM_face_calc_perimeter(f_ext[i].f);
break; break;
case SIMFACE_COPLANAR: case SIMFACE_COPLANAR:
/* compute the center of the polygon */ /* compute the center of the polygon */
BM_face_center_mean_calc(f_ext[i].f, f_ext[i].c); BM_face_calc_center_mean(f_ext[i].f, f_ext[i].c);
/* normalize the polygon normal */ /* normalize the polygon normal */
copy_v3_v3(t_no, f_ext[i].f->no); copy_v3_v3(t_no, f_ext[i].f->no);
@@ -740,7 +740,7 @@ void bmo_similaredges_exec(BMesh *bm, BMOperator *op)
case SIMEDGE_FACE_ANGLE: case SIMEDGE_FACE_ANGLE:
e_ext[i].faces = BM_edge_face_count(e_ext[i].e); e_ext[i].faces = BM_edge_face_count(e_ext[i].e);
if (e_ext[i].faces == 2) if (e_ext[i].faces == 2)
e_ext[i].angle = BM_edge_face_angle(e_ext[i].e); e_ext[i].angle = BM_edge_calc_face_angle(e_ext[i].e);
break; break;
} }
} }

View File

@@ -789,15 +789,15 @@ static float UNUSED_FUNCTION(BME_bevel_get_angle_vert)(BMVert *v)
BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
BM_loop_face_normal(l, n_tmp); BM_loop_calc_face_normal(l, n_tmp);
madd_v3_v3fl(n, n_tmp, BM_loop_face_angle(l)); madd_v3_v3fl(n, n_tmp, BM_loop_calc_face_angle(l));
} }
normalize_v3(n); normalize_v3(n);
BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
/* could cache from before */ /* could cache from before */
BM_loop_face_normal(l, n_tmp); BM_loop_calc_face_normal(l, n_tmp);
angle_diff += angle_normalized_v3v3(n, n_tmp) * (BM_loop_face_angle(l) * (float)(M_PI * 0.5)); angle_diff += angle_normalized_v3v3(n, n_tmp) * (BM_loop_calc_face_angle(l) * (float)(M_PI * 0.5));
} }
return angle_diff; return angle_diff;

View File

@@ -454,10 +454,10 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
BM_ITER_ELEM (l, &iter, vout[i], BM_LOOPS_OF_VERT) { BM_ITER_ELEM (l, &iter, vout[i], BM_LOOPS_OF_VERT) {
if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) { if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) {
float l_mid_co[3]; float l_mid_co[3];
BM_loop_face_tangent(l, l_mid_co); BM_loop_calc_face_tangent(l, l_mid_co);
/* scale to average of surrounding edge size, only needs to be approx */ /* scale to average of surrounding edge size, only needs to be approx */
mul_v3_fl(l_mid_co, (BM_edge_length_calc(l->e) + BM_edge_length_calc(l->prev->e)) / 2.0f); mul_v3_fl(l_mid_co, (BM_edge_calc_length(l->e) + BM_edge_calc_length(l->prev->e)) / 2.0f);
add_v3_v3(l_mid_co, v->co); add_v3_v3(l_mid_co, v->co);
d = edbm_rip_rip_edgedist(ar, projectMat, v->co, l_mid_co, fmval); d = edbm_rip_rip_edgedist(ar, projectMat, v->co, l_mid_co, fmval);

View File

@@ -2845,7 +2845,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
} }
if (me->drawflag & ME_DRAWEXTRA_FACEAREA) { if (me->drawflag & ME_DRAWEXTRA_FACEAREA) {
/* would be nice to use BM_face_area_calc, but that is for 2d faces /* would be nice to use BM_face_calc_area, but that is for 2d faces
* so instead add up tessellation triangle areas */ * so instead add up tessellation triangle areas */
BMFace *f; BMFace *f;
int n; int n;
@@ -2910,7 +2910,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
BMIter liter; BMIter liter;
BMLoop *loop; BMLoop *loop;
BM_face_center_bounds_calc(efa, vmid); BM_face_calc_center_bounds(efa, vmid);
for (loop = BM_iter_new(&liter, em->bm, BM_LOOPS_OF_FACE, efa); for (loop = BM_iter_new(&liter, em->bm, BM_LOOPS_OF_FACE, efa);
loop; loop = BM_iter_step(&liter)) loop; loop = BM_iter_step(&liter))
@@ -2984,7 +2984,7 @@ static void draw_em_indices(BMEditMesh *em)
UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col); UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) { if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
BM_face_center_mean_calc(f, pos); BM_face_calc_center_mean(f, pos);
sprintf(numstr, "%d", i); sprintf(numstr, "%d", i);
view3d_cached_text_draw_add(pos, numstr, 0, txt_flag, col); view3d_cached_text_draw_add(pos, numstr, 0, txt_flag, col);
} }

View File

@@ -1961,7 +1961,7 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f
BM_ITER_ELEM (efa, &iter, eve, BM_FACES_OF_VERT) { BM_ITER_ELEM (efa, &iter, eve, BM_FACES_OF_VERT) {
if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) { if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
BM_face_center_mean_calc(efa, cent_r); BM_face_calc_center_mean(efa, cent_r);
break; break;
} }
} }

View File

@@ -200,7 +200,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len); poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
totarea += BM_face_area_calc(efa); totarea += BM_face_calc_area(efa);
//totuvarea += tf_area(tf, efa->v4!=0); //totuvarea += tf_area(tf, efa->v4!=0);
totuvarea += poly_uv_area(tf_uv, efa->len); totuvarea += poly_uv_area(tf_uv, efa->len);
@@ -232,7 +232,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
else { else {
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(efa, BM_ELEM_TAG)) { if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
area = BM_face_area_calc(efa) / totarea; area = BM_face_calc_area(efa) / totarea;
BLI_array_empty(tf_uv); BLI_array_empty(tf_uv);
BLI_array_empty(tf_uvorig); BLI_array_empty(tf_uvorig);

View File

@@ -99,6 +99,7 @@ PyDoc_STRVAR(bpy_bm_elem_select_doc, "Selected state of this element.\n\n:type:
PyDoc_STRVAR(bpy_bm_elem_hide_doc, "Hidden state of this element.\n\n:type: boolean"); PyDoc_STRVAR(bpy_bm_elem_hide_doc, "Hidden state of this element.\n\n:type: boolean");
PyDoc_STRVAR(bpy_bm_elem_tag_doc, "Generic attribute scripts can use for own logic\n\n:type: boolean"); PyDoc_STRVAR(bpy_bm_elem_tag_doc, "Generic attribute scripts can use for own logic\n\n:type: boolean");
PyDoc_STRVAR(bpy_bm_elem_smooth_doc, "Smooth state of this element.\n\n:type: boolean"); PyDoc_STRVAR(bpy_bm_elem_smooth_doc, "Smooth state of this element.\n\n:type: boolean");
PyDoc_STRVAR(bpy_bm_elem_seam_doc, "Seam for UV unwrapping.\n\n:type: boolean");
static PyObject *bpy_bm_elem_hflag_get(BPy_BMElem *self, void *flag) static PyObject *bpy_bm_elem_hflag_get(BPy_BMElem *self, void *flag)
@@ -601,7 +602,7 @@ static PyGetSetDef bpy_bmedge_getseters[] = {
{(char *)"index", (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc, NULL}, {(char *)"index", (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc, NULL},
{(char *)"smooth", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_smooth_doc, (void *)BM_ELEM_SMOOTH}, {(char *)"smooth", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_smooth_doc, (void *)BM_ELEM_SMOOTH},
{(char *)"seam", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_smooth_doc, (void *)BM_ELEM_SEAM}, {(char *)"seam", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_seam_doc, (void *)BM_ELEM_SEAM},
/* connectivity data */ /* connectivity data */
{(char *)"verts", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmedge_verts_doc, (void *)BM_VERTS_OF_EDGE}, {(char *)"verts", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmedge_verts_doc, (void *)BM_VERTS_OF_EDGE},
@@ -1197,7 +1198,7 @@ PyDoc_STRVAR(bpy_bmvert_calc_edge_angle_doc,
static PyObject *bpy_bmvert_calc_edge_angle(BPy_BMVert *self) static PyObject *bpy_bmvert_calc_edge_angle(BPy_BMVert *self)
{ {
BPY_BM_CHECK_OBJ(self); BPY_BM_CHECK_OBJ(self);
return PyFloat_FromDouble(BM_vert_edge_angle(self->v)); return PyFloat_FromDouble(BM_vert_calc_edge_angle(self->v));
} }
PyDoc_STRVAR(bpy_bmvert_calc_shell_factor_doc, PyDoc_STRVAR(bpy_bmvert_calc_shell_factor_doc,
@@ -1213,7 +1214,7 @@ PyDoc_STRVAR(bpy_bmvert_calc_shell_factor_doc,
static PyObject *bpy_bmvert_calc_shell_factor(BPy_BMVert *self) static PyObject *bpy_bmvert_calc_shell_factor(BPy_BMVert *self)
{ {
BPY_BM_CHECK_OBJ(self); BPY_BM_CHECK_OBJ(self);
return PyFloat_FromDouble(BM_vert_shell_factor(self->v)); return PyFloat_FromDouble(BM_vert_calc_shell_factor(self->v));
} }
PyDoc_STRVAR(bpy_bmvert_normal_update_doc, PyDoc_STRVAR(bpy_bmvert_normal_update_doc,
@@ -1255,7 +1256,7 @@ PyDoc_STRVAR(bpy_bmedge_calc_face_angle_doc,
static PyObject *bpy_bmedge_calc_face_angle(BPy_BMEdge *self) static PyObject *bpy_bmedge_calc_face_angle(BPy_BMEdge *self)
{ {
BPY_BM_CHECK_OBJ(self); BPY_BM_CHECK_OBJ(self);
return PyFloat_FromDouble(BM_edge_face_angle(self->e)); return PyFloat_FromDouble(BM_edge_calc_face_angle(self->e));
} }
PyDoc_STRVAR(bpy_bmedge_calc_tangent_doc, PyDoc_STRVAR(bpy_bmedge_calc_tangent_doc,
@@ -1283,7 +1284,7 @@ static PyObject *bpy_bmedge_calc_tangent(BPy_BMEdge *self, PyObject *args)
float vec[3]; float vec[3];
BPY_BM_CHECK_OBJ(py_loop); BPY_BM_CHECK_OBJ(py_loop);
/* no need to check if they are from the same mesh or even connected */ /* no need to check if they are from the same mesh or even connected */
BM_edge_face_tangent(self->e, py_loop->l, vec); BM_edge_calc_face_tangent(self->e, py_loop->l, vec);
return Vector_CreatePyObject(vec, 3, Py_NEW, NULL); return Vector_CreatePyObject(vec, 3, Py_NEW, NULL);
} }
} }
@@ -1441,7 +1442,7 @@ PyDoc_STRVAR(bpy_bmface_calc_area_doc,
static PyObject *bpy_bmface_calc_area(BPy_BMFace *self) static PyObject *bpy_bmface_calc_area(BPy_BMFace *self)
{ {
BPY_BM_CHECK_OBJ(self); BPY_BM_CHECK_OBJ(self);
return PyFloat_FromDouble(BM_face_area_calc(self->f)); return PyFloat_FromDouble(BM_face_calc_area(self->f));
} }
@@ -1456,7 +1457,7 @@ PyDoc_STRVAR(bpy_bmface_calc_perimeter_doc,
static PyObject *bpy_bmface_calc_perimeter(BPy_BMFace *self) static PyObject *bpy_bmface_calc_perimeter(BPy_BMFace *self)
{ {
BPY_BM_CHECK_OBJ(self); BPY_BM_CHECK_OBJ(self);
return PyFloat_FromDouble(BM_face_perimeter_calc(self->f)); return PyFloat_FromDouble(BM_face_calc_perimeter(self->f));
} }
@@ -1473,7 +1474,7 @@ static PyObject *bpy_bmface_calc_center_mean(BPy_BMFace *self)
float cent[3]; float cent[3];
BPY_BM_CHECK_OBJ(self); BPY_BM_CHECK_OBJ(self);
BM_face_center_mean_calc(self->f, cent); BM_face_calc_center_mean(self->f, cent);
return Vector_CreatePyObject(cent, 3, Py_NEW, NULL); return Vector_CreatePyObject(cent, 3, Py_NEW, NULL);
} }
@@ -1491,7 +1492,7 @@ static PyObject *bpy_bmface_calc_center_bounds(BPy_BMFace *self)
float cent[3]; float cent[3];
BPY_BM_CHECK_OBJ(self); BPY_BM_CHECK_OBJ(self);
BM_face_center_bounds_calc(self->f, cent); BM_face_calc_center_bounds(self->f, cent);
return Vector_CreatePyObject(cent, 3, Py_NEW, NULL); return Vector_CreatePyObject(cent, 3, Py_NEW, NULL);
} }
@@ -1570,7 +1571,7 @@ PyDoc_STRVAR(bpy_bmloop_calc_angle_doc,
static PyObject *bpy_bmloop_calc_angle(BPy_BMLoop *self) static PyObject *bpy_bmloop_calc_angle(BPy_BMLoop *self)
{ {
BPY_BM_CHECK_OBJ(self); BPY_BM_CHECK_OBJ(self);
return PyFloat_FromDouble(BM_loop_face_angle(self->l)); return PyFloat_FromDouble(BM_loop_calc_face_angle(self->l));
} }
PyDoc_STRVAR(bpy_bmloop_calc_normal_doc, PyDoc_STRVAR(bpy_bmloop_calc_normal_doc,
@@ -1586,7 +1587,7 @@ static PyObject *bpy_bmloop_calc_normal(BPy_BMLoop *self)
{ {
float vec[3]; float vec[3];
BPY_BM_CHECK_OBJ(self); BPY_BM_CHECK_OBJ(self);
BM_loop_face_normal(self->l, vec); BM_loop_calc_face_normal(self->l, vec);
return Vector_CreatePyObject(vec, 3, Py_NEW, NULL); return Vector_CreatePyObject(vec, 3, Py_NEW, NULL);
} }
@@ -1603,7 +1604,7 @@ static PyObject *bpy_bmloop_calc_tangent(BPy_BMLoop *self)
{ {
float vec[3]; float vec[3];
BPY_BM_CHECK_OBJ(self); BPY_BM_CHECK_OBJ(self);
BM_loop_face_tangent(self->l, vec); BM_loop_calc_face_tangent(self->l, vec);
return Vector_CreatePyObject(vec, 3, Py_NEW, NULL); return Vector_CreatePyObject(vec, 3, Py_NEW, NULL);
} }