code clenup: rename BKE_mesh_poly_calc_angles -> BKE_mesh_calc_poly_angles

This commit is contained in:
Campbell Barton 2013-05-08 12:56:51 +00:00
parent f433f011cf
commit 76b1e8bc09
3 changed files with 37 additions and 37 deletions

@ -102,6 +102,9 @@ void BKE_mesh_calc_poly_center(struct MPoly *mpoly, struct MLoop *loopstart,
float BKE_mesh_calc_poly_area(struct MPoly *mpoly, struct MLoop *loopstart,
struct MVert *mvarray, const float polynormal[3]);
void BKE_mesh_calc_poly_angles(struct MPoly *mpoly, struct MLoop *loopstart,
struct MVert *mvarray, float angles[]);
void BKE_mesh_calc_relative_deform(
const struct MPoly *mpoly, const int totpoly,
const struct MLoop *mloop, const int totvert,
@ -342,8 +345,6 @@ void BKE_mesh_loops_to_mface_corners(struct CustomData *fdata, struct CustomData
const int numTex, const int numCol, const int hasPCol, const int hasOrigSpace);
void BKE_mesh_poly_edgehash_insert(struct EdgeHash *ehash, const struct MPoly *mp, const struct MLoop *mloop);
void BKE_mesh_poly_calc_angles(struct MVert *mvert, struct MLoop *mloop,
struct MPoly *mp, float angles[]);
void BKE_mesh_do_versions_cd_flag_init(struct Mesh *mesh);

@ -3462,20 +3462,21 @@ void BKE_mesh_tessface_clear(Mesh *mesh)
}
#if 0 /* slow version of the function below */
void BKE_mesh_poly_calc_angles(MVert *mvert, MLoop *mloop,
MPoly *mp, float angles[])
void BKE_mesh_calc_poly_angles(MPoly *mpoly, MLoop *loopstart,
MVert *mvarray, float angles[])
{
MLoop *ml;
MLoop *mloop = &loopstart[-mpoly->loopstart];
int j;
for (j = 0, ml = mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
MLoop *ml_prev = ME_POLY_LOOP_PREV(mloop, mp, j);
MLoop *ml_next = ME_POLY_LOOP_NEXT(mloop, mp, j);
for (j = 0, ml = loopstart; j < mpoly->totloop; j++, ml++) {
MLoop *ml_prev = ME_POLY_LOOP_PREV(mloop, mpoly, j);
MLoop *ml_next = ME_POLY_LOOP_NEXT(mloop, mpoly, j);
float e1[3], e2[3];
sub_v3_v3v3(e1, mvert[ml_next->v].co, mvert[ml->v].co);
sub_v3_v3v3(e2, mvert[ml_prev->v].co, mvert[ml->v].co);
sub_v3_v3v3(e1, mvarray[ml_next->v].co, mvarray[ml->v].co);
sub_v3_v3v3(e2, mvarray[ml_prev->v].co, mvarray[ml->v].co);
angles[j] = (float)M_PI - angle_v3v3(e1, e2);
}
@ -3483,6 +3484,31 @@ void BKE_mesh_poly_calc_angles(MVert *mvert, MLoop *mloop,
#else /* equivalent the function above but avoid multiple subtractions + normalize */
void BKE_mesh_calc_poly_angles(MPoly *mpoly, MLoop *loopstart,
MVert *mvarray, float angles[])
{
float nor_prev[3];
float nor_next[3];
int i_this = mpoly->totloop - 1;
int i_next = 0;
sub_v3_v3v3(nor_prev, mvarray[loopstart[i_this - 1].v].co, mvarray[loopstart[i_this].v].co);
normalize_v3(nor_prev);
while (i_next < mpoly->totloop) {
sub_v3_v3v3(nor_next, mvarray[loopstart[i_this].v].co, mvarray[loopstart[i_next].v].co);
normalize_v3(nor_next);
angles[i_this] = angle_normalized_v3v3(nor_prev, nor_next);
/* step */
copy_v3_v3(nor_prev, nor_next);
i_this = i_next;
i_next++;
}
}
#endif
void BKE_mesh_poly_edgehash_insert(EdgeHash *ehash, const MPoly *mp, const MLoop *mloop)
{
const MLoop *ml, *ml_next;
@ -3501,33 +3527,6 @@ void BKE_mesh_poly_edgehash_insert(EdgeHash *ehash, const MPoly *mp, const MLoop
}
}
void BKE_mesh_poly_calc_angles(MVert *mvert, MLoop *mloop,
MPoly *mp, float angles[])
{
MLoop *ml = mloop + mp->loopstart;
float nor_prev[3];
float nor_next[3];
int i_this = mp->totloop - 1;
int i_next = 0;
sub_v3_v3v3(nor_prev, mvert[ml[i_this - 1].v].co, mvert[ml[i_this].v].co);
normalize_v3(nor_prev);
while (i_next < mp->totloop) {
sub_v3_v3v3(nor_next, mvert[ml[i_this].v].co, mvert[ml[i_next].v].co);
normalize_v3(nor_next);
angles[i_this] = angle_normalized_v3v3(nor_prev, nor_next);
/* step */
copy_v3_v3(nor_prev, nor_next);
i_this = i_next;
i_next++;
}
}
#endif
void BKE_mesh_do_versions_cd_flag_init(Mesh *mesh)
{
if (UNLIKELY(mesh->cd_flag)) {

@ -520,7 +520,7 @@ static DerivedMesh *applyModifier(
}
for (i = 0, mp = mpoly; i < numFaces; i++, mp++) {
/* #BKE_mesh_poly_calc_angles logic is inlined here */
/* #BKE_mesh_calc_poly_angles logic is inlined here */
float nor_prev[3];
float nor_next[3];