diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-09 10:04:17 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-09 10:04:17 +0400 |
commit | dfdfa3d51b48a6bffd90779a1778dcf0e9a751e4 (patch) | |
tree | f51a4ea8668ee41182a5d60942e96804004d3c7a /source/blender/editors/armature | |
parent | 42517463821d0d0bbebe7c45bf40c06f4d8e9261 (diff) |
code cleanup: replace macros VECCOPY, VECADD, VECSUB, INPR - with BLI_math funcs.
added copy float/double funcs: copy_v3fl_v3db(), copy_v3db_v3fl(). 2d & 4d too.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/editarmature_generate.c | 34 | ||||
-rw-r--r-- | source/blender/editors/armature/reeb.c | 24 |
2 files changed, 26 insertions, 32 deletions
diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c index 3d020067700..37d095221c9 100644 --- a/source/blender/editors/armature/editarmature_generate.c +++ b/source/blender/editors/armature/editarmature_generate.c @@ -161,9 +161,8 @@ int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int sta current_length += len_v3v3(v1, v2); - if (current_length >= length_threshold) - { - VECCOPY(p, v2); + if (current_length >= length_threshold) { + copy_v3_v3(p, v2); return i; } @@ -190,10 +189,9 @@ int nextAdaptativeSubdivision(ToolSettings *toolsettings, BArcIterator *iter, in IT_peek(iter, i); sub_v3_v3v3(n, iter->p, head); - if (calcArcCorrelation(iter, start, i, start_p, n) < correlation_threshold) - { + if (calcArcCorrelation(iter, start, i, start_p, n) < correlation_threshold) { IT_peek(iter, i - 1); - VECCOPY(p, iter->p); + copy_v3_v3(p, iter->p); return i - 1; } } @@ -240,25 +238,22 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st //printf("a %f, b %f, c %f, f %f\n", a, b, c, f); - if (isnan(f) == 0 && f < 1.0f) - { - VECCOPY(p, dv); + if (isnan(f) == 0 && f < 1.0f) { + copy_v3_v3(p, dv); mul_v3_fl(p, f); add_v3_v3(p, vec0); } - else - { - VECCOPY(p, vec1); + else { + copy_v3_v3(p, vec1); } } - else - { + else { float dv[3]; sub_v3_v3v3(dv, vec1, vec0); normalize_v3(dv); - VECCOPY(p, dv); + copy_v3_v3(p, dv); mul_v3_fl(p, lengthLimit); add_v3_v3(p, head); } @@ -289,7 +284,7 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase * IT_head(iter); parent = ED_armature_edit_bone_add(arm, "Bone"); - VECCOPY(parent->head, iter->p); + copy_v3_v3(parent->head, iter->p); if (iter->size > 0) { @@ -304,7 +299,7 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase * IT_peek(iter, index); child = ED_armature_edit_bone_add(arm, "Bone"); - VECCOPY(child->head, parent->tail); + copy_v3_v3(child->head, parent->tail); child->parent = parent; child->flag |= BONE_CONNECTED; @@ -329,9 +324,8 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase * iter->tail(iter); - VECCOPY(parent->tail, iter->p); - if (iter->size > 0) - { + copy_v3_v3(parent->tail, iter->p); + if (iter->size > 0) { parent->rad_tail = iter->size * size_buffer; } diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 08f95ecb08a..97113109981 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -247,7 +247,7 @@ static ReebNode * addNode(ReebGraph *rg, EditVert *eve) node->degree = 0; node->weight = weight; node->index = rg->totnodes; - VECCOPY(node->p, eve->co); + copy_v3_v3(node->p, eve->co); BLI_addtail(&rg->nodes, node); rg->totnodes++; @@ -487,11 +487,11 @@ void repositionNodes(ReebGraph *rg) { float p[3]; - VECCOPY(p, ((ReebArc*)arc)->buckets[0].p); + copy_v3_v3(p, ((ReebArc*)arc)->buckets[0].p); mul_v3_fl(p, 1.0f / arc->head->degree); add_v3_v3(arc->head->p, p); - VECCOPY(p, ((ReebArc*)arc)->buckets[((ReebArc*)arc)->bcount - 1].p); + copy_v3_v3(p, ((ReebArc*)arc)->buckets[((ReebArc*)arc)->bcount - 1].p); mul_v3_fl(p, 1.0f / arc->tail->degree); add_v3_v3(arc->tail->p, p); } @@ -647,7 +647,7 @@ static void mergeBuckets(EmbedBucket *bDst, EmbedBucket *bSrc) else if (bSrc->nv > 0) { bDst->nv = bSrc->nv; - VECCOPY(bDst->p, bSrc->p); + copy_v3_v3(bDst->p, bSrc->p); } } @@ -963,7 +963,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count) float axis[3]; int i; - VECCOPY(axis, root_node->symmetry_axis); + copy_v3_v3(axis, root_node->symmetry_axis); /* first pass, merge incrementally */ for (i = 0; i < count - 1; i++) @@ -1046,7 +1046,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count) arc2 = (ReebArc*)ring[j].arc; /* copy first node than mirror */ - VECCOPY(node2->p, node1->p); + copy_v3_v3(node2->p, node1->p); BLI_mirrorAlongAxis(node2->p, root_node->p, normal); /* Copy buckets @@ -1081,7 +1081,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count) { /* copy and mirror back to bucket2 */ bucket2->nv = bucket1->nv; - VECCOPY(bucket2->p, bucket1->p); + copy_v3_v3(bucket2->p, bucket1->p); BLI_mirrorAlongAxis(bucket2->p, node->p, normal); } } @@ -1096,10 +1096,10 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr arc1 = (ReebArc*)barc1; arc2 = (ReebArc*)barc2; - VECCOPY(nor, root_node->symmetry_axis); + copy_v3_v3(nor, root_node->symmetry_axis); /* mirror node2 along axis */ - VECCOPY(p, node2->p); + copy_v3_v3(p, node2->p); BLI_mirrorAlongAxis(p, root_node->p, nor); /* average with node1 */ @@ -1107,7 +1107,7 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr mul_v3_fl(node1->p, 0.5f); /* mirror back on node2 */ - VECCOPY(node2->p, node1->p); + copy_v3_v3(node2->p, node1->p); BLI_mirrorAlongAxis(node2->p, root_node->p, nor); /* Merge buckets @@ -1149,7 +1149,7 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr /* copy and mirror back to bucket2 */ bucket2->nv = bucket1->nv; - VECCOPY(bucket2->p, bucket1->p); + copy_v3_v3(bucket2->p, bucket1->p); BLI_mirrorAlongAxis(bucket2->p, root_node->p, nor); } } @@ -1798,7 +1798,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold)) vec0 = previous->p; } - VECCOPY(midpoint, vec1); + copy_v3_v3(midpoint, vec1); distance = len_v3v3(midpoint, efa->cent); |