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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-11-10 23:43:45 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-11-10 23:43:45 +0300
commit37e4a311b0ad9da7177e50620efc3561e2dd7045 (patch)
tree8aea2cc851ab828ee040d601ed4c776283fd639a /source/blender/editors
parent4617bb68ba4b1c5ab459673fffd98bf7203bb4f2 (diff)
Math Lib
* Convert all code to use new functions. * Branch maintainers may want to skip this commit, and run this conversion script instead, if they use a lot of math functions in new code: http://www.pasteall.org/9052/python
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c2
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c2
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c2
-rw-r--r--source/blender/editors/animation/drivers.c2
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c2
-rw-r--r--source/blender/editors/animation/keyframes_draw.c2
-rw-r--r--source/blender/editors/animation/keyframes_edit.c2
-rw-r--r--source/blender/editors/animation/keyframes_general.c2
-rw-r--r--source/blender/editors/animation/keyframing.c12
-rw-r--r--source/blender/editors/animation/keyingsets.c2
-rw-r--r--source/blender/editors/armature/armature_ops.c2
-rw-r--r--source/blender/editors/armature/editarmature.c266
-rw-r--r--source/blender/editors/armature/editarmature_generate.c68
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c180
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c122
-rw-r--r--source/blender/editors/armature/meshlaplacian.c98
-rw-r--r--source/blender/editors/armature/poseSlide.c10
-rw-r--r--source/blender/editors/armature/poselib.c2
-rw-r--r--source/blender/editors/armature/poseobject.c36
-rw-r--r--source/blender/editors/armature/reeb.c94
-rw-r--r--source/blender/editors/curve/curve_ops.c2
-rw-r--r--source/blender/editors/curve/editcurve.c148
-rw-r--r--source/blender/editors/curve/editfont.c4
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c10
-rw-r--r--source/blender/editors/gpencil/editaction_gpencil.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_buttons.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c14
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c8
-rw-r--r--source/blender/editors/interface/interface.c4
-rw-r--r--source/blender/editors/interface/interface_draw.c2
-rw-r--r--source/blender/editors/interface/interface_handlers.c14
-rw-r--r--source/blender/editors/interface/interface_icons.c2
-rw-r--r--source/blender/editors/interface/interface_panel.c2
-rw-r--r--source/blender/editors/interface/interface_regions.c2
-rw-r--r--source/blender/editors/interface/interface_style.c2
-rw-r--r--source/blender/editors/interface/interface_templates.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c2
-rw-r--r--source/blender/editors/mesh/editface.c28
-rw-r--r--source/blender/editors/mesh/editmesh.c24
-rw-r--r--source/blender/editors/mesh/editmesh_add.c76
-rw-r--r--source/blender/editors/mesh/editmesh_lib.c140
-rw-r--r--source/blender/editors/mesh/editmesh_loop.c4
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c96
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c162
-rw-r--r--source/blender/editors/mesh/mesh_data.c4
-rw-r--r--source/blender/editors/mesh/mesh_ops.c2
-rw-r--r--source/blender/editors/mesh/meshtools.c40
-rw-r--r--source/blender/editors/metaball/mball_edit.c18
-rw-r--r--source/blender/editors/object/object_add.c6
-rw-r--r--source/blender/editors/object/object_constraint.c20
-rw-r--r--source/blender/editors/object/object_edit.c12
-rw-r--r--source/blender/editors/object/object_hook.c46
-rw-r--r--source/blender/editors/object/object_modifier.c18
-rw-r--r--source/blender/editors/object/object_ops.c2
-rw-r--r--source/blender/editors/object/object_relations.c16
-rw-r--r--source/blender/editors/object/object_select.c4
-rw-r--r--source/blender/editors/object/object_shapekey.c2
-rw-r--r--source/blender/editors/object/object_transform.c88
-rw-r--r--source/blender/editors/physics/particle_edit.c152
-rw-r--r--source/blender/editors/physics/particle_object.c22
-rw-r--r--source/blender/editors/physics/physics_fluid.c6
-rw-r--r--source/blender/editors/render/render_preview.c2
-rw-r--r--source/blender/editors/render/render_shading.c2
-rw-r--r--source/blender/editors/screen/area.c2
-rw-r--r--source/blender/editors/screen/glutil.c2
-rw-r--r--source/blender/editors/screen/screen_ops.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c294
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c14
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c22
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c100
-rw-r--r--source/blender/editors/space_action/action_draw.c2
-rw-r--r--source/blender/editors/space_action/action_edit.c2
-rw-r--r--source/blender/editors/space_action/action_select.c2
-rw-r--r--source/blender/editors/space_action/space_action.c2
-rw-r--r--source/blender/editors/space_api/space.c2
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c2
-rw-r--r--source/blender/editors/space_console/space_console.c2
-rw-r--r--source/blender/editors/space_file/space_file.c2
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c2
-rw-r--r--source/blender/editors/space_graph/graph_draw.c2
-rw-r--r--source/blender/editors/space_graph/graph_edit.c2
-rw-r--r--source/blender/editors/space_graph/graph_select.c2
-rw-r--r--source/blender/editors/space_graph/graph_utils.c2
-rw-r--r--source/blender/editors/space_graph/space_graph.c2
-rw-r--r--source/blender/editors/space_image/image_buttons.c2
-rw-r--r--source/blender/editors/space_image/image_ops.c2
-rw-r--r--source/blender/editors/space_image/space_image.c2
-rw-r--r--source/blender/editors/space_info/space_info.c2
-rw-r--r--source/blender/editors/space_logic/logic_buttons.c2
-rw-r--r--source/blender/editors/space_logic/space_logic.c2
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c2
-rw-r--r--source/blender/editors/space_nla/nla_channels.c2
-rw-r--r--source/blender/editors/space_nla/nla_draw.c2
-rw-r--r--source/blender/editors/space_nla/nla_edit.c2
-rw-r--r--source/blender/editors/space_nla/nla_header.c2
-rw-r--r--source/blender/editors/space_nla/nla_ops.c2
-rw-r--r--source/blender/editors/space_nla/nla_select.c2
-rw-r--r--source/blender/editors/space_nla/space_nla.c2
-rw-r--r--source/blender/editors/space_node/drawnode.c2
-rw-r--r--source/blender/editors/space_node/node_draw.c2
-rw-r--r--source/blender/editors/space_node/node_edit.c4
-rw-r--r--source/blender/editors/space_node/space_node.c2
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c2
-rw-r--r--source/blender/editors/space_script/script_ops.c2
-rw-r--r--source/blender/editors/space_script/space_script.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c2
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c2
-rw-r--r--source/blender/editors/space_sound/space_sound.c2
-rw-r--r--source/blender/editors/space_text/space_text.c2
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c80
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c4
-rw-r--r--source/blender/editors/space_view3d/drawobject.c192
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c8
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c56
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c36
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c168
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c24
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c92
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c172
-rw-r--r--source/blender/editors/transform/transform.c456
-rw-r--r--source/blender/editors/transform/transform_constraints.c114
-rw-r--r--source/blender/editors/transform/transform_conversions.c288
-rw-r--r--source/blender/editors/transform/transform_generics.c82
-rw-r--r--source/blender/editors/transform/transform_input.c14
-rw-r--r--source/blender/editors/transform/transform_manipulator.c180
-rw-r--r--source/blender/editors/transform/transform_ops.c2
-rw-r--r--source/blender/editors/transform/transform_orientations.c122
-rw-r--r--source/blender/editors/transform/transform_snap.c226
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c90
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c12
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c102
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c44
141 files changed, 2614 insertions, 2614 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index e8bfbf7fe52..ca400973363 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -37,7 +37,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_listBase.h"
#include "DNA_anim_types.h"
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 1e5f1eac867..57a0f469458 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -37,7 +37,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_listBase.h"
#include "DNA_anim_types.h"
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index d707ea0a2c4..98b6d0e7097 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -40,7 +40,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_anim_types.h"
#include "DNA_key_types.h"
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 13f38dae6ea..ac2eec6fd21 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -36,7 +36,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_dynstr.h"
#include "DNA_anim_types.h"
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 65c73355ad7..872722607ce 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -47,7 +47,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 019ece64132..a84ca580a15 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -41,7 +41,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_dlrbTree.h"
#include "DNA_listBase.h"
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 7a167cb6c0c..d4ec78ace16 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -32,7 +32,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_anim_types.h"
#include "DNA_action_types.h"
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index 3ad6ddf2c6f..9d3fc7a0fc4 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -33,7 +33,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_anim_types.h"
#include "DNA_action_types.h"
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 0412ee89e51..17a7dd91ed8 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -36,7 +36,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_dynstr.h"
#include "DNA_anim_types.h"
@@ -617,7 +617,7 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
else if (strstr(identifier, "rotation")) {
float eul[3];
- Mat4ToEul(ob->obmat, eul);
+ mat4_to_eul( eul,ob->obmat);
return eul[array_index];
}
}
@@ -632,7 +632,7 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
* be safe. Therefore, the active object is passed here, and in many cases, this
* will be what owns the pose-channel that is getting this anyway.
*/
- Mat4CpyMat4(tmat, pchan->pose_mat);
+ copy_m4_m4(tmat, pchan->pose_mat);
constraint_mat_convertspace(ob, pchan, tmat, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL);
/* Loc, Rot/Quat keyframes are supported... */
@@ -647,14 +647,14 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
float eul[3];
/* euler-rotation test before standard rotation, as standard rotation does quats */
- Mat4ToEulO(tmat, eul, pchan->rotmode);
+ mat4_to_eulO( eul, pchan->rotmode,tmat);
return eul[array_index];
}
else if (strstr(identifier, "rotation_quaternion")) {
float trimat[3][3], quat[4];
- Mat3CpyMat4(trimat, tmat);
- Mat3ToQuat_is_ok(trimat, quat);
+ copy_m3_m4(trimat, tmat);
+ mat3_to_quat_is_ok( quat,trimat);
return quat[array_index];
}
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index 0f4f29d0091..520247b77c1 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -36,7 +36,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_dynstr.h"
#include "DNA_anim_types.h"
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index e49e3d99c49..560a1458dfd 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -39,7 +39,7 @@
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 6dad0b6e90f..f89caa7b2c1 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -51,7 +51,7 @@
#include "DNA_curve_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_ghash.h"
@@ -185,13 +185,13 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
eBone->roll= 0.0f;
/* roll fixing */
- VecSubf(delta, eBone->tail, eBone->head);
+ sub_v3_v3v3(delta, eBone->tail, eBone->head);
vec_roll_to_mat3(delta, 0.0f, postmat);
- Mat3CpyMat4(premat, curBone->arm_mat);
+ copy_m3_m4(premat, curBone->arm_mat);
- Mat3Inv(imat, postmat);
- Mat3MulMat3(difmat, imat, premat);
+ invert_m3_m3(imat, postmat);
+ mul_m3_m3m3(difmat, imat, premat);
eBone->roll = (float)atan2(difmat[2][0], difmat[2][2]);
@@ -250,19 +250,19 @@ static void fix_bonelist_roll (ListBase *bonelist, ListBase *editbonelist)
if (ebone) {
/* Get the ebone premat */
- VecSubf(delta, ebone->tail, ebone->head);
+ sub_v3_v3v3(delta, ebone->tail, ebone->head);
vec_roll_to_mat3(delta, ebone->roll, premat);
/* Get the bone postmat */
- Mat3CpyMat4(postmat, curBone->arm_mat);
+ copy_m3_m4(postmat, curBone->arm_mat);
- Mat3Inv(imat, premat);
- Mat3MulMat3(difmat, imat, postmat);
+ invert_m3_m3(imat, premat);
+ mul_m3_m3m3(difmat, imat, postmat);
#if 0
printf ("Bone %s\n", curBone->name);
- printmatrix4("premat", premat);
- printmatrix4("postmat", postmat);
- printmatrix4("difmat", difmat);
+ print_m4("premat", premat);
+ print_m4("postmat", postmat);
+ print_m4("difmat", difmat);
printf ("Roll = %f\n", (-atan2(difmat[2][0], difmat[2][2]) * (180.0/M_PI)));
#endif
curBone->roll = (float)-atan2(difmat[2][0], difmat[2][2]);
@@ -287,7 +287,7 @@ void ED_armature_from_edit(Object *obedit)
/* remove zero sized bones, this gives instable restposes */
for (eBone=arm->edbo->first; eBone; eBone= neBone) {
- float len= VecLenf(eBone->head, eBone->tail);
+ float len= len_v3v3(eBone->head, eBone->tail);
neBone= eBone->next;
if (len <= 0.000001f) { /* FLT_EPSILON is too large? */
EditBone *fBone;
@@ -350,22 +350,22 @@ void ED_armature_from_edit(Object *obedit)
float delta[3];
/* Get the parent's matrix (rotation only) */
- VecSubf(delta, eBone->parent->tail, eBone->parent->head);
+ sub_v3_v3v3(delta, eBone->parent->tail, eBone->parent->head);
vec_roll_to_mat3(delta, eBone->parent->roll, M_parentRest);
/* Get this bone's matrix (rotation only) */
- VecSubf(delta, eBone->tail, eBone->head);
+ sub_v3_v3v3(delta, eBone->tail, eBone->head);
vec_roll_to_mat3(delta, eBone->roll, M_boneRest);
/* Invert the parent matrix */
- Mat3Inv(iM_parentRest, M_parentRest);
+ invert_m3_m3(iM_parentRest, M_parentRest);
/* Get the new head and tail */
- VecSubf(newBone->head, eBone->head, eBone->parent->tail);
- VecSubf(newBone->tail, eBone->tail, eBone->parent->tail);
+ sub_v3_v3v3(newBone->head, eBone->head, eBone->parent->tail);
+ sub_v3_v3v3(newBone->tail, eBone->tail, eBone->parent->tail);
- Mat3MulVecfl(iM_parentRest, newBone->head);
- Mat3MulVecfl(iM_parentRest, newBone->tail);
+ mul_m3_v3(iM_parentRest, newBone->head);
+ mul_m3_v3(iM_parentRest, newBone->tail);
}
}
/* ...otherwise add this bone to the armature's bonebase */
@@ -390,15 +390,15 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4])
{
EditBone *ebone;
bArmature *arm= ob->data;
- float scale = Mat4ToScalef(mat); /* store the scale of the matrix here to use on envelopes */
+ float scale = mat4_to_scale(mat); /* store the scale of the matrix here to use on envelopes */
/* Put the armature into editmode */
ED_armature_to_edit(ob);
/* Do the rotations */
for (ebone = arm->edbo->first; ebone; ebone=ebone->next){
- Mat4MulVecfl(mat, ebone->head);
- Mat4MulVecfl(mat, ebone->tail);
+ mul_m4_v3(mat, ebone->head);
+ mul_m4_v3(mat, ebone->tail);
ebone->rad_head *= scale;
ebone->rad_tail *= scale;
@@ -429,8 +429,8 @@ void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode)
if (centermode == 2) {
float *fp= give_cursor(scene, v3d);
VECCOPY(cent, fp);
- Mat4Invert(ob->imat, ob->obmat);
- Mat4MulVecfl(ob->imat, cent);
+ invert_m4_m4(ob->imat, ob->obmat);
+ mul_m4_v3(ob->imat, cent);
}
else {
INIT_MINMAX(min, max);
@@ -447,8 +447,8 @@ void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode)
/* Do the adjustments */
for (ebone= arm->edbo->first; ebone; ebone=ebone->next) {
- VecSubf(ebone->head, ebone->head, cent);
- VecSubf(ebone->tail, ebone->tail, cent);
+ sub_v3_v3v3(ebone->head, ebone->head, cent);
+ sub_v3_v3v3(ebone->tail, ebone->tail, cent);
}
/* Turn the list into an armature */
@@ -456,9 +456,9 @@ void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode)
/* Adjust object location for new centerpoint */
if(centermode && obedit==NULL) {
- Mat3CpyMat4(omat, ob->obmat);
+ copy_m3_m4(omat, ob->obmat);
- Mat3MulVecfl(omat, cent);
+ mul_m3_v3(omat, cent);
ob->loc[0] += cent[0];
ob->loc[1] += cent[1];
ob->loc[2] += cent[2];
@@ -524,7 +524,7 @@ static void applyarmature_fix_boneparents (Scene *scene, Object *armob)
ED_object_apply_obmat(ob);
what_does_parent(scene, ob, &workob);
- Mat4Invert(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.obmat);
}
}
}
@@ -572,16 +572,16 @@ static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
float delta[3], eul[3];
/* obtain new auto y-rotation */
- VecSubf(delta, curbone->tail, curbone->head);
+ sub_v3_v3v3(delta, curbone->tail, curbone->head);
vec_roll_to_mat3(delta, 0.0f, premat);
- Mat3Inv(imat, premat);
+ invert_m3_m3(imat, premat);
/* get pchan 'visual' matrix */
- Mat3CpyMat4(pmat, pchan->pose_mat);
+ copy_m3_m4(pmat, pchan->pose_mat);
/* remove auto from visual and get euler rotation */
- Mat3MulMat3(tmat, imat, pmat);
- Mat3ToEul(tmat, eul);
+ mul_m3_m3m3(tmat, imat, pmat);
+ mat3_to_eul( eul,tmat);
/* just use this euler-y as new roll value */
curbone->roll= eul[1];
@@ -769,8 +769,8 @@ int join_armature_exec(bContext *C, wmOperator *op)
//BASACT->flag &= ~OB_MODE_POSE;
/* Find the difference matrix */
- Mat4Invert(oimat, ob->obmat);
- Mat4MulMat4(mat, base->object->obmat, oimat);
+ invert_m4_m4(oimat, ob->obmat);
+ mul_m4_m4m4(mat, base->object->obmat, oimat);
/* Copy bones and posechannels from the object to the edit armature */
for (pchan=opose->chanbase.first; pchan; pchan=pchann) {
@@ -790,23 +790,23 @@ int join_armature_exec(bContext *C, wmOperator *op)
float delta[3];
/* Get the premat */
- VecSubf(delta, curbone->tail, curbone->head);
+ sub_v3_v3v3(delta, curbone->tail, curbone->head);
vec_roll_to_mat3(delta, curbone->roll, temp);
- Mat4One(premat); /* Mat4MulMat34 only sets 3x3 part */
- Mat4MulMat34(premat, temp, mat);
+ unit_m4(premat); /* Mat4MulMat34 only sets 3x3 part */
+ mul_m4_m3m4(premat, temp, mat);
- Mat4MulVecfl(mat, curbone->head);
- Mat4MulVecfl(mat, curbone->tail);
+ mul_m4_v3(mat, curbone->head);
+ mul_m4_v3(mat, curbone->tail);
/* Get the postmat */
- VecSubf(delta, curbone->tail, curbone->head);
+ sub_v3_v3v3(delta, curbone->tail, curbone->head);
vec_roll_to_mat3(delta, curbone->roll, temp);
- Mat4CpyMat3(postmat, temp);
+ copy_m4_m3(postmat, temp);
/* Find the roll */
- Mat4Invert(imat, premat);
- Mat4MulMat4(difmat, postmat, imat);
+ invert_m4_m4(imat, premat);
+ mul_m4_m4m4(difmat, postmat, imat);
curbone->roll -= (float)atan2(difmat[2][0], difmat[2][2]);
}
@@ -1997,16 +1997,16 @@ float ED_rollBoneToVector(EditBone *bone, float new_up_axis[3])
float mat[3][3], nor[3], up_axis[3], vec[3];
float roll;
- VecSubf(nor, bone->tail, bone->head);
+ sub_v3_v3v3(nor, bone->tail, bone->head);
vec_roll_to_mat3(nor, 0, mat);
VECCOPY(up_axis, mat[2]);
- roll = NormalizedVecAngle2(new_up_axis, up_axis);
+ roll = angle_normalized_v3v3(new_up_axis, up_axis);
- Crossf(vec, up_axis, new_up_axis);
+ cross_v3_v3v3(vec, up_axis, new_up_axis);
- if (Inpf(vec, nor) < 0)
+ if (dot_v3v3(vec, nor) < 0)
{
roll = -roll;
}
@@ -2023,21 +2023,21 @@ void auto_align_ebone_zaxisup(Scene *scene, View3D *v3d, EditBone *ebone)
float targetmat[3][3], imat[3][3], diffmat[3][3];
/* Find the current bone matrix */
- VecSubf(delta, ebone->tail, ebone->head);
+ sub_v3_v3v3(delta, ebone->tail, ebone->head);
vec_roll_to_mat3(delta, 0.0f, curmat);
/* Make new matrix based on y axis & z-up */
VECCOPY(yaxis, curmat[1]);
- Mat3One(targetmat);
+ unit_m3(targetmat);
VECCOPY(targetmat[0], xaxis);
VECCOPY(targetmat[1], yaxis);
VECCOPY(targetmat[2], zaxis);
- Mat3Ortho(targetmat);
+ normalize_m3(targetmat);
/* Find the difference between the two matrices */
- Mat3Inv(imat, targetmat);
- Mat3MulMat3(diffmat, imat, curmat);
+ invert_m3_m3(imat, targetmat);
+ mul_m3_m3m3(diffmat, imat, curmat);
// old-method... let's see if using mat3_to_vec_roll is more accurate
//ebone->roll = atan2(diffmat[2][0], diffmat[2][2]);
@@ -2055,28 +2055,28 @@ void auto_align_ebone_tocursor(Scene *scene, View3D *v3d, EditBone *ebone)
float vec[3];
/* find the current bone matrix as a 4x4 matrix (in Armature Space) */
- VecSubf(delta, ebone->tail, ebone->head);
+ sub_v3_v3v3(delta, ebone->tail, ebone->head);
vec_roll_to_mat3(delta, ebone->roll, curmat);
- Mat4CpyMat3(mat, curmat);
+ copy_m4_m3(mat, curmat);
VECCOPY(mat[3], ebone->head);
/* multiply bone-matrix by object matrix (so that bone-matrix is in WorldSpace) */
- Mat4MulMat4(tmat, mat, obedit->obmat);
- Mat4Invert(imat, tmat);
+ mul_m4_m4m4(tmat, mat, obedit->obmat);
+ invert_m4_m4(imat, tmat);
/* find position of cursor relative to bone */
- VecMat4MulVecfl(vec, imat, cursor);
+ mul_v3_m4v3(vec, imat, cursor);
/* check that cursor is in usable position */
if ((IS_EQ(vec[0], 0)==0) && (IS_EQ(vec[2], 0)==0)) {
/* Compute a rotation matrix around y */
rot[1] = (float)atan2(vec[0], vec[2]);
rot[0] = rot[2] = 0.0f;
- EulToMat4(rot, rmat);
+ eul_to_mat4( rmat,rot);
/* Multiply the bone matrix by rotation matrix. This should be new bone-matrix */
- Mat4MulMat4(tmat, rmat, mat);
- Mat3CpyMat4(curmat, tmat);
+ mul_m4_m4m4(tmat, rmat, mat);
+ copy_m3_m4(curmat, tmat);
/* Now convert from new bone-matrix, back to a roll value (in radians) */
mat3_to_vec_roll(curmat, delta, &ebone->roll);
@@ -2278,16 +2278,16 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
VECCOPY(curs, give_cursor(scene, v3d));
/* Get inverse point for head and orientation for tail */
- Mat4Invert(obedit->imat, obedit->obmat);
- Mat4MulVecfl(obedit->imat, curs);
+ invert_m4_m4(obedit->imat, obedit->obmat);
+ mul_m4_v3(obedit->imat, curs);
if (rv3d && (U.flag & USER_ADD_VIEWALIGNED))
- Mat3CpyMat4(obmat, rv3d->viewmat);
- else Mat3One(obmat);
+ copy_m3_m4(obmat, rv3d->viewmat);
+ else unit_m3(obmat);
- Mat3CpyMat4(viewmat, obedit->obmat);
- Mat3MulMat3(totmat, obmat, viewmat);
- Mat3Inv(imat, totmat);
+ copy_m3_m4(viewmat, obedit->obmat);
+ mul_m3_m3m3(totmat, obmat, viewmat);
+ invert_m3_m3(imat, totmat);
ED_armature_deselectall(obedit, 0, 0);
@@ -2297,9 +2297,9 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
VECCOPY(bone->head, curs);
if (rv3d && (U.flag & USER_ADD_VIEWALIGNED))
- VecAddf(bone->tail, bone->head, imat[1]); // bone with unit length 1
+ add_v3_v3v3(bone->tail, bone->head, imat[1]); // bone with unit length 1
else
- VecAddf(bone->tail, bone->head, imat[2]); // bone with unit length 1, pointing up Z
+ add_v3_v3v3(bone->tail, bone->head, imat[2]); // bone with unit length 1, pointing up Z
}
@@ -2375,16 +2375,16 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *op)
curs= give_cursor(scene, v3d);
VECCOPY(newbone->tail, curs);
- VecSubf(newbone->tail, newbone->tail, obedit->obmat[3]);
+ sub_v3_v3v3(newbone->tail, newbone->tail, obedit->obmat[3]);
if (a==1)
newbone->tail[0]= -newbone->tail[0];
- Mat3CpyMat4(mat, obedit->obmat);
- Mat3Inv(imat, mat);
- Mat3MulVecfl(imat, newbone->tail);
+ copy_m3_m4(mat, obedit->obmat);
+ invert_m3_m3(imat, mat);
+ mul_m3_v3(imat, newbone->tail);
- newbone->length= VecLenf(newbone->head, newbone->tail);
+ newbone->length= len_v3v3(newbone->head, newbone->tail);
newbone->rad_tail= newbone->length*0.05f;
newbone->dist= newbone->length*0.25f;
@@ -2429,7 +2429,7 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e
if(mval[0]!=IS_CLIPPED) {
window_to_3d_delta(ar, dvec, mval[0]-mx, mval[1]-my);
- VecSubf(fp, fp, dvec);
+ sub_v3_v3v3(fp, fp, dvec);
}
else {
@@ -2885,7 +2885,7 @@ static void fill_add_joint (EditBone *ebo, short eb_tail, ListBase *points)
}
for (ebp= points->first; ebp; ebp= ebp->next) {
- if (VecEqual(ebp->vec, vec)) {
+ if (equals_v3v3(ebp->vec, vec)) {
if (eb_tail) {
if ((ebp->head_owner) && (ebp->head_owner->parent == ebo)) {
/* so this bone's tail owner is this bone */
@@ -2969,8 +2969,8 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op)
fp= give_cursor(scene, v3d);
VECCOPY (curs, fp);
- Mat4Invert(obedit->imat, obedit->obmat);
- Mat4MulVecfl(obedit->imat, curs);
+ invert_m4_m4(obedit->imat, obedit->obmat);
+ mul_m4_v3(obedit->imat, curs);
/* Create a bone */
newbone= add_points_bone(obedit, ebp->vec, curs);
@@ -3005,14 +3005,14 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op)
/* get cursor location */
VECCOPY(curs, fp);
- Mat4Invert(obedit->imat, obedit->obmat);
- Mat4MulVecfl(obedit->imat, curs);
+ invert_m4_m4(obedit->imat, obedit->obmat);
+ mul_m4_v3(obedit->imat, curs);
/* get distances */
- VecSubf(vecA, ebp->vec, curs);
- VecSubf(vecB, ebp2->vec, curs);
- distA= VecLength(vecA);
- distB= VecLength(vecB);
+ sub_v3_v3v3(vecA, ebp->vec, curs);
+ sub_v3_v3v3(vecB, ebp2->vec, curs);
+ distA= len_v3(vecA);
+ distB= len_v3(vecB);
/* compare distances - closer one therefore acts as direction for bone to go */
headtail= (distA < distB) ? 2 : 1;
@@ -3494,16 +3494,16 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
VECCOPY(curs, give_cursor(CTX_data_scene(C),CTX_wm_view3d(C)));
/* Get inverse point for head and orientation for tail */
- Mat4Invert(obedit->imat, obedit->obmat);
- Mat4MulVecfl(obedit->imat, curs);
+ invert_m4_m4(obedit->imat, obedit->obmat);
+ mul_m4_v3(obedit->imat, curs);
if (rv3d && (U.flag & USER_ADD_VIEWALIGNED))
- Mat3CpyMat4(obmat, rv3d->viewmat);
- else Mat3One(obmat);
+ copy_m3_m4(obmat, rv3d->viewmat);
+ else unit_m3(obmat);
- Mat3CpyMat4(viewmat, obedit->obmat);
- Mat3MulMat3(totmat, obmat, viewmat);
- Mat3Inv(imat, totmat);
+ copy_m3_m4(viewmat, obedit->obmat);
+ mul_m3_m3m3(totmat, obmat, viewmat);
+ invert_m3_m3(imat, totmat);
ED_armature_deselectall(obedit, 0, 0);
@@ -3513,9 +3513,9 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
VECCOPY(bone->head, curs);
if(rv3d && (U.flag & USER_ADD_VIEWALIGNED))
- VecAddf(bone->tail, bone->head, imat[1]); // bone with unit length 1
+ add_v3_v3v3(bone->tail, bone->head, imat[1]); // bone with unit length 1
else
- VecAddf(bone->tail, bone->head, imat[2]); // bone with unit length 1, pointing up Z
+ add_v3_v3v3(bone->tail, bone->head, imat[2]); // bone with unit length 1, pointing up Z
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, obedit);
@@ -3748,7 +3748,7 @@ static int armature_switch_direction_exec(bContext *C, wmOperator *op)
* - connected flag is only set if points are coincidental
*/
ebo->parent= child;
- if ((child) && VecEqual(ebo->head, child->tail))
+ if ((child) && equals_v3v3(ebo->head, child->tail))
ebo->flag |= BONE_CONNECTED;
else
ebo->flag &= ~BONE_CONNECTED;
@@ -3834,12 +3834,12 @@ static void bone_connect_to_new_parent(ListBase *edbo, EditBone *selbone, EditBo
if (mode == ARM_PAR_CONNECT) {
/* Connected: Child bones will be moved to the parent tip */
selbone->flag |= BONE_CONNECTED;
- VecSubf(offset, actbone->tail, selbone->head);
+ sub_v3_v3v3(offset, actbone->tail, selbone->head);
VECCOPY(selbone->head, actbone->tail);
selbone->rad_head= actbone->rad_tail;
- VecAddf(selbone->tail, selbone->tail, offset);
+ add_v3_v3v3(selbone->tail, selbone->tail, offset);
/* offset for all its children */
for (ebone = edbo->first; ebone; ebone=ebone->next) {
@@ -3847,8 +3847,8 @@ static void bone_connect_to_new_parent(ListBase *edbo, EditBone *selbone, EditBo
for (par= ebone->parent; par; par= par->parent) {
if (par==selbone) {
- VecAddf(ebone->head, ebone->head, offset);
- VecAddf(ebone->tail, ebone->tail, offset);
+ add_v3_v3v3(ebone->head, ebone->head, offset);
+ add_v3_v3v3(ebone->tail, ebone->tail, offset);
break;
}
}
@@ -4199,13 +4199,13 @@ static void fix_connected_bone(EditBone *ebone)
{
float diff[3];
- if (!(ebone->parent) || !(ebone->flag & BONE_CONNECTED) || VecEqual(ebone->parent->tail, ebone->head))
+ if (!(ebone->parent) || !(ebone->flag & BONE_CONNECTED) || equals_v3v3(ebone->parent->tail, ebone->head))
return;
/* if the parent has moved we translate child's head and tail accordingly*/
- VecSubf(diff, ebone->parent->tail, ebone->head);
- VecAddf(ebone->head, ebone->head, diff);
- VecAddf(ebone->tail, ebone->tail, diff);
+ sub_v3_v3v3(diff, ebone->parent->tail, ebone->head);
+ add_v3_v3v3(ebone->head, ebone->head, diff);
+ add_v3_v3v3(ebone->tail, ebone->tail, diff);
return;
}
@@ -4227,14 +4227,14 @@ static void bone_align_to_bone(ListBase *edbo, EditBone *selbone, EditBone *actb
{
float selboneaxis[3], actboneaxis[3], length;
- VecSubf(actboneaxis, actbone->tail, actbone->head);
- Normalize(actboneaxis);
+ sub_v3_v3v3(actboneaxis, actbone->tail, actbone->head);
+ normalize_v3(actboneaxis);
- VecSubf(selboneaxis, selbone->tail, selbone->head);
- length = VecLength(selboneaxis);
+ sub_v3_v3v3(selboneaxis, selbone->tail, selbone->head);
+ length = len_v3(selboneaxis);
- VecMulf(actboneaxis, length);
- VecAddf(selbone->tail, selbone->head, actboneaxis);
+ mul_v3_fl(actboneaxis, length);
+ add_v3_v3v3(selbone->tail, selbone->head, actboneaxis);
selbone->roll = actbone->roll;
/* if the bone being aligned has connected descendants they must be moved
@@ -4720,10 +4720,10 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
/* compute root and tip */
if (bbone) {
VECCOPY(root[j], bbone[segments].mat[3]);
- Mat4MulVecfl(bone->arm_mat, root[j]);
+ mul_m4_v3(bone->arm_mat, root[j]);
if ((segments+1) < bone->segments) {
VECCOPY(tip[j], bbone[segments+1].mat[3])
- Mat4MulVecfl(bone->arm_mat, tip[j]);
+ mul_m4_v3(bone->arm_mat, tip[j]);
}
else
VECCOPY(tip[j], bone->arm_tail)
@@ -4733,8 +4733,8 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
VECCOPY(tip[j], bone->arm_tail);
}
- Mat4MulVecfl(par->obmat, root[j]);
- Mat4MulVecfl(par->obmat, tip[j]);
+ mul_m4_v3(par->obmat, root[j]);
+ mul_m4_v3(par->obmat, tip[j]);
/* set selected */
if (wpmode) {
@@ -4788,7 +4788,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
for (i=0; i < mesh->totvert; i++) {
if (!vertsfilled)
VECCOPY(verts[i], mesh->mvert[i].co)
- Mat4MulVecfl(ob->obmat, verts[i]);
+ mul_m4_v3(ob->obmat, verts[i]);
}
/* compute the weights based on gathered vertices and bones */
@@ -4798,7 +4798,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
}
else {
envelope_bone_weighting(ob, mesh, verts, numbones, bonelist, dgrouplist,
- dgroupflip, root, tip, selected, Mat4ToScalef(par->obmat));
+ dgroupflip, root, tip, selected, mat4_to_scale(par->obmat));
}
/* free the memory allocated */
@@ -4969,10 +4969,10 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
if (pchan->rotmode == ROT_MODE_QUAT) {
QUATCOPY(quat1, pchan->quat);
- QuatToEul(pchan->quat, oldeul);
+ quat_to_eul( oldeul,pchan->quat);
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
- AxisAngleToEulO(pchan->rotAxis, pchan->rotAngle, oldeul, EULER_ORDER_DEFAULT);
+ axis_angle_to_eulO( oldeul, EULER_ORDER_DEFAULT,pchan->rotAxis, pchan->rotAngle);
}
else {
VECCOPY(oldeul, pchan->eul);
@@ -4988,14 +4988,14 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
eul[2]= oldeul[2];
if (pchan->rotmode == ROT_MODE_QUAT) {
- EulToQuat(eul, pchan->quat);
+ eul_to_quat( pchan->quat,eul);
/* quaternions flip w sign to accumulate rotations correctly */
if ((quat1[0]<0.0f && pchan->quat[0]>0.0f) || (quat1[0]>0.0f && pchan->quat[0]<0.0f)) {
- QuatMulf(pchan->quat, -1.0f);
+ mul_qt_fl(pchan->quat, -1.0f);
}
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
- EulOToAxisAngle(eul, EULER_ORDER_DEFAULT, pchan->rotAxis, &pchan->rotAngle);
+ eulO_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,eul, EULER_ORDER_DEFAULT);
}
else {
VECCOPY(pchan->eul, eul);
@@ -5618,13 +5618,13 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode
current = iter->p;
- VecSubf(vec1, previous, parent->head);
- VecSubf(vec2, current, previous);
+ sub_v3_v3v3(vec1, previous, parent->head);
+ sub_v3_v3v3(vec2, current, previous);
- len1 = Normalize(vec1);
- len2 = Normalize(vec2);
+ len1 = normalize_v3(vec1);
+ len2 = normalize_v3(vec2);
- if (len1 > 0.0f && len2 > 0.0f && Inpf(vec1, vec2) < angleLimit)
+ if (len1 > 0.0f && len2 > 0.0f && dot_v3v3(vec1, vec2) < angleLimit)
{
VECCOPY(parent->tail, previous);
@@ -5685,18 +5685,18 @@ float arcLengthRatio(ReebArc *arc)
float embedLength = 0.0f;
int i;
- arcLength = VecLenf(arc->head->p, arc->tail->p);
+ arcLength = len_v3v3(arc->head->p, arc->tail->p);
if (arc->bcount > 0)
{
/* Add the embedding */
for ( i = 1; i < arc->bcount; i++)
{
- embedLength += VecLenf(arc->buckets[i - 1].p, arc->buckets[i].p);
+ embedLength += len_v3v3(arc->buckets[i - 1].p, arc->buckets[i].p);
}
/* Add head and tail -> embedding vectors */
- embedLength += VecLenf(arc->head->p, arc->buckets[0].p);
- embedLength += VecLenf(arc->tail->p, arc->buckets[arc->bcount - 1].p);
+ embedLength += len_v3v3(arc->head->p, arc->buckets[0].p);
+ embedLength += len_v3v3(arc->tail->p, arc->buckets[arc->bcount - 1].p);
}
else
{
@@ -5756,8 +5756,8 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
/* Copy orientation from source */
VECCOPY(dst->loc, src->obmat[3]);
- Mat4ToEul(src->obmat, dst->rot);
- Mat4ToSize(src->obmat, dst->size);
+ mat4_to_eul( dst->rot,src->obmat);
+ mat4_to_size( dst->size,src->obmat);
where_is_object(scene, obedit);
diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c
index d327ed34839..124528811c7 100644
--- a/source/blender/editors/armature/editarmature_generate.c
+++ b/source/blender/editors/armature/editarmature_generate.c
@@ -39,7 +39,7 @@
#include "DNA_armature_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_graph.h"
#include "BKE_utildefines.h"
@@ -52,18 +52,18 @@
void setBoneRollFromNormal(EditBone *bone, float *no, float invmat[][4], float tmat[][3])
{
- if (no != NULL && !VecIsNull(no))
+ if (no != NULL && !is_zero_v3(no))
{
float tangent[3], vec[3], normal[3];
VECCOPY(normal, no);
- Mat3MulVecfl(tmat, normal);
+ mul_m3_v3(tmat, normal);
- VecSubf(tangent, bone->tail, bone->head);
- Projf(vec, tangent, normal);
- VecSubf(normal, normal, vec);
+ sub_v3_v3v3(tangent, bone->tail, bone->head);
+ project_v3_v3v3(vec, tangent, normal);
+ sub_v3_v3v3(normal, normal, vec);
- Normalize(normal);
+ normalize_v3(normal);
bone->roll = ED_rollBoneToVector(bone, normal);
}
@@ -86,11 +86,11 @@ float calcArcCorrelation(BArcIterator *iter, int start, int end, float v0[3], fl
float v[3];
IT_peek(iter, i);
- VecSubf(v, iter->p, v0);
- avg_t += Inpf(v, n);
+ sub_v3_v3v3(v, iter->p, v0);
+ avg_t += dot_v3v3(v, n);
}
- avg_t /= Inpf(n, n);
+ avg_t /= dot_v3v3(n, n);
avg_t += 1.0f; /* adding start (0) and end (1) values */
avg_t /= len;
@@ -101,14 +101,14 @@ float calcArcCorrelation(BArcIterator *iter, int start, int end, float v0[3], fl
float dt;
IT_peek(iter, i);
- VecSubf(v, iter->p, v0);
- Projf(d, v, n);
- VecSubf(v, v, d);
+ sub_v3_v3v3(v, iter->p, v0);
+ project_v3_v3v3(d, v, n);
+ sub_v3_v3v3(v, v, d);
- dt = VecLength(d) - avg_t;
+ dt = len_v3(d) - avg_t;
s_t += dt * dt;
- s_xyz += Inpf(v, v);
+ s_xyz += dot_v3v3(v, v);
}
/* adding start(0) and end(1) values to s_t */
@@ -143,7 +143,7 @@ int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int sta
IT_peek(iter, i);
v2 = iter->p;
- stroke_length += VecLenf(v1, v2);
+ stroke_length += len_v3v3(v1, v2);
v1 = v2;
}
@@ -165,7 +165,7 @@ int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int sta
IT_peek(iter, i);
v2 = iter->p;
- current_length += VecLenf(v1, v2);
+ current_length += len_v3v3(v1, v2);
if (current_length >= length_threshold)
{
@@ -194,7 +194,7 @@ int nextAdaptativeSubdivision(ToolSettings *toolsettings, BArcIterator *iter, in
{
/* Calculate normal */
IT_peek(iter, i);
- VecSubf(n, iter->p, head);
+ sub_v3_v3v3(n, iter->p, head);
if (calcArcCorrelation(iter, start, i, start_p, n) < correlation_threshold)
{
@@ -226,7 +226,7 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
vec1 = iter->p;
/* If lengthLimit hits the current segment */
- if (VecLenf(vec1, head) > lengthLimit)
+ if (len_v3v3(vec1, head) > lengthLimit)
{
if (same == 0)
{
@@ -234,13 +234,13 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
float a, b, c, f;
/* Solve quadratic distance equation */
- VecSubf(dv, vec1, vec0);
- a = Inpf(dv, dv);
+ sub_v3_v3v3(dv, vec1, vec0);
+ a = dot_v3v3(dv, dv);
- VecSubf(off, vec0, head);
- b = 2 * Inpf(dv, off);
+ sub_v3_v3v3(off, vec0, head);
+ b = 2 * dot_v3v3(dv, off);
- c = Inpf(off, off) - (lengthLimit * lengthLimit);
+ c = dot_v3v3(off, off) - (lengthLimit * lengthLimit);
f = (-b + (float)sqrt(b * b - 4 * a * c)) / (2 * a);
@@ -249,8 +249,8 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
if (isnan(f) == 0 && f < 1.0f)
{
VECCOPY(p, dv);
- VecMulf(p, f);
- VecAddf(p, p, vec0);
+ mul_v3_fl(p, f);
+ add_v3_v3v3(p, p, vec0);
}
else
{
@@ -261,12 +261,12 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
{
float dv[3];
- VecSubf(dv, vec1, vec0);
- Normalize(dv);
+ sub_v3_v3v3(dv, vec1, vec0);
+ normalize_v3(dv);
VECCOPY(p, dv);
- VecMulf(p, lengthLimit);
- VecAddf(p, p, head);
+ mul_v3_fl(p, lengthLimit);
+ add_v3_v3v3(p, p, head);
}
return i - 1; /* restart at lower bound */
@@ -321,8 +321,8 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *
}
/* going to next bone, fix parent */
- Mat4MulVecfl(invmat, parent->tail);
- Mat4MulVecfl(invmat, parent->head);
+ mul_m4_v3(invmat, parent->tail);
+ mul_m4_v3(invmat, parent->head);
setBoneRollFromNormal(parent, normal, invmat, tmat);
parent = child; // new child is next parent
@@ -342,8 +342,8 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *
}
/* fix last bone */
- Mat4MulVecfl(invmat, parent->tail);
- Mat4MulVecfl(invmat, parent->head);
+ mul_m4_v3(invmat, parent->tail);
+ mul_m4_v3(invmat, parent->head);
setBoneRollFromNormal(parent, iter->no, invmat, tmat);
lastBone = parent;
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index 824e7be94d9..946b7398773 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -48,7 +48,7 @@
#include "DNA_view3d_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_ghash.h"
#include "BLI_graph.h"
@@ -162,7 +162,7 @@ void getEditBoneRollUpAxis(EditBone *bone, float roll, float up_axis[3])
{
float mat[3][3], nor[3];
- VecSubf(nor, bone->tail, bone->head);
+ sub_v3_v3v3(nor, bone->tail, bone->head);
vec_roll_to_mat3(nor, roll, mat);
VECCOPY(up_axis, mat[2]);
@@ -173,35 +173,35 @@ float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float qrot[4],
float nor[3], new_up_axis[3], x_axis[3], z_axis[3];
VECCOPY(new_up_axis, old_up_axis);
- QuatMulVecf(qrot, new_up_axis);
+ mul_qt_v3(qrot, new_up_axis);
- VecSubf(nor, bone->tail, bone->head);
+ sub_v3_v3v3(nor, bone->tail, bone->head);
- Crossf(x_axis, nor, aligned_axis);
- Crossf(z_axis, x_axis, nor);
+ cross_v3_v3v3(x_axis, nor, aligned_axis);
+ cross_v3_v3v3(z_axis, x_axis, nor);
- Normalize(new_up_axis);
- Normalize(x_axis);
- Normalize(z_axis);
+ normalize_v3(new_up_axis);
+ normalize_v3(x_axis);
+ normalize_v3(z_axis);
- if (Inpf(new_up_axis, x_axis) < 0)
+ if (dot_v3v3(new_up_axis, x_axis) < 0)
{
- VecMulf(x_axis, -1);
+ mul_v3_fl(x_axis, -1);
}
- if (Inpf(new_up_axis, z_axis) < 0)
+ if (dot_v3v3(new_up_axis, z_axis) < 0)
{
- VecMulf(z_axis, -1);
+ mul_v3_fl(z_axis, -1);
}
- if (NormalizedVecAngle2(x_axis, new_up_axis) < NormalizedVecAngle2(z_axis, new_up_axis))
+ if (angle_normalized_v3v3(x_axis, new_up_axis) < angle_normalized_v3v3(z_axis, new_up_axis))
{
- RotationBetweenVectorsToQuat(qroll, new_up_axis, x_axis); /* set roll rotation quat */
+ rotation_between_vecs_to_quat(qroll, new_up_axis, x_axis); /* set roll rotation quat */
return ED_rollBoneToVector(bone, x_axis);
}
else
{
- RotationBetweenVectorsToQuat(qroll, new_up_axis, z_axis); /* set roll rotation quat */
+ rotation_between_vecs_to_quat(qroll, new_up_axis, z_axis); /* set roll rotation quat */
return ED_rollBoneToVector(bone, z_axis);
}
}
@@ -220,11 +220,11 @@ float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float
if (previous->bone)
{
- VecSubf(vec_first, previous->bone->tail, previous->bone->head);
+ sub_v3_v3v3(vec_first, previous->bone->tail, previous->bone->head);
}
else if (previous->prev->bone)
{
- VecSubf(vec_first, edge->bone->head, previous->prev->bone->tail);
+ sub_v3_v3v3(vec_first, edge->bone->head, previous->prev->bone->tail);
}
else
{
@@ -232,25 +232,25 @@ float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float
return rollBoneByQuatAligned(edge->bone, edge->up_axis, qrot, qroll, up_axis);
}
- VecSubf(vec_second, edge->bone->tail, edge->bone->head);
+ sub_v3_v3v3(vec_second, edge->bone->tail, edge->bone->head);
- Normalize(vec_first);
- Normalize(vec_second);
+ normalize_v3(vec_first);
+ normalize_v3(vec_second);
- Crossf(normal, vec_first, vec_second);
- Normalize(normal);
+ cross_v3_v3v3(normal, vec_first, vec_second);
+ normalize_v3(normal);
- AxisAngleToQuat(qroll, vec_second, edge->up_angle);
+ axis_angle_to_quat(qroll, vec_second, edge->up_angle);
- QuatMulVecf(qroll, normal);
+ mul_qt_v3(qroll, normal);
VECCOPY(new_up_axis, edge->up_axis);
- QuatMulVecf(qrot, new_up_axis);
+ mul_qt_v3(qrot, new_up_axis);
- Normalize(new_up_axis);
+ normalize_v3(new_up_axis);
/* real qroll between normal and up_axis */
- RotationBetweenVectorsToQuat(qroll, new_up_axis, normal);
+ rotation_between_vecs_to_quat(qroll, new_up_axis, normal);
return ED_rollBoneToVector(edge->bone, normal);
}
@@ -261,9 +261,9 @@ float rollBoneByQuat(EditBone *bone, float old_up_axis[3], float qrot[4])
float new_up_axis[3];
VECCOPY(new_up_axis, old_up_axis);
- QuatMulVecf(qrot, new_up_axis);
+ mul_qt_v3(qrot, new_up_axis);
- Normalize(new_up_axis);
+ normalize_v3(new_up_axis);
return ED_rollBoneToVector(bone, new_up_axis);
}
@@ -431,7 +431,7 @@ static void RIG_appendEdgeToArc(RigArc *arc, RigEdge *edge)
RIG_calculateEdgeAngles(last_edge, edge);
}
- edge->length = VecLenf(edge->head, edge->tail);
+ edge->length = len_v3v3(edge->head, edge->tail);
arc->length += edge->length;
@@ -675,22 +675,22 @@ static void RIG_calculateEdgeAngles(RigEdge *edge_first, RigEdge *edge_second)
{
float vec_first[3], vec_second[3];
- VecSubf(vec_first, edge_first->tail, edge_first->head);
- VecSubf(vec_second, edge_second->tail, edge_second->head);
+ sub_v3_v3v3(vec_first, edge_first->tail, edge_first->head);
+ sub_v3_v3v3(vec_second, edge_second->tail, edge_second->head);
- Normalize(vec_first);
- Normalize(vec_second);
+ normalize_v3(vec_first);
+ normalize_v3(vec_second);
- edge_first->angle = NormalizedVecAngle2(vec_first, vec_second);
+ edge_first->angle = angle_normalized_v3v3(vec_first, vec_second);
if (edge_second->bone != NULL)
{
float normal[3];
- Crossf(normal, vec_first, vec_second);
- Normalize(normal);
+ cross_v3_v3v3(normal, vec_first, vec_second);
+ normalize_v3(normal);
- edge_second->up_angle = NormalizedVecAngle2(normal, edge_second->up_axis);
+ edge_second->up_angle = angle_normalized_v3v3(normal, edge_second->up_axis);
}
}
@@ -715,27 +715,27 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link)
float offset[3];
int flag = 0;
- VecSubf(offset, ctrl->bone->head, link->head);
+ sub_v3_v3v3(offset, ctrl->bone->head, link->head);
/* if root matches, check for direction too */
- if (Inpf(offset, offset) < 0.0001)
+ if (dot_v3v3(offset, offset) < 0.0001)
{
float vbone[3], vparent[3];
flag |= RIG_CTRL_FIT_ROOT;
- VecSubf(vbone, ctrl->bone->tail, ctrl->bone->head);
- VecSubf(vparent, link->tail, link->head);
+ sub_v3_v3v3(vbone, ctrl->bone->tail, ctrl->bone->head);
+ sub_v3_v3v3(vparent, link->tail, link->head);
/* test for opposite direction */
- if (Inpf(vbone, vparent) > 0)
+ if (dot_v3v3(vbone, vparent) > 0)
{
float nor[3];
float len;
- Crossf(nor, vbone, vparent);
+ cross_v3_v3v3(nor, vbone, vparent);
- len = Inpf(nor, nor);
+ len = dot_v3v3(nor, nor);
if (len < 0.0001)
{
flag |= RIG_CTRL_FIT_BONE;
@@ -869,8 +869,8 @@ static void RIG_reconnectControlBones(RigGraph *rg)
{
int fit = 0;
- fit = VecLenf(ctrl->bone->head, edge->bone->head) < 0.0001;
- fit = fit || VecLenf(ctrl->bone->tail, edge->bone->tail) < 0.0001;
+ fit = len_v3v3(ctrl->bone->head, edge->bone->head) < 0.0001;
+ fit = fit || len_v3v3(ctrl->bone->tail, edge->bone->tail) < 0.0001;
if (fit)
{
@@ -1026,13 +1026,13 @@ static void RIG_reconnectControlBones(RigGraph *rg)
/* don't link with parent */
if (bone->parent != ctrl->bone)
{
- if (VecLenf(ctrl->bone->tail, bone->head) < 0.01)
+ if (len_v3v3(ctrl->bone->tail, bone->head) < 0.01)
{
ctrl->tail_mode = TL_HEAD;
ctrl->link_tail = bone;
break;
}
- else if (VecLenf(ctrl->bone->tail, bone->tail) < 0.01)
+ else if (len_v3v3(ctrl->bone->tail, bone->tail) < 0.01)
{
ctrl->tail_mode = TL_TAIL;
ctrl->link_tail = bone;
@@ -1132,7 +1132,7 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
if (first_edge->bone == NULL)
{
- if (first_edge->bone == NULL && VecLenf(first_edge->tail, arc->head->p) <= 0.001)
+ if (first_edge->bone == NULL && len_v3v3(first_edge->tail, arc->head->p) <= 0.001)
{
BLI_remlink(&arc->edges, first_edge);
MEM_freeN(first_edge);
@@ -1262,7 +1262,7 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
if (last_edge->bone == NULL)
{
- if (VecLenf(last_edge->head, arc->tail->p) <= 0.001)
+ if (len_v3v3(last_edge->head, arc->tail->p) <= 0.001)
{
BLI_remlink(&arc->edges, last_edge);
MEM_freeN(last_edge);
@@ -1438,7 +1438,7 @@ void RIG_printNode(RigNode *node, char name[])
else if (node->symmetry_flag & SYM_RADIAL)
printf("Symmetry RADIAL\n");
- printvecf("symmetry axis", node->symmetry_axis);
+ print_v3("symmetry axis", node->symmetry_axis);
}
}
@@ -1464,7 +1464,7 @@ void RIG_printCtrl(RigControl *ctrl, char *indent)
printf("%sLink: %s\n", indent, ctrl->link ? ctrl->link->name : "!NONE!");
sprintf(text, "%soffset", indent);
- printvecf(text, ctrl->offset);
+ print_v3(text, ctrl->offset);
printf("%sFlag: %i\n", indent, ctrl->flag);
}
@@ -1761,15 +1761,15 @@ static void finalizeControl(RigGraph *rigg, RigControl *ctrl, float resize)
tail_vec = ctrl->link_tail->head;
}
- VecSubf(v1, ctrl->bone->tail, ctrl->bone->head);
- VecSubf(v2, tail_vec, ctrl->bone->head);
+ sub_v3_v3v3(v1, ctrl->bone->tail, ctrl->bone->head);
+ sub_v3_v3v3(v2, tail_vec, ctrl->bone->head);
VECCOPY(ctrl->bone->tail, tail_vec);
- RotationBetweenVectorsToQuat(qtail, v1, v2);
- QuatMul(ctrl->qrot, qtail, ctrl->qrot);
+ rotation_between_vecs_to_quat(qtail, v1, v2);
+ mul_qt_qtqt(ctrl->qrot, qtail, ctrl->qrot);
- resize = VecLength(v2) / VecLenf(ctrl->head, ctrl->tail);
+ resize = len_v3(v2) / len_v3v3(ctrl->head, ctrl->tail);
}
ctrl->bone->roll = rollBoneByQuat(ctrl->bone, ctrl->up_axis, ctrl->qrot);
@@ -1801,10 +1801,10 @@ static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], f
float parent_offset[3], tail_offset[3];
VECCOPY(parent_offset, ctrl->offset);
- VecMulf(parent_offset, resize);
- QuatMulVecf(qrot, parent_offset);
+ mul_v3_fl(parent_offset, resize);
+ mul_qt_v3(qrot, parent_offset);
- VecAddf(ctrl->bone->head, head, parent_offset);
+ add_v3_v3v3(ctrl->bone->head, head, parent_offset);
ctrl->flag |= RIG_CTRL_HEAD_DONE;
@@ -1812,11 +1812,11 @@ static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], f
if (ctrl->tail_mode == TL_NONE)
{
- VecSubf(tail_offset, ctrl->tail, ctrl->head);
- VecMulf(tail_offset, resize);
- QuatMulVecf(qrot, tail_offset);
+ sub_v3_v3v3(tail_offset, ctrl->tail, ctrl->head);
+ mul_v3_fl(tail_offset, resize);
+ mul_qt_v3(qrot, tail_offset);
- VecAddf(ctrl->bone->tail, ctrl->bone->head, tail_offset);
+ add_v3_v3v3(ctrl->bone->tail, ctrl->bone->head, tail_offset);
ctrl->flag |= RIG_CTRL_TAIL_DONE;
}
@@ -1835,20 +1835,20 @@ static void repositionBone(bContext *C, RigGraph *rigg, RigEdge *edge, float vec
bone = edge->bone;
- VecSubf(v1, edge->tail, edge->head);
- VecSubf(v2, vec1, vec0);
+ sub_v3_v3v3(v1, edge->tail, edge->head);
+ sub_v3_v3v3(v2, vec1, vec0);
- l1 = Normalize(v1);
- l2 = Normalize(v2);
+ l1 = normalize_v3(v1);
+ l2 = normalize_v3(v2);
resize = l2 / l1;
- RotationBetweenVectorsToQuat(qrot, v1, v2);
+ rotation_between_vecs_to_quat(qrot, v1, v2);
VECCOPY(bone->head, vec0);
VECCOPY(bone->tail, vec1);
- if (!VecIsNull(up_axis))
+ if (!is_zero_v3(up_axis))
{
float qroll[4];
@@ -1862,10 +1862,10 @@ static void repositionBone(bContext *C, RigGraph *rigg, RigEdge *edge, float vec
}
else
{
- QuatOne(qroll);
+ unit_qt(qroll);
}
- QuatMul(qrot, qroll, qrot);
+ mul_qt_qtqt(qrot, qroll, qrot);
}
else
{
@@ -1979,9 +1979,9 @@ static float costDistance(BArcIterator *iter, float *vec0, float *vec1, int i0,
if (distance_weight > 0)
{
- VecSubf(v1, vec0, vec1);
+ sub_v3_v3v3(v1, vec0, vec1);
- v1_inpf = Inpf(v1, v1);
+ v1_inpf = dot_v3v3(v1, v1);
if (v1_inpf > 0)
{
@@ -1992,11 +1992,11 @@ static float costDistance(BArcIterator *iter, float *vec0, float *vec1, int i0,
bucket = IT_peek(iter, j);
- VecSubf(v2, bucket->p, vec1);
+ sub_v3_v3v3(v2, bucket->p, vec1);
- Crossf(c, v1, v2);
+ cross_v3_v3v3(c, v1, v2);
- dist = Inpf(c, c) / v1_inpf;
+ dist = dot_v3v3(c, c) / v1_inpf;
max_dist = dist > max_dist ? dist : max_dist;
}
@@ -2020,9 +2020,9 @@ static float costAngle(float original_angle, float vec_first[3], float vec_secon
{
float current_angle;
- if (!VecIsNull(vec_first) && !VecIsNull(vec_second))
+ if (!is_zero_v3(vec_first) && !is_zero_v3(vec_second))
{
- current_angle = saacos(Inpf(vec_first, vec_second));
+ current_angle = saacos(dot_v3v3(vec_first, vec_second));
return angle_weight * fabs(current_angle - original_angle);
}
@@ -2056,8 +2056,8 @@ static float calcCostLengthDistance(BArcIterator *iter, float **vec_cache, RigEd
float vec[3];
float length;
- VecSubf(vec, vec2, vec1);
- length = Normalize(vec);
+ sub_v3_v3v3(vec, vec2, vec1);
+ length = normalize_v3(vec);
return costLength(edge->length, length) + costDistance(iter, vec1, vec2, i1, i2);
}
@@ -2069,15 +2069,15 @@ static float calcCostAngleLengthDistance(BArcIterator *iter, float **vec_cache,
float length2;
float new_cost = 0;
- VecSubf(vec_second, vec2, vec1);
- length2 = Normalize(vec_second);
+ sub_v3_v3v3(vec_second, vec2, vec1);
+ length2 = normalize_v3(vec_second);
/* Angle cost */
if (edge->prev)
{
- VecSubf(vec_first, vec1, vec0);
- Normalize(vec_first);
+ sub_v3_v3v3(vec_first, vec1, vec0);
+ normalize_v3(vec_first);
new_cost += costAngle(edge->prev->angle, vec_first, vec_second, angle_weight);
}
@@ -2352,13 +2352,13 @@ static void retargetArctoArcLength(bContext *C, RigGraph *rigg, RigArc *iarc, Ri
{
vec1 = bucket->p;
- embedding_length += VecLenf(vec0, vec1);
+ embedding_length += len_v3v3(vec0, vec1);
vec0 = vec1;
bucket = IT_next(iter);
}
- embedding_length += VecLenf(node_end->p, vec1);
+ embedding_length += len_v3v3(node_end->p, vec1);
/* fit bones */
initArcIterator(iter, earc, node_start);
@@ -2377,7 +2377,7 @@ static void retargetArctoArcLength(bContext *C, RigGraph *rigg, RigArc *iarc, Ri
while (bucket && new_bone_length > length)
{
- length += VecLenf(previous_vec, vec1);
+ length += len_v3v3(previous_vec, vec1);
bucket = IT_next(iter);
previous_vec = vec1;
vec1 = bucket->p;
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index b3dd8f35137..7bb2fa9009d 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -39,7 +39,7 @@
#include "RNA_access.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_graph.h"
#include "BLI_ghash.h"
@@ -416,10 +416,10 @@ ReebNode *sk_pointToNode(SK_Point *pt, float imat[][4], float tmat[][3])
node = MEM_callocN(sizeof(ReebNode), "reeb node");
VECCOPY(node->p, pt->p);
- Mat4MulVecfl(imat, node->p);
+ mul_m4_v3(imat, node->p);
VECCOPY(node->no, pt->no);
- Mat3MulVecfl(tmat, node->no);
+ mul_m3_v3(tmat, node->no);
return node;
}
@@ -439,10 +439,10 @@ ReebArc *sk_strokeToArc(SK_Stroke *stk, float imat[][4], float tmat[][3])
for (i = 0; i < arc->bcount; i++)
{
VECCOPY(arc->buckets[i].p, stk->points[i + 1].p);
- Mat4MulVecfl(imat, arc->buckets[i].p);
+ mul_m4_v3(imat, arc->buckets[i].p);
VECCOPY(arc->buckets[i].no, stk->points[i + 1].no);
- Mat3MulVecfl(tmat, arc->buckets[i].no);
+ mul_m3_v3(tmat, arc->buckets[i].no);
}
return arc;
@@ -457,10 +457,10 @@ void sk_retargetStroke(bContext *C, SK_Stroke *stk)
ReebArc *arc;
RigGraph *rg;
- Mat4Invert(imat, obedit->obmat);
+ invert_m4_m4(imat, obedit->obmat);
- Mat3CpyMat4(tmat, obedit->obmat);
- Mat3Transp(tmat);
+ copy_m3_m4(tmat, obedit->obmat);
+ transpose_m3(tmat);
arc = sk_strokeToArc(stk, imat, tmat);
@@ -505,16 +505,16 @@ void sk_drawEdge(GLUquadric *quad, SK_Point *pt0, SK_Point *pt1, float size)
float vec1[3], vec2[3] = {0, 0, 1}, axis[3];
float angle, length;
- VecSubf(vec1, pt1->p, pt0->p);
- length = Normalize(vec1);
- Crossf(axis, vec2, vec1);
+ sub_v3_v3v3(vec1, pt1->p, pt0->p);
+ length = normalize_v3(vec1);
+ cross_v3_v3v3(axis, vec2, vec1);
- if (VecIsNull(axis))
+ if (is_zero_v3(axis))
{
axis[1] = 1;
}
- angle = NormalizedVecAngle2(vec2, vec1);
+ angle = angle_normalized_v3v3(vec2, vec1);
glRotatef(angle * 180 / M_PI + 180, axis[0], axis[1], axis[2]);
@@ -528,14 +528,14 @@ void sk_drawNormal(GLUquadric *quad, SK_Point *pt, float size, float height)
glPushMatrix();
- Crossf(axis, vec2, pt->no);
+ cross_v3_v3v3(axis, vec2, pt->no);
- if (VecIsNull(axis))
+ if (is_zero_v3(axis))
{
axis[1] = 1;
}
- angle = NormalizedVecAngle2(vec2, pt->no);
+ angle = angle_normalized_v3v3(vec2, pt->no);
glRotatef(angle * 180 / M_PI, axis[0], axis[1], axis[2]);
@@ -576,8 +576,8 @@ void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int end)
float d_rgb[3] = {1, 1, 1};
VECCOPY(rgb, color);
- VecSubf(d_rgb, d_rgb, rgb);
- VecMulf(d_rgb, 1.0f / (float)stk->nb_points);
+ sub_v3_v3v3(d_rgb, d_rgb, rgb);
+ mul_v3_fl(d_rgb, 1.0f / (float)stk->nb_points);
for (i = 0; i < stk->nb_points; i++)
{
@@ -614,7 +614,7 @@ void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int end)
glPopMatrix();
- VecAddf(rgb, rgb, d_rgb);
+ add_v3_v3v3(rgb, rgb, d_rgb);
}
}
@@ -756,7 +756,7 @@ SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones, short
if ((bone->flag & BONE_CONNECTED) == 0)
{
VECCOPY(vec, bone->head);
- Mat4MulVecfl(ob->obmat, vec);
+ mul_m4_v3(ob->obmat, vec);
project_short_noclip(ar, vec, pval);
pdist = ABS(pval[0] - mval[0]) + ABS(pval[1] - mval[1]);
@@ -772,7 +772,7 @@ SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones, short
VECCOPY(vec, bone->tail);
- Mat4MulVecfl(ob->obmat, vec);
+ mul_m4_v3(ob->obmat, vec);
project_short_noclip(ar, vec, pval);
pdist = ABS(pval[0] - mval[0]) + ABS(pval[1] - mval[1]);
@@ -977,13 +977,13 @@ float sk_distanceDepth(bContext *C, float p1[3], float p2[3])
float vec[3];
float distance;
- VecSubf(vec, p1, p2);
+ sub_v3_v3v3(vec, p1, p2);
- Projf(vec, vec, rv3d->viewinv[2]);
+ project_v3_v3v3(vec, vec, rv3d->viewinv[2]);
- distance = VecLength(vec);
+ distance = len_v3(vec);
- if (Inpf(rv3d->viewinv[2], vec) > 0)
+ if (dot_v3v3(rv3d->viewinv[2], vec) > 0)
{
distance *= -1;
}
@@ -1000,19 +1000,19 @@ void sk_interpolateDepth(bContext *C, SK_Stroke *stk, int start, int end, float
float progress = 0;
int i;
- progress = VecLenf(stk->points[start].p, stk->points[start - 1].p);
+ progress = len_v3v3(stk->points[start].p, stk->points[start - 1].p);
for (i = start; i <= end; i++)
{
float ray_start[3], ray_normal[3];
- float delta = VecLenf(stk->points[i].p, stk->points[i + 1].p);
+ float delta = len_v3v3(stk->points[i].p, stk->points[i + 1].p);
float pval[2];
project_float(ar, stk->points[i].p, pval);
viewray(ar, v3d, pval, ray_start, ray_normal);
- VecMulf(ray_normal, distance * progress / length);
- VecAddf(stk->points[i].p, stk->points[i].p, ray_normal);
+ mul_v3_fl(ray_normal, distance * progress / length);
+ add_v3_v3v3(stk->points[i].p, stk->points[i].p, ray_normal);
progress += delta ;
}
@@ -1037,7 +1037,7 @@ void sk_projectDrawPoint(bContext *C, float vec[3], SK_Stroke *stk, SK_DrawData
/* method taken from editview.c - mouse_cursor() */
project_short_noclip(ar, fp, cval);
window_to_3d_delta(ar, dvec, cval[0] - dd->mval[0], cval[1] - dd->mval[1]);
- VecSubf(vec, fp, dvec);
+ sub_v3_v3v3(vec, fp, dvec);
}
int sk_getStrokeDrawPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd)
@@ -1132,9 +1132,9 @@ int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Strok
{
p2->flag = 1;
- VecAddf(vec, p1->p, p2->p);
- VecMulf(vec, 0.5f);
- new_size = VecLenf(p1->p, p2->p);
+ add_v3_v3v3(vec, p1->p, p2->p);
+ mul_v3_fl(vec, 0.5f);
+ new_size = len_v3v3(p1->p, p2->p);
}
else
{
@@ -1149,7 +1149,7 @@ int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Strok
break;
}
- new_dist = VecLenf(last_p, vec);
+ new_dist = len_v3v3(last_p, vec);
if (new_dist < dist)
{
@@ -1248,7 +1248,7 @@ int sk_addStrokeSnapPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_Dra
length = 0;
for (i = stk->nb_points - 2; i > 0; i--)
{
- length += VecLenf(stk->points[i].p, stk->points[i + 1].p);
+ length += len_v3v3(stk->points[i].p, stk->points[i + 1].p);
total++;
if (stk->points[i].mode == PT_SNAP || stk->points[i].type == PT_EXACT)
{
@@ -1494,10 +1494,10 @@ void sk_convertStroke(bContext *C, SK_Stroke *stk)
head = NULL;
- Mat4Invert(invmat, obedit->obmat);
+ invert_m4_m4(invmat, obedit->obmat);
- Mat3CpyMat4(tmat, obedit->obmat);
- Mat3Transp(tmat);
+ copy_m3_m4(tmat, obedit->obmat);
+ transpose_m3(tmat);
for (i = 0; i < stk->nb_points; i++)
{
@@ -1543,8 +1543,8 @@ void sk_convertStroke(bContext *C, SK_Stroke *stk)
VECCOPY(bone->head, head->p);
VECCOPY(bone->tail, pt->p);
- Mat4MulVecfl(invmat, bone->head);
- Mat4MulVecfl(invmat, bone->tail);
+ mul_m4_v3(invmat, bone->head);
+ mul_m4_v3(invmat, bone->tail);
setBoneRollFromNormal(bone, head->no, invmat, tmat);
}
@@ -1624,7 +1624,7 @@ int sk_getSelfIntersections(bContext *C, ListBase *list, SK_Stroke *gesture)
project_float(ar, gesture->points[g_i].p, g_p1);
project_float(ar, gesture->points[g_i + 1].p, g_p2);
- if (LineIntersectLineStrict(s_p1, s_p2, g_p1, g_p2, vi, &lambda))
+ if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda))
{
SK_Intersection *isect = MEM_callocN(sizeof(SK_Intersection), "Intersection");
@@ -1633,9 +1633,9 @@ int sk_getSelfIntersections(bContext *C, ListBase *list, SK_Stroke *gesture)
isect->after = s_i + 1;
isect->stroke = gesture;
- VecSubf(isect->p, gesture->points[s_i + 1].p, gesture->points[s_i].p);
- VecMulf(isect->p, lambda);
- VecAddf(isect->p, isect->p, gesture->points[s_i].p);
+ sub_v3_v3v3(isect->p, gesture->points[s_i + 1].p, gesture->points[s_i].p);
+ mul_v3_fl(isect->p, lambda);
+ add_v3_v3v3(isect->p, isect->p, gesture->points[s_i].p);
BLI_addtail(list, isect);
@@ -1711,7 +1711,7 @@ int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, SK_Strok
project_float(ar, gesture->points[g_i].p, g_p1);
project_float(ar, gesture->points[g_i + 1].p, g_p2);
- if (LineIntersectLineStrict(s_p1, s_p2, g_p1, g_p2, vi, &lambda))
+ if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda))
{
SK_Intersection *isect = MEM_callocN(sizeof(SK_Intersection), "Intersection");
float ray_start[3], ray_end[3];
@@ -1727,7 +1727,7 @@ int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, SK_Strok
mval[1] = vi[1];
viewline(ar, v3d, mval, ray_start, ray_end);
- LineIntersectLine( stk->points[s_i].p,
+ isect_line_line_v3( stk->points[s_i].p,
stk->points[s_i + 1].p,
ray_start,
ray_end,
@@ -1768,7 +1768,7 @@ int sk_getSegments(SK_Stroke *segments, SK_Stroke *gesture)
float n[3];
/* Calculate normal */
- VecSubf(n, gesture->points[i].p, vec);
+ sub_v3_v3v3(n, gesture->points[i].p, vec);
if (calcArcCorrelation(iter, j, i, vec, n) < CORRELATION_THRESHOLD)
{
@@ -1818,10 +1818,10 @@ int sk_detectTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
float s1[3], s2[3];
float angle;
- VecSubf(s1, gest->segments->points[1].p, gest->segments->points[0].p);
- VecSubf(s2, gest->segments->points[2].p, gest->segments->points[1].p);
+ sub_v3_v3v3(s1, gest->segments->points[1].p, gest->segments->points[0].p);
+ sub_v3_v3v3(s2, gest->segments->points[2].p, gest->segments->points[1].p);
- angle = RAD2DEG(VecAngle2(s1, s2));
+ angle = RAD2DEG(angle_v2v2(s1, s2));
if (angle > 60 && angle < 120)
{
@@ -1837,7 +1837,7 @@ void sk_applyTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
SK_Intersection *isect;
float trim_dir[3];
- VecSubf(trim_dir, gest->segments->points[2].p, gest->segments->points[1].p);
+ sub_v3_v3v3(trim_dir, gest->segments->points[2].p, gest->segments->points[1].p);
for (isect = gest->intersections.first; isect; isect = isect->next)
{
@@ -1849,10 +1849,10 @@ void sk_applyTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
VECCOPY(pt.p, isect->p);
VECCOPY(pt.no, isect->stroke->points[isect->before].no);
- VecSubf(stroke_dir, isect->stroke->points[isect->after].p, isect->stroke->points[isect->before].p);
+ sub_v3_v3v3(stroke_dir, isect->stroke->points[isect->after].p, isect->stroke->points[isect->before].p);
/* same direction, trim end */
- if (Inpf(stroke_dir, trim_dir) > 0)
+ if (dot_v3v3(stroke_dir, trim_dir) > 0)
{
sk_replaceStrokePoint(isect->stroke, &pt, isect->after);
sk_trimStroke(isect->stroke, 0, isect->after);
@@ -1936,10 +1936,10 @@ int sk_detectDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
float s1[3], s2[3];
float angle;
- VecSubf(s1, gest->segments->points[1].p, gest->segments->points[0].p);
- VecSubf(s2, gest->segments->points[2].p, gest->segments->points[1].p);
+ sub_v3_v3v3(s1, gest->segments->points[1].p, gest->segments->points[0].p);
+ sub_v3_v3v3(s2, gest->segments->points[2].p, gest->segments->points[1].p);
- angle = RAD2DEG(VecAngle2(s1, s2));
+ angle = RAD2DEG(angle_v2v2(s1, s2));
if (angle > 120)
{
@@ -2062,16 +2062,16 @@ int sk_detectReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
if (isect->gesture_index < isect->next->gesture_index)
{
- VecSubf(start_v, isect->p, gest->stk->points[0].p);
- VecSubf(end_v, sk_lastStrokePoint(gest->stk)->p, isect->next->p);
+ sub_v3_v3v3(start_v, isect->p, gest->stk->points[0].p);
+ sub_v3_v3v3(end_v, sk_lastStrokePoint(gest->stk)->p, isect->next->p);
}
else
{
- VecSubf(start_v, isect->next->p, gest->stk->points[0].p);
- VecSubf(end_v, sk_lastStrokePoint(gest->stk)->p, isect->p);
+ sub_v3_v3v3(start_v, isect->next->p, gest->stk->points[0].p);
+ sub_v3_v3v3(end_v, sk_lastStrokePoint(gest->stk)->p, isect->p);
}
- angle = RAD2DEG(VecAngle2(start_v, end_v));
+ angle = RAD2DEG(angle_v2v2(start_v, end_v));
if (angle > 120)
{
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 9847bdc3283..b9019410348 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -40,7 +40,7 @@
#include "DNA_modifier_types.h"
#include "DNA_scene_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_memarena.h"
@@ -151,16 +151,16 @@ static float cotan_weight(float *v1, float *v2, float *v3)
{
float a[3], b[3], c[3], clen;
- VecSubf(a, v2, v1);
- VecSubf(b, v3, v1);
- Crossf(c, a, b);
+ sub_v3_v3v3(a, v2, v1);
+ sub_v3_v3v3(b, v3, v1);
+ cross_v3_v3v3(c, a, b);
- clen = VecLength(c);
+ clen = len_v3(c);
if (clen == 0.0f)
return 0.0f;
- return Inpf(a, b)/clen;
+ return dot_v3v3(a, b)/clen;
}
static void laplacian_triangle_area(LaplacianSystem *sys, int i1, int i2, int i3)
@@ -177,21 +177,21 @@ static void laplacian_triangle_area(LaplacianSystem *sys, int i1, int i2, int i3
t2= cotan_weight(v2, v3, v1);
t3= cotan_weight(v3, v1, v2);
- if(RAD2DEG(VecAngle3(v2, v1, v3)) > 90) obtuse= 1;
- else if(RAD2DEG(VecAngle3(v1, v2, v3)) > 90) obtuse= 2;
- else if(RAD2DEG(VecAngle3(v1, v3, v2)) > 90) obtuse= 3;
+ if(RAD2DEG(angle_v3v3v3(v2, v1, v3)) > 90) obtuse= 1;
+ else if(RAD2DEG(angle_v3v3v3(v1, v2, v3)) > 90) obtuse= 2;
+ else if(RAD2DEG(angle_v3v3v3(v1, v3, v2)) > 90) obtuse= 3;
if (obtuse > 0) {
- area= AreaT3Dfl(v1, v2, v3);
+ area= area_tri_v3(v1, v2, v3);
varea[i1] += (obtuse == 1)? area: area*0.5;
varea[i2] += (obtuse == 2)? area: area*0.5;
varea[i3] += (obtuse == 3)? area: area*0.5;
}
else {
- len1= VecLenf(v2, v3);
- len2= VecLenf(v1, v3);
- len3= VecLenf(v1, v2);
+ len1= len_v3v3(v2, v3);
+ len2= len_v3v3(v1, v3);
+ len3= len_v3v3(v1, v2);
t1 *= len1*len1;
t2 *= len2*len2;
@@ -446,7 +446,7 @@ static int heat_ray_bone_visible(LaplacianSystem *sys, int vertex, int bone)
VECCOPY(isec.start, sys->heat.verts[vertex]);
- PclosestVL3Dfl(end, isec.start, sys->heat.root[bone], sys->heat.tip[bone]);
+ closest_to_line_segment_v3(end, isec.start, sys->heat.root[bone], sys->heat.tip[bone]);
VECSUB(isec.vec, end, isec.start);
isec.labda = 1.0f - 1e-5;
@@ -462,11 +462,11 @@ static float heat_bone_distance(LaplacianSystem *sys, int vertex, int bone)
float closest[3], d[3], dist, cosine;
/* compute euclidian distance */
- PclosestVL3Dfl(closest, sys->heat.verts[vertex],
+ closest_to_line_segment_v3(closest, sys->heat.verts[vertex],
sys->heat.root[bone], sys->heat.tip[bone]);
- VecSubf(d, sys->heat.verts[vertex], closest);
- dist= Normalize(d);
+ sub_v3_v3v3(d, sys->heat.verts[vertex], closest);
+ dist= normalize_v3(d);
/* if the vertex normal does not point along the bone, increase distance */
cosine= INPR(d, sys->heat.vnors[vertex]);
@@ -536,15 +536,15 @@ void heat_calc_vnormals(LaplacianSystem *sys)
v2= (*face)[1];
v3= (*face)[2];
- CalcNormFloat(sys->verts[v1], sys->verts[v2], sys->verts[v3], fnor);
+ normal_tri_v3( fnor,sys->verts[v1], sys->verts[v2], sys->verts[v3]);
- VecAddf(sys->heat.vnors[v1], sys->heat.vnors[v1], fnor);
- VecAddf(sys->heat.vnors[v2], sys->heat.vnors[v2], fnor);
- VecAddf(sys->heat.vnors[v3], sys->heat.vnors[v3], fnor);
+ add_v3_v3v3(sys->heat.vnors[v1], sys->heat.vnors[v1], fnor);
+ add_v3_v3v3(sys->heat.vnors[v2], sys->heat.vnors[v2], fnor);
+ add_v3_v3v3(sys->heat.vnors[v3], sys->heat.vnors[v3], fnor);
}
for(a=0; a<sys->totvert; a++)
- Normalize(sys->heat.vnors[a]);
+ normalize_v3(sys->heat.vnors[a]);
}
static void heat_laplacian_create(LaplacianSystem *sys)
@@ -746,8 +746,8 @@ static void rigid_add_half_edge_to_R(LaplacianSystem *sys, EditVert *v1, EditVer
float e[3], e_[3];
int i;
- VecSubf(e, sys->rigid.origco[v1->tmp.l], sys->rigid.origco[v2->tmp.l]);
- VecSubf(e_, v1->co, v2->co);
+ sub_v3_v3v3(e, sys->rigid.origco[v1->tmp.l], sys->rigid.origco[v2->tmp.l]);
+ sub_v3_v3v3(e_, v1->co, v2->co);
/* formula (5) */
for (i=0; i<3; i++) {
@@ -767,9 +767,9 @@ static void rigid_orthogonalize_R(float R[][3])
{
HMatrix M, Q, S;
- Mat4CpyMat3(M, R);
+ copy_m4_m3(M, R);
polar_decomp(M, Q, S);
- Mat3CpyMat4(R, Q);
+ copy_m3_m4(R, Q);
}
static void rigid_add_half_edge_to_rhs(LaplacianSystem *sys, EditVert *v1, EditVert *v2, float w)
@@ -780,15 +780,15 @@ static void rigid_add_half_edge_to_rhs(LaplacianSystem *sys, EditVert *v1, EditV
if (sys->vpinned[v1->tmp.l])
return;
- Mat3AddMat3(Rsum, sys->rigid.R[v1->tmp.l], sys->rigid.R[v2->tmp.l]);
- Mat3Transp(Rsum);
+ add_m3_m3m3(Rsum, sys->rigid.R[v1->tmp.l], sys->rigid.R[v2->tmp.l]);
+ transpose_m3(Rsum);
- VecSubf(rhs, sys->rigid.origco[v1->tmp.l], sys->rigid.origco[v2->tmp.l]);
- Mat3MulVecfl(Rsum, rhs);
- VecMulf(rhs, 0.5f);
- VecMulf(rhs, w);
+ sub_v3_v3v3(rhs, sys->rigid.origco[v1->tmp.l], sys->rigid.origco[v2->tmp.l]);
+ mul_m3_v3(Rsum, rhs);
+ mul_v3_fl(rhs, 0.5f);
+ mul_v3_fl(rhs, w);
- VecAddf(sys->rigid.rhs[v1->tmp.l], sys->rigid.rhs[v1->tmp.l], rhs);
+ add_v3_v3v3(sys->rigid.rhs[v1->tmp.l], sys->rigid.rhs[v1->tmp.l], rhs);
}
static void rigid_add_edge_to_rhs(LaplacianSystem *sys, EditVert *v1, EditVert *v2, float w)
@@ -916,7 +916,7 @@ void rigid_deform_begin(EditMesh *em)
sys->rigid.origco = MEM_callocN(sizeof(float)*3*totvert, "RigidDeformCo");
for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
- VecCopyf(sys->rigid.origco[a], eve->co);
+ copy_v3_v3(sys->rigid.origco[a], eve->co);
sys->areaweights= 0;
sys->storeweights= 1;
@@ -940,7 +940,7 @@ void rigid_deform_end(int cancel)
if(cancel)
for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
if(!eve->pinned)
- VecCopyf(eve->co, sys->rigid.origco[a]);
+ copy_v3_v3(eve->co, sys->rigid.origco[a]);
if(sys->rigid.R) MEM_freeN(sys->rigid.R);
if(sys->rigid.rhs) MEM_freeN(sys->rigid.rhs);
@@ -1034,7 +1034,7 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3],
VECSUB(edge2, vert2, vert0);
/* begin calculating determinant - also used to calculate U parameter */
- Crossf(pvec, dir, edge2);
+ cross_v3_v3v3(pvec, dir, edge2);
/* if determinant is near zero, ray lies in plane of triangle */
det = INPR(edge1, pvec);
@@ -1052,7 +1052,7 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3],
return 0;
/* prepare to test V parameter */
- Crossf(qvec, tvec, edge1);
+ cross_v3_v3v3(qvec, tvec, edge1);
/* calculate V parameter and test bounds */
v = INPR(dir, qvec) * inv_det;
@@ -1158,20 +1158,20 @@ static int meshdeform_intersect(MeshDeformBind *mdb, Isect *isec)
hit = meshdeform_tri_intersect(isec->start, end, face[0], face[1], face[2], co, uvw);
if(hit) {
- CalcNormFloat(face[0], face[1], face[2], nor);
+ normal_tri_v3( nor,face[0], face[1], face[2]);
}
else {
hit= meshdeform_tri_intersect(isec->start, end, face[0], face[2], face[3], co, uvw);
- CalcNormFloat(face[0], face[2], face[3], nor);
+ normal_tri_v3( nor,face[0], face[2], face[3]);
}
}
else {
hit= meshdeform_tri_intersect(isec->start, end, face[0], face[1], face[2], co, uvw);
- CalcNormFloat(face[0], face[1], face[2], nor);
+ normal_tri_v3( nor,face[0], face[1], face[2]);
}
if(hit) {
- len= VecLenf(isec->start, co)/VecLenf(isec->start, end);
+ len= len_v3v3(isec->start, co)/len_v3v3(isec->start, end);
if(len < isec->labda) {
isec->labda= len;
isec->hit.face = mface;
@@ -1219,7 +1219,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
isect->co[1]= co1[1] + isec.vec[1]*len;
isect->co[2]= co1[2] + isec.vec[2]*len;
- isect->len= VecLenf(co1, isect->co);
+ isect->len= len_v3v3(co1, isect->co);
if(isect->len < MESHDEFORM_LEN_THRESHOLD)
isect->len= MESHDEFORM_LEN_THRESHOLD;
@@ -1237,7 +1237,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
VECCOPY(vert[1], cagecos[mface->v2]);
VECCOPY(vert[2], cagecos[mface->v3]);
if(mface->v4) VECCOPY(vert[3], cagecos[mface->v4]);
- MeanValueWeights(vert, isect->nvert, isect->co, isect->uvw);
+ interp_weights_poly_v3( isect->uvw,vert, isect->nvert, isect->co);
return isect;
}
@@ -1260,7 +1260,7 @@ static int meshdeform_inside_cage(MeshDeformBind *mdb, float *co)
VECCOPY(start, co);
VECSUB(dir, outside, start);
- Normalize(dir);
+ normalize_v3(dir);
isect = meshdeform_ray_tree_intersect(mdb, start, outside);
if(isect && !isect->facing)
@@ -1650,7 +1650,7 @@ static void meshdeform_matrix_solve(MeshDeformBind *mdb)
for(b=0; b<mdb->totvert; b++) {
if(mdb->inside[b]) {
VECCOPY(vec, mdb->vertexcos[b]);
- Mat4MulVecfl(mdb->cagemat, vec);
+ mul_m4_v3(mdb->cagemat, vec);
gridvec[0]= (vec[0] - mdb->min[0] - mdb->halfwidth[0])/mdb->width[0];
gridvec[1]= (vec[1] - mdb->min[1] - mdb->halfwidth[1])/mdb->width[1];
gridvec[2]= (vec[2] - mdb->min[2] - mdb->halfwidth[2])/mdb->width[2];
@@ -1720,7 +1720,7 @@ void harmonic_coordinates_bind(Scene *scene, MeshDeformModifierData *mmd, float
mdb.cagedm= mesh_create_derived_no_deform(scene, mmd->object, NULL, CD_MASK_BAREMESH);
mdb.totcagevert= mdb.cagedm->getNumVerts(mdb.cagedm);
mdb.cagecos= MEM_callocN(sizeof(*mdb.cagecos)*mdb.totcagevert, "MeshDeformBindCos");
- Mat4CpyMat4(mdb.cagemat, cagemat);
+ copy_m4_m4(mdb.cagemat, cagemat);
mvert= mdb.cagedm->getVertArray(mdb.cagedm);
for(a=0; a<mdb.totcagevert; a++)
@@ -1781,7 +1781,7 @@ void harmonic_coordinates_bind(Scene *scene, MeshDeformModifierData *mmd, float
totinside= 0;
for(a=0; a<mdb.totvert; a++) {
VECCOPY(vec, mdb.vertexcos[a]);
- Mat4MulVecfl(mdb.cagemat, vec);
+ mul_m4_v3(mdb.cagemat, vec);
mdb.inside[a]= meshdeform_inside_cage(&mdb, vec);
if(mdb.inside[a])
totinside++;
@@ -1821,7 +1821,7 @@ void harmonic_coordinates_bind(Scene *scene, MeshDeformModifierData *mmd, float
mmd->bindcos= (float*)mdb.cagecos;
mmd->totvert= mdb.totvert;
mmd->totcagevert= mdb.totcagevert;
- Mat4CpyMat4(mmd->bindmat, mmd->object->obmat);
+ copy_m4_m4(mmd->bindmat, mmd->object->obmat);
if(mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
mmd->totinfluence= 0;
@@ -1868,7 +1868,7 @@ void harmonic_coordinates_bind(Scene *scene, MeshDeformModifierData *mmd, float
/* transform bindcos to world space */
for(a=0; a<mdb.totcagevert; a++)
- Mat4MulVecfl(mmd->object->obmat, mmd->bindcos+a*3);
+ mul_m4_v3(mmd->object->obmat, mmd->bindcos+a*3);
/* free */
mdb.cagedm->release(mdb.cagedm);
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index 1e0df79d0e6..e5d334e4d06 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -34,7 +34,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
#include "BLI_dlrbTree.h"
@@ -461,7 +461,7 @@ static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl)
/* perform blending */
if (pso->mode == POSESLIDE_BREAKDOWN) {
/* just perform the interpol between quat_prev and quat_next using pso->percentage as a guide */
- QuatInterpol(pchan->quat, quat_prev, quat_next, pso->percentage);
+ interp_qt_qtqt(pchan->quat, quat_prev, quat_next, pso->percentage);
}
else {
float quat_interp[4], quat_orig[4];
@@ -470,16 +470,16 @@ static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl)
/* perform this blending several times until a satisfactory result is reached */
while (iters-- > 0) {
/* calculate the interpolation between the endpoints */
- QuatInterpol(quat_interp, quat_prev, quat_next, (cframe-pso->prevFrame) / (pso->nextFrame-pso->prevFrame) );
+ interp_qt_qtqt(quat_interp, quat_prev, quat_next, (cframe-pso->prevFrame) / (pso->nextFrame-pso->prevFrame) );
/* make a copy of the original rotation */
QUATCOPY(quat_orig, pchan->quat);
/* tricky interpolations - mode-dependent blending between original and new */
if (pso->mode == POSESLIDE_RELAX) // xxx this was the original code, so should work fine
- QuatInterpol(pchan->quat, quat_orig, quat_interp, 1.0f/6.0f);
+ interp_qt_qtqt(pchan->quat, quat_orig, quat_interp, 1.0f/6.0f);
else // I'm just guessing here...
- QuatInterpol(pchan->quat, quat_orig, quat_interp, 6.0f/5.0f);
+ interp_qt_qtqt(pchan->quat, quat_orig, quat_interp, 6.0f/5.0f);
}
}
}
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 565a4782377..0837e9cb48a 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -34,7 +34,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
#include "BLI_dlrbTree.h"
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index d7741c2a5ef..18750d96f86 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -33,7 +33,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
@@ -279,7 +279,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob)
VECCOPY(fp, pchan->pose_tail);
}
- Mat4MulVecfl(ob->obmat, fp);
+ mul_m4_v3(ob->obmat, fp);
}
}
}
@@ -405,7 +405,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op)
VECCOPY(fp, pchan->pose_tail);
}
- Mat4MulVecfl(ob->obmat, fp);
+ mul_m4_v3(ob->obmat, fp);
}
}
}
@@ -814,13 +814,13 @@ void pose_copy_menu(Scene *scene)
float tmp_quat[4];
/* need to convert to quat first (in temp var)... */
- Mat4ToQuat(delta_mat, tmp_quat);
- QuatToAxisAngle(tmp_quat, pchan->rotAxis, &pchan->rotAngle);
+ mat4_to_quat( tmp_quat,delta_mat);
+ quat_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,tmp_quat);
}
else if (pchan->rotmode == ROT_MODE_QUAT)
- Mat4ToQuat(delta_mat, pchan->quat);
+ mat4_to_quat( pchan->quat,delta_mat);
else
- Mat4ToEulO(delta_mat, pchan->eul, pchan->rotmode);
+ mat4_to_eulO( pchan->eul, pchan->rotmode,delta_mat);
}
break;
case 11: /* Visual Size */
@@ -828,7 +828,7 @@ void pose_copy_menu(Scene *scene)
float delta_mat[4][4], size[4];
armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat);
- Mat4ToSize(delta_mat, size);
+ mat4_to_size( size,delta_mat);
VECCOPY(pchan->size, size);
}
}
@@ -1020,23 +1020,23 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
else if (pchan->rotmode > 0) {
/* quat/axis-angle to euler */
if (chan->rotmode == ROT_MODE_AXISANGLE)
- AxisAngleToEulO(chan->rotAxis, chan->rotAngle, pchan->eul, pchan->rotmode);
+ axis_angle_to_eulO( pchan->eul, pchan->rotmode,chan->rotAxis, chan->rotAngle);
else
- QuatToEulO(chan->quat, pchan->eul, pchan->rotmode);
+ quat_to_eulO( pchan->eul, pchan->rotmode,chan->quat);
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
/* quat/euler to axis angle */
if (chan->rotmode > 0)
- EulOToAxisAngle(chan->eul, chan->rotmode, pchan->rotAxis, &pchan->rotAngle);
+ eulO_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,chan->eul, chan->rotmode);
else
- QuatToAxisAngle(chan->quat, pchan->rotAxis, &pchan->rotAngle);
+ quat_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,chan->quat);
}
else {
/* euler/axis-angle to quat */
if (chan->rotmode > 0)
- EulOToQuat(chan->eul, chan->rotmode, pchan->quat);
+ eulO_to_quat( pchan->quat,chan->eul, chan->rotmode);
else
- AxisAngleToQuat(pchan->quat, chan->rotAxis, pchan->rotAngle);
+ axis_angle_to_quat(pchan->quat, chan->rotAxis, pchan->rotAngle);
}
/* paste flipped pose? */
@@ -1051,10 +1051,10 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
float eul[3];
- AxisAngleToEulO(pchan->rotAxis, pchan->rotAngle, eul, EULER_ORDER_DEFAULT);
+ axis_angle_to_eulO( eul, EULER_ORDER_DEFAULT,pchan->rotAxis, pchan->rotAngle);
eul[1]*= -1;
eul[2]*= -1;
- EulOToAxisAngle(eul, EULER_ORDER_DEFAULT, pchan->rotAxis, &pchan->rotAngle);
+ eulO_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,eul, EULER_ORDER_DEFAULT);
// experimental method (uncomment to test):
#if 0
@@ -1066,10 +1066,10 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
else {
float eul[3];
- QuatToEul(pchan->quat, eul);
+ quat_to_eul( eul,pchan->quat);
eul[1]*= -1;
eul[2]*= -1;
- EulToQuat(eul, pchan->quat);
+ eul_to_quat( pchan->quat,eul);
}
}
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index 132d9edf8d0..05b0dc267ff 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -45,7 +45,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_edgehash.h"
#include "BLI_ghash.h"
@@ -498,12 +498,12 @@ void repositionNodes(ReebGraph *rg)
float p[3];
VECCOPY(p, ((ReebArc*)arc)->buckets[0].p);
- VecMulf(p, 1.0f / arc->head->degree);
- VecAddf(arc->head->p, arc->head->p, p);
+ mul_v3_fl(p, 1.0f / arc->head->degree);
+ add_v3_v3v3(arc->head->p, arc->head->p, p);
VECCOPY(p, ((ReebArc*)arc)->buckets[((ReebArc*)arc)->bcount - 1].p);
- VecMulf(p, 1.0f / arc->tail->degree);
- VecAddf(arc->tail->p, arc->tail->p, p);
+ mul_v3_fl(p, 1.0f / arc->tail->degree);
+ add_v3_v3v3(arc->tail->p, arc->tail->p, p);
}
}
}
@@ -634,15 +634,15 @@ void verifyMultiResolutionLinks(ReebGraph *rg, int level)
void addVertToBucket(EmbedBucket *b, float co[3])
{
b->nv++;
- VecLerpf(b->p, b->p, co, 1.0f / b->nv);
+ interp_v3_v3v3(b->p, b->p, co, 1.0f / b->nv);
}
void removeVertFromBucket(EmbedBucket *b, float co[3])
{
- VecMulf(b->p, (float)b->nv);
- VecSubf(b->p, b->p, co);
+ mul_v3_fl(b->p, (float)b->nv);
+ sub_v3_v3v3(b->p, b->p, co);
b->nv--;
- VecMulf(b->p, 1.0f / (float)b->nv);
+ mul_v3_fl(b->p, 1.0f / (float)b->nv);
}
void mergeBuckets(EmbedBucket *bDst, EmbedBucket *bSrc)
@@ -650,7 +650,7 @@ void mergeBuckets(EmbedBucket *bDst, EmbedBucket *bSrc)
if (bDst->nv > 0 && bSrc->nv > 0)
{
bDst->nv += bSrc->nv;
- VecLerpf(bDst->p, bDst->p, bSrc->p, (float)bSrc->nv / (float)(bDst->nv));
+ interp_v3_v3v3(bDst->p, bDst->p, bSrc->p, (float)bSrc->nv / (float)(bDst->nv));
}
else if (bSrc->nv > 0)
{
@@ -797,7 +797,7 @@ static void interpolateBuckets(ReebArc *arc, float *start_p, float *end_p, int s
{
EmbedBucket *empty = arc->buckets + j;
empty->nv = 1;
- VecLerpf(empty->p, start_p, end_p, (float)(j - start_index + 1) / total);
+ interp_v3_v3v3(empty->p, start_p, end_p, (float)(j - start_index + 1) / total);
}
}
@@ -873,20 +873,20 @@ static void ExtendArcBuckets(ReebArc *arc)
previous = iter->p, IT_next(iter)
)
{
- average_length += VecLenf(previous, iter->p);
+ average_length += len_v3v3(previous, iter->p);
}
average_length /= (arc->bcount - 1);
first_bucket = arc->buckets;
last_bucket = arc->buckets + (arc->bcount - 1);
- length = VecLenf(first_bucket->p, arc->head->p);
+ length = len_v3v3(first_bucket->p, arc->head->p);
if (length > 2 * average_length)
{
padding_head = (int)floor(length / average_length);
}
- length = VecLenf(last_bucket->p, arc->tail->p);
+ length = len_v3v3(last_bucket->p, arc->tail->p);
if (length > 2 * average_length)
{
padding_tail = (int)floor(length / average_length);
@@ -945,12 +945,12 @@ void calculateArcLength(ReebArc *arc)
{
vec1 = iter->p;
- arc->length += VecLenf(vec0, vec1);
+ arc->length += len_v3v3(vec0, vec1);
vec0 = vec1;
}
- arc->length += VecLenf(arc->tail->p, vec1);
+ arc->length += len_v3v3(arc->tail->p, vec1);
}
void calculateGraphLength(ReebGraph *rg)
@@ -982,8 +982,8 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
float normal[3];
int j = i + 1;
- VecAddf(tangent, ring[i].n, ring[j].n);
- Crossf(normal, tangent, axis);
+ add_v3_v3v3(tangent, ring[i].n, ring[j].n);
+ cross_v3_v3v3(normal, tangent, axis);
node1 = (ReebNode*)BLI_otherNode(ring[i].arc, root_node);
node2 = (ReebNode*)BLI_otherNode(ring[j].arc, root_node);
@@ -993,7 +993,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
/* mirror first node and mix with the second */
BLI_mirrorAlongAxis(node1->p, root_node->p, normal);
- VecLerpf(node2->p, node2->p, node1->p, 1.0f / (j + 1));
+ interp_v3_v3v3(node2->p, node2->p, node1->p, 1.0f / (j + 1));
/* Merge buckets
* there shouldn't be any null arcs here, but just to be safe
@@ -1030,7 +1030,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
/* mirror on axis */
BLI_mirrorAlongAxis(bucket1->p, root_node->p, normal);
/* add bucket2 in bucket1 */
- VecLerpf(bucket2->p, bucket2->p, bucket1->p, (float)bucket1->nv / (float)(bucket2->nv));
+ interp_v3_v3v3(bucket2->p, bucket2->p, bucket1->p, (float)bucket1->nv / (float)(bucket2->nv));
}
}
}
@@ -1044,8 +1044,8 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
float normal[3];
int j = i - 1;
- VecAddf(tangent, ring[i].n, ring[j].n);
- Crossf(normal, tangent, axis);
+ add_v3_v3v3(tangent, ring[i].n, ring[j].n);
+ cross_v3_v3v3(normal, tangent, axis);
node1 = (ReebNode*)BLI_otherNode(ring[i].arc, root_node);
node2 = (ReebNode*)BLI_otherNode(ring[j].arc, root_node);
@@ -1111,8 +1111,8 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr
BLI_mirrorAlongAxis(p, root_node->p, nor);
/* average with node1 */
- VecAddf(node1->p, node1->p, p);
- VecMulf(node1->p, 0.5f);
+ add_v3_v3v3(node1->p, node1->p, p);
+ mul_v3_fl(node1->p, 0.5f);
/* mirror back on node2 */
VECCOPY(node2->p, node1->p);
@@ -1153,7 +1153,7 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr
/* mirror on axis */
BLI_mirrorAlongAxis(bucket2->p, root_node->p, nor);
/* add bucket2 in bucket1 */
- VecLerpf(bucket1->p, bucket1->p, bucket2->p, (float)bucket2->nv / (float)(bucket1->nv));
+ interp_v3_v3v3(bucket1->p, bucket1->p, bucket2->p, (float)bucket2->nv / (float)(bucket1->nv));
/* copy and mirror back to bucket2 */
bucket2->nv = bucket1->nv;
@@ -1200,8 +1200,8 @@ void postprocessGraph(ReebGraph *rg, char mode)
for(index = 1; index < bcount - 1; index++)
{
- VecLerpf(buckets[index].p, buckets[index].p, buckets[index - 1].p, fac1 / (fac1 + fac2));
- VecLerpf(buckets[index].p, buckets[index].p, buckets[index + 1].p, fac3 / (fac1 + fac2 + fac3));
+ interp_v3_v3v3(buckets[index].p, buckets[index].p, buckets[index - 1].p, fac1 / (fac1 + fac2));
+ interp_v3_v3v3(buckets[index].p, buckets[index].p, buckets[index + 1].p, fac3 / (fac1 + fac2 + fac3));
}
}
}
@@ -1339,7 +1339,7 @@ int joinSubgraphsEnds(ReebGraph *rg, float threshold, int nb_subgraphs)
{
if (end_node->subgraph_index != subgraph)
{
- float distance = VecLenf(start_node->p, end_node->p);
+ float distance = len_v3v3(start_node->p, end_node->p);
if (distance < threshold && distance < min_distance)
{
@@ -1597,7 +1597,7 @@ void filterNullReebGraph(ReebGraph *rg)
blend = (float)newNode->degree / (float)(newNode->degree + removedNode->degree); // blending factors
- VecLerpf(newNode->p, removedNode->p, newNode->p, blend);
+ interp_v3_v3v3(newNode->p, removedNode->p, newNode->p, blend);
filterArc(rg, newNode, removedNode, arc, 0);
@@ -1808,16 +1808,16 @@ int filterSmartReebGraph(ReebGraph *rg, float threshold)
VECCOPY(midpoint, vec1);
- distance = VecLenf(midpoint, efa->cent);
+ distance = len_v3v3(midpoint, efa->cent);
if (min_distance == -1 || distance < min_distance)
{
min_distance = distance;
- VecSubf(tangent, vec1, vec0);
- Normalize(tangent);
+ sub_v3_v3v3(tangent, vec1, vec0);
+ normalize_v3(tangent);
- angle = Inpf(tangent, efa->n);
+ angle = dot_v3v3(tangent, efa->n);
}
previous = bucket;
@@ -1829,7 +1829,7 @@ int filterSmartReebGraph(ReebGraph *rg, float threshold)
efa->tmp.fp = saacos(fabs(angle));
#endif
#else
- VecAddf(avg_vec, avg_vec, efa->n);
+ add_v3_v3v3(avg_vec, avg_vec, efa->n);
#endif
}
@@ -1837,8 +1837,8 @@ int filterSmartReebGraph(ReebGraph *rg, float threshold)
#if 0
avg_angle /= total;
#else
- VecMulf(avg_vec, 1.0 / total);
- avg_angle = Inpf(avg_vec, avg_vec);
+ mul_v3_fl(avg_vec, 1.0 / total);
+ avg_angle = dot_v3v3(avg_vec, avg_vec);
#endif
arc->angle = avg_angle;
@@ -2064,8 +2064,8 @@ void REEB_exportGraph(ReebGraph *rg, int count)
fprintf(f, "b nv:%i %f %f %f\n", arc->buckets[i].nv, arc->buckets[i].p[0], arc->buckets[i].p[1], arc->buckets[i].p[2]);
}
- VecAddf(p, arc->tail->p, arc->head->p);
- VecMulf(p, 0.5f);
+ add_v3_v3v3(p, arc->tail->p, arc->head->p);
+ mul_v3_fl(p, 0.5f);
fprintf(f, "angle %0.3f %0.3f %0.3f %0.3f %i\n", p[0], p[1], p[2], arc->angle, BLI_ghash_size(arc->faces));
exportNode(f, "v2", arc->tail);
@@ -2501,7 +2501,7 @@ ReebEdge * createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2)
float co[3];
float f = (arc->buckets[i].val - offset) / len;
- VecLerpf(co, v1->p, v2->p, f);
+ interp_v3_v3v3(co, v1->p, v2->p, f);
addVertToBucket(&(arc->buckets[i]), co);
}
#endif
@@ -2690,16 +2690,16 @@ static float cotan_weight(float *v1, float *v2, float *v3)
{
float a[3], b[3], c[3], clen;
- VecSubf(a, v2, v1);
- VecSubf(b, v3, v1);
- Crossf(c, a, b);
+ sub_v3_v3v3(a, v2, v1);
+ sub_v3_v3v3(b, v3, v1);
+ cross_v3_v3v3(c, a, b);
- clen = VecLength(c);
+ clen = len_v3(c);
if (clen == 0.0f)
return 0.0f;
- return Inpf(a, b)/clen;
+ return dot_v3v3(a, b)/clen;
}
void addTriangle(EditVert *v1, EditVert *v2, EditVert *v3, int e1, int e2, int e3)
@@ -3077,7 +3077,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
{
if (eed->v1->h == 0 && eed->v2->h == 0)
{
- eed->tmp.fp = VecLenf(eed->v1->co, eed->v2->co);
+ eed->tmp.fp = len_v3v3(eed->v1->co, eed->v2->co);
}
}
@@ -3112,7 +3112,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
/* vertex is already processed and distance is smaller than current minimum */
if (closest_eve->f1 == 1)
{
- float distance = VecLenf(closest_eve->co, eve->co);
+ float distance = len_v3v3(closest_eve->co, eve->co);
if (distance < min_distance)
{
min_distance = distance;
@@ -3688,7 +3688,7 @@ void REEB_draw()
if (G.scene->toolsettings->skgen_options & SKGEN_DISP_INDEX)
{
- VecLerpf(vec, arc->head->p, arc->tail->p, 0.5f);
+ interp_v3_v3v3(vec, arc->head->p, arc->tail->p, 0.5f);
s += sprintf(s, "%i (%i-%i-%i) ", i, arc->symmetry_level, arc->symmetry_flag, arc->symmetry_group);
if (G.scene->toolsettings->skgen_options & SKGEN_DISP_WEIGHT)
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index 929e3514990..4c5bcb71499 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -40,7 +40,7 @@
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index a58439051e9..7801168dd83 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -39,7 +39,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_dynstr.h"
#include "BLI_rand.h"
@@ -525,7 +525,7 @@ static void rotateflagNurb(ListBase *editnurb, short flag, float *cent, float ro
bp->vec[0]-=cent[0];
bp->vec[1]-=cent[1];
bp->vec[2]-=cent[2];
- Mat3MulVecfl(rotmat, bp->vec);
+ mul_m3_v3(rotmat, bp->vec);
bp->vec[0]+=cent[0];
bp->vec[1]+=cent[1];
bp->vec[2]+=cent[2];
@@ -549,9 +549,9 @@ static void translateflagNurb(ListBase *editnurb, short flag, float *vec)
a= nu->pntsu;
bezt= nu->bezt;
while(a--) {
- if(bezt->f1 & flag) VecAddf(bezt->vec[0], bezt->vec[0], vec);
- if(bezt->f2 & flag) VecAddf(bezt->vec[1], bezt->vec[1], vec);
- if(bezt->f3 & flag) VecAddf(bezt->vec[2], bezt->vec[2], vec);
+ if(bezt->f1 & flag) add_v3_v3v3(bezt->vec[0], bezt->vec[0], vec);
+ if(bezt->f2 & flag) add_v3_v3v3(bezt->vec[1], bezt->vec[1], vec);
+ if(bezt->f3 & flag) add_v3_v3v3(bezt->vec[2], bezt->vec[2], vec);
bezt++;
}
}
@@ -559,7 +559,7 @@ static void translateflagNurb(ListBase *editnurb, short flag, float *vec)
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
while(a--) {
- if(bp->f1 & flag) VecAddf(bp->vec, bp->vec, vec);
+ if(bp->f1 & flag) add_v3_v3v3(bp->vec, bp->vec, vec);
bp++;
}
}
@@ -1868,18 +1868,18 @@ static int subdivide_exec(bContext *C, wmOperator *op)
memcpy(beztn, bezt, sizeof(BezTriple));
/* midpoint subdividing */
- VecMidf(vec, prevbezt->vec[1], prevbezt->vec[2]);
- VecMidf(vec+3, prevbezt->vec[2], bezt->vec[0]);
- VecMidf(vec+6, bezt->vec[0], bezt->vec[1]);
+ mid_v3_v3v3(vec, prevbezt->vec[1], prevbezt->vec[2]);
+ mid_v3_v3v3(vec+3, prevbezt->vec[2], bezt->vec[0]);
+ mid_v3_v3v3(vec+6, bezt->vec[0], bezt->vec[1]);
- VecMidf(vec+9, vec, vec+3);
- VecMidf(vec+12, vec+3, vec+6);
+ mid_v3_v3v3(vec+9, vec, vec+3);
+ mid_v3_v3v3(vec+12, vec+3, vec+6);
/* change handle of prev beztn */
VECCOPY((beztn-1)->vec[2], vec);
/* new point */
VECCOPY(beztn->vec[0], vec+9);
- VecMidf(beztn->vec[1], vec+9, vec+12);
+ mid_v3_v3v3(beztn->vec[1], vec+9, vec+12);
VECCOPY(beztn->vec[2], vec+12);
/* handle of next bezt */
if(a==0 && (nu->flagu & CU_CYCLIC)) {VECCOPY(beztnew->vec[0], vec+6);}
@@ -2662,10 +2662,10 @@ static void make_selection_list_nurb(ListBase *editnurb)
bp= nu->bp;
a= nu->pntsu;
while(a--) {
- VecAddf(nus->vec, nus->vec, bp->vec);
+ add_v3_v3v3(nus->vec, nus->vec, bp->vec);
bp++;
}
- VecMulf(nus->vec, 1.0/(float)nu->pntsu);
+ mul_v3_fl(nus->vec, 1.0/(float)nu->pntsu);
}
@@ -2684,13 +2684,13 @@ static void make_selection_list_nurb(ListBase *editnurb)
nustest= nbase.first;
while(nustest) {
- dist= VecLenf(nustest->vec, ((NurbSort *)nsortbase.first)->vec);
+ dist= len_v3v3(nustest->vec, ((NurbSort *)nsortbase.first)->vec);
if(dist<headdist) {
headdist= dist;
headdo= nustest;
}
- dist= VecLenf(nustest->vec, ((NurbSort *)nsortbase.last)->vec);
+ dist= len_v3v3(nustest->vec, ((NurbSort *)nsortbase.last)->vec);
if(dist<taildist) {
taildist= dist;
@@ -2774,7 +2774,7 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
len1= 0.0;
for(v=0; v<nu1->pntsv; v++, bp1+=nu1->pntsu, bp2+=nu2->pntsu) {
- len1+= VecLenf(bp1->vec, bp2->vec);
+ len1+= len_v3v3(bp1->vec, bp2->vec);
}
bp1= nu1->bp + nu1->pntsu-1;
@@ -2782,7 +2782,7 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
len2= 0.0;
for(v=0; v<nu1->pntsv; v++, bp1+=nu1->pntsu, bp2-=nu2->pntsu) {
- len2+= VecLenf(bp1->vec, bp2->vec);
+ len2+= len_v3v3(bp1->vec, bp2->vec);
}
/* merge */
@@ -3136,13 +3136,13 @@ static int spin_nurb(bContext *C, Scene *scene, Object *obedit, float *dvec, sho
float persmat[3][3], persinv[3][3];
short a,ok, changed= 0;
- if(mode != 2 && rv3d) Mat3CpyMat4(persmat, rv3d->viewmat);
- else Mat3One(persmat);
- Mat3Inv(persinv, persmat);
+ if(mode != 2 && rv3d) copy_m3_m4(persmat, rv3d->viewmat);
+ else unit_m3(persmat);
+ invert_m3_m3(persinv, persmat);
/* imat and center and size */
- Mat3CpyMat4(bmat, obedit->obmat);
- Mat3Inv(imat, bmat);
+ copy_m3_m4(bmat, obedit->obmat);
+ invert_m3_m3(imat, bmat);
if(v3d) {
curs= give_cursor(scene, v3d);
@@ -3151,8 +3151,8 @@ static int spin_nurb(bContext *C, Scene *scene, Object *obedit, float *dvec, sho
else
cent[0]= cent[1]= cent[2]= 0.0f;
- VecSubf(cent, cent, obedit->obmat[3]);
- Mat3MulVecfl(imat,cent);
+ sub_v3_v3v3(cent, cent, obedit->obmat[3]);
+ mul_m3_v3(imat,cent);
if(dvec || mode==2 || !rv3d) {
n[0]=n[1]= 0.0;
@@ -3161,7 +3161,7 @@ static int spin_nurb(bContext *C, Scene *scene, Object *obedit, float *dvec, sho
n[0]= rv3d->viewinv[2][0];
n[1]= rv3d->viewinv[2][1];
n[2]= rv3d->viewinv[2][2];
- Normalize(n);
+ normalize_v3(n);
}
phi= M_PI/8.0;
@@ -3170,27 +3170,27 @@ static int spin_nurb(bContext *C, Scene *scene, Object *obedit, float *dvec, sho
q[1]= n[0]*si;
q[2]= n[1]*si;
q[3]= n[2]*si;
- QuatToMat3(q, cmat);
- Mat3MulMat3(tmat, cmat, bmat);
- Mat3MulMat3(rotmat, imat, tmat);
+ quat_to_mat3( cmat,q);
+ mul_m3_m3m3(tmat, cmat, bmat);
+ mul_m3_m3m3(rotmat, imat, tmat);
- Mat3One(scalemat1);
+ unit_m3(scalemat1);
scalemat1[0][0]= sqrt(2.0);
scalemat1[1][1]= sqrt(2.0);
- Mat3MulMat3(tmat,persmat,bmat);
- Mat3MulMat3(cmat,scalemat1,tmat);
- Mat3MulMat3(tmat,persinv,cmat);
- Mat3MulMat3(scalemat1,imat,tmat);
+ mul_m3_m3m3(tmat,persmat,bmat);
+ mul_m3_m3m3(cmat,scalemat1,tmat);
+ mul_m3_m3m3(tmat,persinv,cmat);
+ mul_m3_m3m3(scalemat1,imat,tmat);
- Mat3One(scalemat2);
+ unit_m3(scalemat2);
scalemat2[0][0]/= sqrt(2.0);
scalemat2[1][1]/= sqrt(2.0);
- Mat3MulMat3(tmat,persmat,bmat);
- Mat3MulMat3(cmat,scalemat2,tmat);
- Mat3MulMat3(tmat,persinv,cmat);
- Mat3MulMat3(scalemat2,imat,tmat);
+ mul_m3_m3m3(tmat,persmat,bmat);
+ mul_m3_m3m3(cmat,scalemat2,tmat);
+ mul_m3_m3m3(tmat,persinv,cmat);
+ mul_m3_m3m3(scalemat2,imat,tmat);
ok= 1;
@@ -3216,7 +3216,7 @@ static int spin_nurb(bContext *C, Scene *scene, Object *obedit, float *dvec, sho
}
}
if(dvec) {
- Mat3MulVecfl(bmat,dvec);
+ mul_m3_v3(bmat,dvec);
translateflagNurb(editnurb, 1,dvec);
}
}
@@ -3275,8 +3275,8 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
BPoint *bp, *newbp = NULL;
float mat[3][3],imat[3][3], temp[3];
- Mat3CpyMat4(mat, obedit->obmat);
- Mat3Inv(imat,mat);
+ copy_m3_m4(mat, obedit->obmat);
+ invert_m3_m3(imat,mat);
findselectedNurbvert(editnurb, &nu, &bezt, &bp);
if(bezt==0 && bp==0) return OPERATOR_CANCELLED;
@@ -3322,11 +3322,11 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
}
else {
VECCOPY(newbezt->vec[1], location);
- VecSubf(newbezt->vec[1],newbezt->vec[1], obedit->obmat[3]);
- Mat3MulVecfl(imat,newbezt->vec[1]);
- VecSubf(temp, newbezt->vec[1],temp);
- VecAddf(newbezt->vec[0], bezt->vec[0],temp);
- VecAddf(newbezt->vec[2], bezt->vec[2],temp);
+ sub_v3_v3v3(newbezt->vec[1],newbezt->vec[1], obedit->obmat[3]);
+ mul_m3_v3(imat,newbezt->vec[1]);
+ sub_v3_v3v3(temp, newbezt->vec[1],temp);
+ add_v3_v3v3(newbezt->vec[0], bezt->vec[0],temp);
+ add_v3_v3v3(newbezt->vec[2], bezt->vec[2],temp);
calchandlesNurb(nu);
}
}
@@ -3368,8 +3368,8 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
}
else {
VECCOPY(newbp->vec, location);
- VecSubf(newbp->vec, newbp->vec, obedit->obmat[3]);
- Mat3MulVecfl(imat,newbp->vec);
+ sub_v3_v3v3(newbp->vec, newbp->vec, obedit->obmat[3]);
+ mul_m3_v3(imat,newbp->vec);
newbp->vec[3]= 1.0;
}
}
@@ -4633,7 +4633,7 @@ int join_curve_exec(bContext *C, wmOperator *op)
tempbase.first= tempbase.last= 0;
/* trasnform all selected curves inverse in obact */
- Mat4Invert(imat, ob->obmat);
+ invert_m4_m4(imat, ob->obmat);
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
if(base->object->type==ob->type) {
@@ -4643,7 +4643,7 @@ int join_curve_exec(bContext *C, wmOperator *op)
if(cu->nurb.first) {
/* watch it: switch order here really goes wrong */
- Mat4MulMat4(cmat, base->object->obmat, imat);
+ mul_m4_m4m4(cmat, base->object->obmat, imat);
nu= cu->nurb.first;
while(nu) {
@@ -4653,16 +4653,16 @@ int join_curve_exec(bContext *C, wmOperator *op)
if( (bezt= newnu->bezt) ) {
a= newnu->pntsu;
while(a--) {
- Mat4MulVecfl(cmat, bezt->vec[0]);
- Mat4MulVecfl(cmat, bezt->vec[1]);
- Mat4MulVecfl(cmat, bezt->vec[2]);
+ mul_m4_v3(cmat, bezt->vec[0]);
+ mul_m4_v3(cmat, bezt->vec[1]);
+ mul_m4_v3(cmat, bezt->vec[2]);
bezt++;
}
}
if( (bp= newnu->bp) ) {
a= newnu->pntsu*nu->pntsv;
while(a--) {
- Mat4MulVecfl(cmat, bp->vec);
+ mul_m4_v3(cmat, bp->vec);
bp++;
}
}
@@ -4716,7 +4716,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
/* imat and center and size */
if(obedit) {
- Mat3CpyMat4(mat, obedit->obmat);
+ copy_m3_m4(mat, obedit->obmat);
if(v3d) {
curs= give_cursor(scene, v3d);
VECCOPY(cent, curs);
@@ -4730,16 +4730,16 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
if(rv3d) {
if (!newname && (U.flag & USER_ADD_VIEWALIGNED))
- Mat3CpyMat4(imat, rv3d->viewmat);
+ copy_m3_m4(imat, rv3d->viewmat);
else
- Mat3One(imat);
+ unit_m3(imat);
- Mat3MulVecfl(imat, cent);
- Mat3MulMat3(cmat, imat, mat);
- Mat3Inv(imat, cmat);
+ mul_m3_v3(imat, cent);
+ mul_m3_m3m3(cmat, imat, mat);
+ invert_m3_m3(imat, cmat);
}
else
- Mat3One(imat);
+ unit_m3(imat);
setflagsNurb(editnurb, 0);
}
@@ -4779,7 +4779,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
bezt->vec[0][1]+= -0.5*grid;
bezt->vec[2][0]+= -0.5*grid;
bezt->vec[2][1]+= 0.5*grid;
- for(a=0;a<3;a++) Mat3MulVecfl(imat, bezt->vec[a]);
+ for(a=0;a<3;a++) mul_m3_v3(imat, bezt->vec[a]);
bezt++;
bezt->h1= bezt->h2= HD_ALIGN;
@@ -4790,7 +4790,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
VECCOPY(bezt->vec[a], cent);
}
bezt->vec[1][0]+= grid;
- for(a=0;a<3;a++) Mat3MulVecfl(imat, bezt->vec[a]);
+ for(a=0;a<3;a++) mul_m3_v3(imat, bezt->vec[a]);
calchandlesNurb(nu);
}
@@ -4821,7 +4821,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
bp->vec[0]+= 1.5*grid;
bp= nu->bp;
- for(a=0;a<4;a++, bp++) Mat3MulVecfl(imat,bp->vec);
+ for(a=0;a<4;a++, bp++) mul_m3_v3(imat,bp->vec);
if(cutype==CU_NURBS) {
nu->knotsu= 0; /* makeknots allocates */
@@ -4856,7 +4856,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
bp->vec[0]+= 2.0*grid;
bp= nu->bp;
- for(a=0;a<5;a++, bp++) Mat3MulVecfl(imat,bp->vec);
+ for(a=0;a<5;a++, bp++) mul_m3_v3(imat,bp->vec);
if(cutype==CU_NURBS) {
nu->knotsu= 0; /* makeknots allocates */
@@ -4883,7 +4883,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][0]+= -grid;
- for(a=0;a<3;a++) Mat3MulVecfl(imat,bezt->vec[a]);
+ for(a=0;a<3;a++) mul_m3_v3(imat,bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
bezt++;
@@ -4893,7 +4893,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][1]+= grid;
- for(a=0;a<3;a++) Mat3MulVecfl(imat,bezt->vec[a]);
+ for(a=0;a<3;a++) mul_m3_v3(imat,bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
bezt++;
@@ -4903,7 +4903,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][0]+= grid;
- for(a=0;a<3;a++) Mat3MulVecfl(imat,bezt->vec[a]);
+ for(a=0;a<3;a++) mul_m3_v3(imat,bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
bezt++;
@@ -4913,7 +4913,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][1]+= -grid;
- for(a=0;a<3;a++) Mat3MulVecfl(imat,bezt->vec[a]);
+ for(a=0;a<3;a++) mul_m3_v3(imat,bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
calchandlesNurb(nu);
@@ -4940,7 +4940,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
}
if(a & 1) bp->vec[3]= 0.25*sqrt(2.0);
else bp->vec[3]= 1.0;
- Mat3MulVecfl(imat,bp->vec);
+ mul_m3_v3(imat,bp->vec);
bp->radius = bp->weight = 1.0;
bp++;
@@ -4977,7 +4977,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
if(a==1 || a==2) if(b==1 || b==2) {
bp->vec[2]+= grid;
}
- Mat3MulVecfl(imat,bp->vec);
+ mul_m3_v3(imat,bp->vec);
bp->vec[3]= 1.0;
bp++;
}
@@ -5000,7 +5000,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
BLI_addtail(editnurb, nu); /* temporal for extrude and translate */
vec[0]=vec[1]= 0.0;
vec[2]= -grid;
- Mat3MulVecfl(imat, vec);
+ mul_m3_v3(imat, vec);
translateflagNurb(editnurb, 1, vec);
extrudeflagNurb(editnurb, 1);
vec[0]= -2*vec[0];
@@ -5042,7 +5042,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
bp->vec[2]+= nurbcircle[a][1]*grid;
if(a & 1) bp->vec[3]= 0.5*sqrt(2.0);
else bp->vec[3]= 1.0;
- Mat3MulVecfl(imat,bp->vec);
+ mul_m3_v3(imat,bp->vec);
bp++;
}
nu->flagu= 4;
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 6ebc9c8a1c9..b6b0289e871 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -39,7 +39,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_curve_types.h"
#include "DNA_object_types.h"
@@ -541,7 +541,7 @@ void ED_text_to_object(bContext *C, Text *text, int split_lines)
offset[2] = 0;
if(rv3d)
- Mat4Mul3Vecfl(rv3d->viewinv, offset);
+ mul_mat3_m4_v3(rv3d->viewinv, offset);
txt_add_object(C, line, 1, offset);
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index dcd57efa926..9a0187dde04 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -37,7 +37,7 @@
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "DNA_gpencil_types.h"
@@ -326,7 +326,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
/* calculate gradient and normal - 'angle'=(ny/nx) */
m1[1]= s1[1] - s0[1];
m1[0]= s1[0] - s0[0];
- Normalize2(m1);
+ normalize_v2(m1);
m2[1]= -m1[0];
m2[0]= m1[1];
@@ -374,7 +374,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
/* calculate gradient of bisector (as average of normals) */
mb[0]= (pm[0] + m2[0]) / 2;
mb[1]= (pm[1] + m2[1]) / 2;
- Normalize2(mb);
+ normalize_v2(mb);
/* calculate gradient to apply
* - as basis, use just pthick * bisector gradient
@@ -382,7 +382,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
*/
mt[0]= mb[0] * pthick;
mt[1]= mb[1] * pthick;
- athick= Vec2Length(mt);
+ athick= len_v2(mt);
dfac= pthick - (athick * 2);
if ( ((athick * 2) < pthick) && (IS_EQ(athick, pthick)==0) )
{
@@ -442,7 +442,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
}
/* store stroke's 'natural' normal for next stroke to use */
- Vec2Copyf(pm, m2);
+ copy_v2_v2(pm, m2);
}
glEnd();
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index beb4ed06810..88ceba88827 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -33,7 +33,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "DNA_listBase.h"
diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c
index b25de4d5f1d..4da5ec02ddc 100644
--- a/source/blender/editors/gpencil/gpencil_buttons.c
+++ b/source/blender/editors/gpencil/gpencil_buttons.c
@@ -32,7 +32,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "DNA_gpencil_types.h"
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 6b76c48e1bf..1358ed80f7a 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -37,7 +37,7 @@
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "DNA_listBase.h"
@@ -368,7 +368,7 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi
if (gps->flag & GP_STROKE_3DSPACE) {
/* directly use 3d-coordinates */
- VecCopyf(p3d, &pt->x);
+ copy_v3_v3(p3d, &pt->x);
}
else {
float *fp= give_cursor(scene, v3d);
@@ -393,7 +393,7 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi
*/
project_short_noclip(ar, fp, mval);
window_to_3d(ar, dvec, mval[0]-mx, mval[1]-my);
- VecSubf(p3d, fp, dvec);
+ sub_v3_v3v3(p3d, fp, dvec);
}
}
@@ -424,7 +424,7 @@ static void gp_stroke_to_path (bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Cur
/* get coordinates to add at */
gp_strokepoint_convertcoords(C, gps, pt, p3d);
- VecCopyf(bp->vec, p3d);
+ copy_v3_v3(bp->vec, p3d);
/* set settings */
bp->f1= SELECT;
@@ -460,9 +460,9 @@ static void gp_stroke_to_bezier (bContext *C, bGPDlayer *gpl, bGPDstroke *gps, C
gp_strokepoint_convertcoords(C, gps, pt, p3d);
/* TODO: maybe in future the handles shouldn't be in same place */
- VecCopyf(bezt->vec[0], p3d);
- VecCopyf(bezt->vec[1], p3d);
- VecCopyf(bezt->vec[2], p3d);
+ copy_v3_v3(bezt->vec[0], p3d);
+ copy_v3_v3(bezt->vec[1], p3d);
+ copy_v3_v3(bezt->vec[2], p3d);
/* set settings */
bezt->h1= bezt->h2= HD_FREE;
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 92ae2400666..64e68fab508 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -34,7 +34,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BKE_gpencil.h"
#include "BKE_context.h"
@@ -169,11 +169,11 @@ static void gp_get_3d_reference (tGPsdata *p, float *vec)
/* active Object
* - use relative distance of 3D-cursor from object center
*/
- VecSubf(vec, fp, ob->loc);
+ sub_v3_v3v3(vec, fp, ob->loc);
}
else {
/* use 3D-cursor */
- VecCopyf(vec, fp);
+ copy_v3_v3(vec, fp);
}
}
@@ -228,7 +228,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[], float out[])
/* method taken from editview.c - mouse_cursor() */
project_short_noclip(p->ar, rvec, mval);
window_to_3d_delta(p->ar, dvec, mval[0]-mx, mval[1]-my);
- VecSubf(out, rvec, dvec);
+ sub_v3_v3v3(out, rvec, dvec);
}
/* 2d - on 'canvas' (assume that p->v2d is set) */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index fcc41e4f533..51c38ee859f 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -38,7 +38,7 @@
#include "DNA_texture_types.h"
#include "DNA_userdef_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
@@ -988,7 +988,7 @@ static void ui_do_active_linklines(uiBlock *block, short *mval)
v3[0]= line->to->x1;
v3[1]= (line->to->y1+line->to->y2)/2.0;
- fac= PdistVL2Dfl(v1, v2, v3);
+ fac= dist_to_line_segment_v2(v1, v2, v3);
if(fac < mindist) {
mindist= fac;
act= line;
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 59a1933fa4a..a233a84e6c8 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -37,7 +37,7 @@
#include "DNA_texture_types.h"
#include "DNA_userdef_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BKE_colortools.h"
#include "BKE_texture.h"
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index f085e7054a3..6adee174400 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -38,7 +38,7 @@
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "PIL_time.h"
@@ -2652,7 +2652,7 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i
fp[2]= -sqrt( radsq-dx*dx-dy*dy );
}
}
- Normalize(fp);
+ normalize_v3(fp);
data->draglastx= mx;
data->draglasty= my;
@@ -4486,14 +4486,14 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
newp[0]= mx;
newp[1]= my;
- if(Vec2Lenf(oldp, newp) < 4.0f)
+ if(len_v2v2(oldp, newp) < 4.0f)
return menu->dotowards;
closer= 0;
- closer |= IsectPT2Df(newp, oldp, p1, p2);
- closer |= IsectPT2Df(newp, oldp, p2, p3);
- closer |= IsectPT2Df(newp, oldp, p3, p4);
- closer |= IsectPT2Df(newp, oldp, p4, p1);
+ closer |= isect_point_tri_v2(newp, oldp, p1, p2);
+ closer |= isect_point_tri_v2(newp, oldp, p2, p3);
+ closer |= isect_point_tri_v2(newp, oldp, p3, p4);
+ closer |= isect_point_tri_v2(newp, oldp, p4, p1);
if(!closer)
menu->dotowards= 0;
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 90f15d7992e..23a0ff7d223 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -40,7 +40,7 @@
#include "GPU_extensions.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_storage_types.h"
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 20cd6ebf971..e73a4fbe977 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -37,7 +37,7 @@
#include "PIL_time.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index e3b7d173961..388b83cff11 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -35,7 +35,7 @@
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
#include "BLI_ghash.h"
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 5c058889107..2e8d2a8cb2b 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -35,7 +35,7 @@
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_rect.h"
#include "BLI_string.h"
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index a35da38ea66..111f0df6d3d 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -497,7 +497,7 @@ void uiTemplatePathBuilder(uiLayout *layout, bContext *C, PointerRNA *ptr, char
#include "UI_resources.h"
#include "ED_util.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_listbase.h"
#include "ED_object.h"
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 00b72786e68..88a67c25478 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -35,7 +35,7 @@
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_rect.h"
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 0042ad9483b..5d94fb32438 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -32,7 +32,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_heap.h"
#include "BLI_edgehash.h"
#include "BLI_editVert.h"
@@ -453,7 +453,7 @@ int minmax_tface(Scene *scene, float *min, float *max)
me= get_mesh(ob);
if(me==0 || me->mtface==0) return ok;
- Mat3CpyMat4(bmat, ob->obmat);
+ copy_m3_m4(bmat, ob->obmat);
mv= me->mvert;
mf= me->mface;
@@ -463,24 +463,24 @@ int minmax_tface(Scene *scene, float *min, float *max)
continue;
VECCOPY(vec, (mv+mf->v1)->co);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, ob->obmat[3]);
+ mul_m3_v3(bmat, vec);
+ add_v3_v3v3(vec, vec, ob->obmat[3]);
DO_MINMAX(vec, min, max);
VECCOPY(vec, (mv+mf->v2)->co);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, ob->obmat[3]);
+ mul_m3_v3(bmat, vec);
+ add_v3_v3v3(vec, vec, ob->obmat[3]);
DO_MINMAX(vec, min, max);
VECCOPY(vec, (mv+mf->v3)->co);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, ob->obmat[3]);
+ mul_m3_v3(bmat, vec);
+ add_v3_v3v3(vec, vec, ob->obmat[3]);
DO_MINMAX(vec, min, max);
if (mf->v4) {
VECCOPY(vec, (mv+mf->v4)->co);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, ob->obmat[3]);
+ mul_m3_v3(bmat, vec);
+ add_v3_v3v3(vec, vec, ob->obmat[3]);
DO_MINMAX(vec, min, max);
}
ok= 1;
@@ -500,11 +500,11 @@ static float edgetag_cut_cost(EditMesh *em, int e1, int e2, int vert)
EditVert *v2 = EM_get_vert_for_index( (eed2->v1->tmp.l == vert)? eed2->v2->tmp.l: eed2->v1->tmp.l );
float cost, d1[3], d2[3];
- cost = VecLenf(v1->co, v->co);
- cost += VecLenf(v->co, v2->co);
+ cost = len_v3v3(v1->co, v->co);
+ cost += len_v3v3(v->co, v2->co);
- VecSubf(d1, v->co, v1->co);
- VecSubf(d2, v2->co, v->co);
+ sub_v3_v3v3(d1, v->co, v1->co);
+ sub_v3_v3v3(d2, v2->co, v->co);
cost = cost + 0.5f*cost*(2.0f - fabs(d1[0]*d2[0] + d1[1]*d2[1] + d1[2]*d2[2]));
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index 81d565a9ba4..bdb1df3b5c1 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -49,7 +49,7 @@
#include "DNA_userdef_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_dynstr.h"
#include "BLI_rand.h"
@@ -411,12 +411,12 @@ EditFace *addfacelist(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *v3, Ed
em->totface++;
if(efa->v4) {
- CalcNormFloat4(efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co, efa->n);
- CalcCent4f(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
+ normal_quad_v3( efa->n,efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
+ cent_quad_v3(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
}
else {
- CalcNormFloat(efa->v1->co, efa->v2->co, efa->v3->co, efa->n);
- CalcCent3f(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co);
+ normal_tri_v3( efa->n,efa->v1->co, efa->v2->co, efa->v3->co);
+ cent_tri_v3(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co);
}
return efa;
@@ -614,13 +614,13 @@ static void edge_normal_compare(EditEdge *eed, EditFace *efa1)
inp= efa1->n[0]*efa2->n[0] + efa1->n[1]*efa2->n[1] + efa1->n[2]*efa2->n[2];
if(inp<0.999 && inp >-0.999) eed->f2= 1;
- if(efa1->v4) CalcCent4f(cent1, efa1->v1->co, efa1->v2->co, efa1->v3->co, efa1->v4->co);
- else CalcCent3f(cent1, efa1->v1->co, efa1->v2->co, efa1->v3->co);
- if(efa2->v4) CalcCent4f(cent2, efa2->v1->co, efa2->v2->co, efa2->v3->co, efa2->v4->co);
- else CalcCent3f(cent2, efa2->v1->co, efa2->v2->co, efa2->v3->co);
+ if(efa1->v4) cent_quad_v3(cent1, efa1->v1->co, efa1->v2->co, efa1->v3->co, efa1->v4->co);
+ else cent_tri_v3(cent1, efa1->v1->co, efa1->v2->co, efa1->v3->co);
+ if(efa2->v4) cent_quad_v3(cent2, efa2->v1->co, efa2->v2->co, efa2->v3->co, efa2->v4->co);
+ else cent_tri_v3(cent2, efa2->v1->co, efa2->v2->co, efa2->v3->co);
- VecSubf(cent1, cent2, cent1);
- Normalize(cent1);
+ sub_v3_v3v3(cent1, cent2, cent1);
+ normalize_v3(cent1);
inp= cent1[0]*efa1->n[0] + cent1[1]*efa1->n[1] + cent1[2]*efa1->n[2];
if(inp < -0.001 ) eed->f1= 1;
@@ -1004,7 +1004,7 @@ void load_editMesh(Scene *scene, Object *ob)
/* vertex normal */
VECCOPY(nor, eve->no);
- VecMulf(nor, 32767.0);
+ mul_v3_fl(nor, 32767.0);
VECCOPY(mvert->no, nor);
/* note: it used to remove me->dvert when it was not in use, cancelled
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 5905b2021ea..fbe72a54e70 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -49,7 +49,7 @@
#include "RNA_access.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BKE_context.h"
@@ -147,40 +147,40 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
done= 0;
for(eed= vc.em->edges.first; eed; eed= eed->next) {
if( (eed->v1->f & SELECT)+(eed->v2->f & SELECT) == SELECT ) {
- if(eed->v1->f & SELECT) VecSubf(vec, eed->v1->co, eed->v2->co);
- else VecSubf(vec, eed->v2->co, eed->v1->co);
- VecAddf(nor, nor, vec);
+ if(eed->v1->f & SELECT) sub_v3_v3v3(vec, eed->v1->co, eed->v2->co);
+ else sub_v3_v3v3(vec, eed->v2->co, eed->v1->co);
+ add_v3_v3v3(nor, nor, vec);
done= 1;
}
}
- if(done) Normalize(nor);
+ if(done) normalize_v3(nor);
/* center */
- VecAddf(cent, min, max);
- VecMulf(cent, 0.5f);
+ add_v3_v3v3(cent, min, max);
+ mul_v3_fl(cent, 0.5f);
VECCOPY(min, cent);
- Mat4MulVecfl(vc.obedit->obmat, min); // view space
+ mul_m4_v3(vc.obedit->obmat, min); // view space
view3d_get_view_aligned_coordinate(&vc, min, event->mval);
- Mat4Invert(vc.obedit->imat, vc.obedit->obmat);
- Mat4MulVecfl(vc.obedit->imat, min); // back in object space
+ invert_m4_m4(vc.obedit->imat, vc.obedit->obmat);
+ mul_m4_v3(vc.obedit->imat, min); // back in object space
- VecSubf(min, min, cent);
+ sub_v3_v3v3(min, min, cent);
/* calculate rotation */
- Mat3One(mat);
+ unit_m3(mat);
if(done) {
float dot;
VECCOPY(vec, min);
- Normalize(vec);
+ normalize_v3(vec);
dot= INPR(vec, nor);
if( fabs(dot)<0.999) {
float cross[3], si, q1[4];
- Crossf(cross, nor, vec);
- Normalize(cross);
+ cross_v3_v3v3(cross, nor, vec);
+ normalize_v3(cross);
dot= 0.5f*saacos(dot);
si= (float)sin(dot);
q1[0]= (float)cos(dot);
@@ -188,7 +188,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
q1[2]= cross[1]*si;
q1[3]= cross[2]*si;
- QuatToMat3(q1, mat);
+ quat_to_mat3( mat,q1);
}
}
@@ -207,12 +207,12 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
eve= addvertlist(vc.em, 0, NULL);
- Mat3CpyMat4(mat, vc.obedit->obmat);
- Mat3Inv(imat, mat);
+ copy_m3_m4(mat, vc.obedit->obmat);
+ invert_m3_m3(imat, mat);
VECCOPY(eve->co, min);
- Mat3MulVecfl(imat, eve->co);
- VecSubf(eve->co, eve->co, vc.obedit->obmat[3]);
+ mul_m3_v3(imat, eve->co);
+ sub_v3_v3v3(eve->co, eve->co, vc.obedit->obmat[3]);
eve->f= SELECT;
}
@@ -1011,7 +1011,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
vec[0]= dia*phi;
vec[1]= - dia;
vec[2]= 0.0f;
- Mat4MulVecfl(mat,vec);
+ mul_m4_v3(mat,vec);
eve= addvertlist(em, vec, NULL);
eve->f= 1+2+4;
if (a) {
@@ -1022,7 +1022,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
/* extrude and translate */
vec[0]= vec[2]= 0.0;
vec[1]= dia*phid;
- Mat4Mul3Vecfl(mat, vec);
+ mul_mat3_m4_v3(mat, vec);
for(a=0;a<seg-1;a++) {
extrudeflag_vert(obedit, em, 2, nor); // nor unused
@@ -1057,7 +1057,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
q[0]= cos(phi);
q[3]= sin(phi);
q[1]=q[2]= 0;
- QuatToMat3(q, cmat);
+ quat_to_mat3( cmat,q);
for(a=0; a<seg; a++) {
extrudeflag_vert(obedit, em, 2, nor); // nor unused
@@ -1070,7 +1070,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
eve= em->verts.first;
while(eve) {
if(eve->f & SELECT) {
- Mat4MulVecfl(mat,eve->co);
+ mul_m4_v3(mat,eve->co);
}
eve= eve->next;
}
@@ -1111,7 +1111,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
eve= em->verts.first;
while(eve) {
if(eve->f & 2) {
- Mat4MulVecfl(mat,eve->co);
+ mul_m4_v3(mat,eve->co);
}
eve= eve->next;
}
@@ -1150,7 +1150,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
/* and now do imat */
for(eve= em->verts.first; eve; eve= eve->next) {
if(eve->f & SELECT) {
- Mat4MulVecfl(mat,eve->co);
+ mul_m4_v3(mat,eve->co);
}
}
recalc_editnormals(em);
@@ -1170,7 +1170,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
vec[1]= dia*cos(phi);
vec[2]= b?depth:-depth;
- Mat4MulVecfl(mat, vec);
+ mul_m4_v3(mat, vec);
eve= addvertlist(em, vec, NULL);
eve->f= SELECT;
if(a==0) {
@@ -1187,12 +1187,12 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
if(type == PRIM_CONE || (fill && !ELEM(type, PRIM_PLANE, PRIM_CUBE))) {
vec[0]= vec[1]= 0.0f;
vec[2]= type==PRIM_CONE ? depth : -depth;
- Mat4MulVecfl(mat, vec);
+ mul_m4_v3(mat, vec);
vdown= addvertlist(em, vec, NULL);
if((ext || type==PRIM_CONE) && fill) {
vec[0]= vec[1]= 0.0f;
vec[2]= type==PRIM_CONE ? -depth : depth;
- Mat4MulVecfl(mat,vec);
+ mul_m4_v3(mat,vec);
vtop= addvertlist(em, vec, NULL);
}
} else {
@@ -1281,25 +1281,25 @@ static float new_primitive_matrix(bContext *C, int view_align, float primmat[][4
RegionView3D *rv3d= ED_view3d_context_rv3d(C);
float *curs, mat[3][3], vmat[3][3], cmat[3][3], imat[3][3];
- Mat4One(primmat);
+ unit_m4(primmat);
if(rv3d && view_align) {
- Mat3CpyMat4(vmat, rv3d->viewmat);
+ copy_m3_m4(vmat, rv3d->viewmat);
} else
- Mat3One(vmat);
+ unit_m3(vmat);
/* inverse transform for view and object */
- Mat3CpyMat4(mat, obedit->obmat);
- Mat3MulMat3(cmat, vmat, mat);
- Mat3Inv(imat, cmat);
- Mat4CpyMat3(primmat, imat);
+ copy_m3_m4(mat, obedit->obmat);
+ mul_m3_m3m3(cmat, vmat, mat);
+ invert_m3_m3(imat, cmat);
+ copy_m4_m3(primmat, imat);
/* center */
curs= give_cursor(scene, v3d);
VECCOPY(primmat[3], curs);
VECSUB(primmat[3], primmat[3], obedit->obmat[3]);
- Mat3Inv(imat, mat);
- Mat3MulVecfl(imat, primmat[3]);
+ invert_m3_m3(imat, mat);
+ mul_m3_v3(imat, primmat[3]);
if(v3d) return v3d->grid;
return 1.0f;
diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c
index e1b63022dd4..544dd790dc8 100644
--- a/source/blender/editors/mesh/editmesh_lib.c
+++ b/source/blender/editors/mesh/editmesh_lib.c
@@ -47,7 +47,7 @@ editmesh_lib: generic (no UI, no menus) operations/evaluators for editmesh data
#include "DNA_windowmanager_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BKE_customdata.h"
@@ -272,14 +272,14 @@ void EM_editselection_center(float *center, EditSelection *ese)
{
if (ese->type==EDITVERT) {
EditVert *eve= ese->data;
- VecCopyf(center, eve->co);
+ copy_v3_v3(center, eve->co);
} else if (ese->type==EDITEDGE) {
EditEdge *eed= ese->data;
- VecAddf(center, eed->v1->co, eed->v2->co);
- VecMulf(center, 0.5);
+ add_v3_v3v3(center, eed->v1->co, eed->v2->co);
+ mul_v3_fl(center, 0.5);
} else if (ese->type==EDITFACE) {
EditFace *efa= ese->data;
- VecCopyf(center, efa->cent);
+ copy_v3_v3(center, efa->cent);
}
}
@@ -287,26 +287,26 @@ void EM_editselection_normal(float *normal, EditSelection *ese)
{
if (ese->type==EDITVERT) {
EditVert *eve= ese->data;
- VecCopyf(normal, eve->no);
+ copy_v3_v3(normal, eve->no);
} else if (ese->type==EDITEDGE) {
EditEdge *eed= ese->data;
float plane[3]; /* need a plane to correct the normal */
float vec[3]; /* temp vec storage */
- VecAddf(normal, eed->v1->no, eed->v2->no);
- VecSubf(plane, eed->v2->co, eed->v1->co);
+ add_v3_v3v3(normal, eed->v1->no, eed->v2->no);
+ sub_v3_v3v3(plane, eed->v2->co, eed->v1->co);
/* the 2 vertex normals will be close but not at rightangles to the edge
for rotate about edge we want them to be at right angles, so we need to
do some extra colculation to correct the vert normals,
we need the plane for this */
- Crossf(vec, normal, plane);
- Crossf(normal, plane, vec);
- Normalize(normal);
+ cross_v3_v3v3(vec, normal, plane);
+ cross_v3_v3v3(normal, plane, vec);
+ normalize_v3(normal);
} else if (ese->type==EDITFACE) {
EditFace *efa= ese->data;
- VecCopyf(normal, efa->n);
+ copy_v3_v3(normal, efa->n);
}
}
@@ -321,7 +321,7 @@ void EM_editselection_plane(float *plane, EditSelection *ese)
if (ese->prev) { /*use previously selected data to make a usefull vertex plane */
EM_editselection_center(vec, ese->prev);
- VecSubf(plane, vec, eve->co);
+ sub_v3_v3v3(plane, vec, eve->co);
} else {
/* make a fake plane thats at rightangles to the normal
we cant make a crossvec from a vec thats the same as the vec
@@ -330,7 +330,7 @@ void EM_editselection_plane(float *plane, EditSelection *ese)
if (eve->no[0]<0.5) vec[0]=1;
else if (eve->no[1]<0.5) vec[1]=1;
else vec[2]=1;
- Crossf(plane, eve->no, vec);
+ cross_v3_v3v3(plane, eve->no, vec);
}
} else if (ese->type==EDITEDGE) {
EditEdge *eed= ese->data;
@@ -341,41 +341,41 @@ void EM_editselection_plane(float *plane, EditSelection *ese)
(running along the edge).. to flip less often.
at least its more pradictable */
if (eed->v2->co[1] > eed->v1->co[1]) /*check which to do first */
- VecSubf(plane, eed->v2->co, eed->v1->co);
+ sub_v3_v3v3(plane, eed->v2->co, eed->v1->co);
else
- VecSubf(plane, eed->v1->co, eed->v2->co);
+ sub_v3_v3v3(plane, eed->v1->co, eed->v2->co);
} else if (ese->type==EDITFACE) {
EditFace *efa= ese->data;
float vec[3];
if (efa->v4) { /*if its a quad- set the plane along the 2 longest edges.*/
float vecA[3], vecB[3];
- VecSubf(vecA, efa->v4->co, efa->v3->co);
- VecSubf(vecB, efa->v1->co, efa->v2->co);
- VecAddf(plane, vecA, vecB);
+ sub_v3_v3v3(vecA, efa->v4->co, efa->v3->co);
+ sub_v3_v3v3(vecB, efa->v1->co, efa->v2->co);
+ add_v3_v3v3(plane, vecA, vecB);
- VecSubf(vecA, efa->v1->co, efa->v4->co);
- VecSubf(vecB, efa->v2->co, efa->v3->co);
- VecAddf(vec, vecA, vecB);
+ sub_v3_v3v3(vecA, efa->v1->co, efa->v4->co);
+ sub_v3_v3v3(vecB, efa->v2->co, efa->v3->co);
+ add_v3_v3v3(vec, vecA, vecB);
/*use the biggest edge length*/
if (plane[0]*plane[0]+plane[1]*plane[1]+plane[2]*plane[2] < vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2])
- VecCopyf(plane, vec);
+ copy_v3_v3(plane, vec);
} else {
/*start with v1-2 */
- VecSubf(plane, efa->v1->co, efa->v2->co);
+ sub_v3_v3v3(plane, efa->v1->co, efa->v2->co);
/*test the edge between v2-3, use if longer */
- VecSubf(vec, efa->v2->co, efa->v3->co);
+ sub_v3_v3v3(vec, efa->v2->co, efa->v3->co);
if (plane[0]*plane[0]+plane[1]*plane[1]+plane[2]*plane[2] < vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2])
- VecCopyf(plane, vec);
+ copy_v3_v3(plane, vec);
/*test the edge between v1-3, use if longer */
- VecSubf(vec, efa->v3->co, efa->v1->co);
+ sub_v3_v3v3(vec, efa->v3->co, efa->v1->co);
if (plane[0]*plane[0]+plane[1]*plane[1]+plane[2]*plane[2] < vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2])
- VecCopyf(plane, vec);
+ copy_v3_v3(plane, vec);
}
}
- Normalize(plane);
+ normalize_v3(plane);
}
@@ -908,9 +908,9 @@ void EM_free_data_layer(EditMesh *em, CustomData *data, int type)
static void add_normal_aligned(float *nor, float *add)
{
if( INPR(nor, add) < -0.9999f)
- VecSubf(nor, nor, add);
+ sub_v3_v3v3(nor, nor, add);
else
- VecAddf(nor, nor, add);
+ add_v3_v3v3(nor, nor, add);
}
static void set_edge_directions_f2(EditMesh *em, int val)
@@ -1097,7 +1097,7 @@ short extrudeflag_edges_indiv(EditMesh *em, short flag, float *nor)
}
}
}
- Normalize(nor);
+ normalize_v3(nor);
/* set correct selection */
EM_clear_flag_all(em, SELECT);
@@ -1216,20 +1216,20 @@ static short extrudeflag_edge(Object *obedit, EditMesh *em, short flag, float *n
float mtx[4][4];
if (mmd->mirror_ob) {
float imtx[4][4];
- Mat4Invert(imtx, mmd->mirror_ob->obmat);
- Mat4MulMat4(mtx, obedit->obmat, imtx);
+ invert_m4_m4(imtx, mmd->mirror_ob->obmat);
+ mul_m4_m4m4(mtx, obedit->obmat, imtx);
}
for (eed= em->edges.first; eed; eed= eed->next) {
if(eed->f2 == 1) {
float co1[3], co2[3];
- VecCopyf(co1, eed->v1->co);
- VecCopyf(co2, eed->v2->co);
+ copy_v3_v3(co1, eed->v1->co);
+ copy_v3_v3(co2, eed->v2->co);
if (mmd->mirror_ob) {
- VecMat4MulVecfl(co1, mtx, co1);
- VecMat4MulVecfl(co2, mtx, co2);
+ mul_v3_m4v3(co1, mtx, co1);
+ mul_v3_m4v3(co2, mtx, co2);
}
if (mmd->flag & MOD_MIR_AXIS_X)
@@ -1380,7 +1380,7 @@ static short extrudeflag_edge(Object *obedit, EditMesh *em, short flag, float *n
}
}
- Normalize(nor); // translation normal grab
+ normalize_v3(nor); // translation normal grab
/* step 7: redo selection */
EM_clear_flag_all(em, SELECT);
@@ -1503,20 +1503,20 @@ short extrudeflag_vert(Object *obedit, EditMesh *em, short flag, float *nor)
float mtx[4][4];
if (mmd->mirror_ob) {
float imtx[4][4];
- Mat4Invert(imtx, mmd->mirror_ob->obmat);
- Mat4MulMat4(mtx, obedit->obmat, imtx);
+ invert_m4_m4(imtx, mmd->mirror_ob->obmat);
+ mul_m4_m4m4(mtx, obedit->obmat, imtx);
}
for (eed= em->edges.first; eed; eed= eed->next) {
if(eed->f2 == 2) {
float co1[3], co2[3];
- VecCopyf(co1, eed->v1->co);
- VecCopyf(co2, eed->v2->co);
+ copy_v3_v3(co1, eed->v1->co);
+ copy_v3_v3(co2, eed->v2->co);
if (mmd->mirror_ob) {
- VecMat4MulVecfl(co1, mtx, co1);
- VecMat4MulVecfl(co2, mtx, co2);
+ mul_v3_m4v3(co1, mtx, co1);
+ mul_v3_m4v3(co2, mtx, co2);
}
if (mmd->flag & MOD_MIR_AXIS_X)
@@ -1652,7 +1652,7 @@ short extrudeflag_vert(Object *obedit, EditMesh *em, short flag, float *nor)
efa= nextvl;
}
- Normalize(nor); // for grab
+ normalize_v3(nor); // for grab
/* for all vertices with eve->tmp.v!=0
if eve->f1==1: make edge
@@ -1704,7 +1704,7 @@ void rotateflag(EditMesh *em, short flag, float *cent, float rotmat[][3])
eve->co[0]-=cent[0];
eve->co[1]-=cent[1];
eve->co[2]-=cent[2];
- Mat3MulVecfl(rotmat,eve->co);
+ mul_m3_v3(rotmat,eve->co);
eve->co[0]+=cent[0];
eve->co[1]+=cent[1];
eve->co[2]+=cent[2];
@@ -1913,24 +1913,24 @@ void recalc_editnormals(EditMesh *em)
for(efa= em->faces.first; efa; efa=efa->next) {
if(efa->v4) {
- CalcNormFloat4(efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co, efa->n);
- CalcCent4f(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
- VecAddf(efa->v4->no, efa->v4->no, efa->n);
+ normal_quad_v3( efa->n,efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
+ cent_quad_v3(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
+ add_v3_v3v3(efa->v4->no, efa->v4->no, efa->n);
}
else {
- CalcNormFloat(efa->v1->co, efa->v2->co, efa->v3->co, efa->n);
- CalcCent3f(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co);
+ normal_tri_v3( efa->n,efa->v1->co, efa->v2->co, efa->v3->co);
+ cent_tri_v3(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co);
}
- VecAddf(efa->v1->no, efa->v1->no, efa->n);
- VecAddf(efa->v2->no, efa->v2->no, efa->n);
- VecAddf(efa->v3->no, efa->v3->no, efa->n);
+ add_v3_v3v3(efa->v1->no, efa->v1->no, efa->n);
+ add_v3_v3v3(efa->v2->no, efa->v2->no, efa->n);
+ add_v3_v3v3(efa->v3->no, efa->v3->no, efa->n);
}
/* following Mesh convention; we use vertex coordinate itself for normal in this case */
for(eve= em->verts.first; eve; eve=eve->next) {
- if (Normalize(eve->no)==0.0) {
+ if (normalize_v3(eve->no)==0.0) {
VECCOPY(eve->no, eve->co);
- Normalize(eve->no);
+ normalize_v3(eve->no);
}
}
}
@@ -1996,8 +1996,8 @@ int convex(float *v1, float *v2, float *v3, float *v4)
float nor[3], nor1[3], nor2[3], vec[4][2];
/* define projection, do both trias apart, quad is undefined! */
- CalcNormFloat(v1, v2, v3, nor1);
- CalcNormFloat(v1, v3, v4, nor2);
+ normal_tri_v3( nor1,v1, v2, v3);
+ normal_tri_v3( nor2,v1, v3, v4);
nor[0]= ABS(nor1[0]) + ABS(nor2[0]);
nor[1]= ABS(nor1[1]) + ABS(nor2[1]);
nor[2]= ABS(nor1[2]) + ABS(nor2[2]);
@@ -2022,7 +2022,7 @@ int convex(float *v1, float *v2, float *v3, float *v4)
}
/* linetests, the 2 diagonals have to instersect to be convex */
- if( IsectLL2Df(vec[0], vec[2], vec[1], vec[3]) > 0 ) return 1;
+ if( isect_line_line_v2(vec[0], vec[2], vec[1], vec[3]) > 0 ) return 1;
return 0;
}
@@ -2037,22 +2037,22 @@ int convex(float *v1, float *v2, float *v3, float *v4)
float EM_face_area(EditFace *efa)
{
- if(efa->v4) return AreaQ3Dfl(efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
- else return AreaT3Dfl(efa->v1->co, efa->v2->co, efa->v3->co);
+ if(efa->v4) return area_quad_v3(efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
+ else return area_tri_v3(efa->v1->co, efa->v2->co, efa->v3->co);
}
float EM_face_perimeter(EditFace *efa)
{
if(efa->v4) return
- VecLenf(efa->v1->co, efa->v2->co)+
- VecLenf(efa->v2->co, efa->v3->co)+
- VecLenf(efa->v3->co, efa->v4->co)+
- VecLenf(efa->v4->co, efa->v1->co);
+ len_v3v3(efa->v1->co, efa->v2->co)+
+ len_v3v3(efa->v2->co, efa->v3->co)+
+ len_v3v3(efa->v3->co, efa->v4->co)+
+ len_v3v3(efa->v4->co, efa->v1->co);
else return
- VecLenf(efa->v1->co, efa->v2->co)+
- VecLenf(efa->v2->co, efa->v3->co)+
- VecLenf(efa->v3->co, efa->v1->co);
+ len_v3v3(efa->v1->co, efa->v2->co)+
+ len_v3v3(efa->v2->co, efa->v3->co)+
+ len_v3v3(efa->v3->co, efa->v1->co);
}
void EM_fgon_flags(EditMesh *em)
@@ -2240,7 +2240,7 @@ UvVertMap *EM_make_uv_vert_map(EditMesh *em, int selected, int do_face_idx_array
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
uv2 = tf->uv[iterv->tfindex];
- Vec2Subf(uvdiff, uv2, uv);
+ sub_v2_v2v2(uvdiff, uv2, uv);
if(fabs(uv[0]-uv2[0]) < limit[0] && fabs(uv[1]-uv2[1]) < limit[1]) {
if(lastv) lastv->next= next;
diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c
index 3dc9c81a213..fd665f07767 100644
--- a/source/blender/editors/mesh/editmesh_loop.c
+++ b/source/blender/editors/mesh/editmesh_loop.c
@@ -49,7 +49,7 @@ editmesh_loop: tools with own drawing subloops, select, knife, subdiv
#include "DNA_windowmanager_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_ghash.h"
@@ -672,7 +672,7 @@ static int knife_cut_exec(bContext *C, wmOperator *op)
scr = MEM_mallocN(sizeof(float)*2, "Vertex Screen Coordinates");
VECCOPY(co, eve->co);
co[3]= 1.0;
- Mat4MulVec4fl(obedit->obmat, co);
+ mul_m4_v4(obedit->obmat, co);
project_float(ar, co, scr);
BLI_ghash_insert(gh, eve, scr);
eve->f1 = 0; /*store vertex intersection flag here*/
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index 737f658d46f..93bfdb37581 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -53,7 +53,7 @@ editmesh_mods.c, UI level access, no geometry changes
#include "DNA_view3d_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
@@ -488,7 +488,7 @@ static void findnearestedge__doClosest(void *userData, EditEdge *eed, int x0, in
v2[0] = x1;
v2[1] = y1;
- distance= PdistVL2Dfl(data->mval, v1, v2);
+ distance= dist_to_line_segment_v2(data->mval, v1, v2);
if(eed->f & SELECT) distance+=5;
if(distance < data->dist) {
@@ -499,7 +499,7 @@ static void findnearestedge__doClosest(void *userData, EditEdge *eed, int x0, in
vec[0]= eed->v1->co[0] + labda*(eed->v2->co[0] - eed->v1->co[0]);
vec[1]= eed->v1->co[1] + labda*(eed->v2->co[1] - eed->v1->co[1]);
vec[2]= eed->v1->co[2] + labda*(eed->v2->co[2] - eed->v1->co[2]);
- Mat4MulVecfl(data->vc.obedit->obmat, vec);
+ mul_m4_v3(data->vc.obedit->obmat, vec);
if(view3d_test_clipping(data->vc.rv3d, vec)==0) {
data->dist = distance;
@@ -825,7 +825,7 @@ static int similar_face_select__internal(Scene *scene, EditMesh *em, int mode)
float angle;
for(efa= em->faces.first; efa; efa= efa->next) {
if (!(efa->f & SELECT) && !efa->h) {
- angle= RAD2DEG(VecAngle2(base_efa->n, efa->n));
+ angle= RAD2DEG(angle_v2v2(base_efa->n, efa->n));
if (angle/180.0<=thresh) {
EM_select_face(efa, 1);
selcount++;
@@ -837,12 +837,12 @@ static int similar_face_select__internal(Scene *scene, EditMesh *em, int mode)
}
} else if (mode==SIMFACE_COPLANAR) { /* same planer */
float angle, base_dot, dot;
- base_dot= Inpf(base_efa->cent, base_efa->n);
+ base_dot= dot_v3v3(base_efa->cent, base_efa->n);
for(efa= em->faces.first; efa; efa= efa->next) {
if (!(efa->f & SELECT) && !efa->h) {
- angle= RAD2DEG(VecAngle2(base_efa->n, efa->n));
+ angle= RAD2DEG(angle_v2v2(base_efa->n, efa->n));
if (angle/180.0<=thresh) {
- dot=Inpf(efa->cent, base_efa->n);
+ dot=dot_v3v3(efa->cent, base_efa->n);
if (fabs(base_dot-dot) <= thresh) {
EM_select_face(efa, 1);
selcount++;
@@ -916,7 +916,7 @@ static int similar_edge_select__internal(ToolSettings *ts, EditMesh *em, int mod
if (mode==SIMEDGE_LENGTH) { /*store length*/
for(eed= em->edges.first; eed; eed= eed->next) {
if (!eed->h) /* dont calc data for hidden edges*/
- eed->tmp.fp= VecLenf(eed->v1->co, eed->v2->co);
+ eed->tmp.fp= len_v3v3(eed->v1->co, eed->v2->co);
}
} else if (mode==SIMEDGE_FACE) { /*store face users*/
EditFace *efa;
@@ -959,7 +959,7 @@ static int similar_edge_select__internal(ToolSettings *ts, EditMesh *em, int mod
else if (eed->f2==0) /* first access, assign the face */
eed->tmp.f= efa;
else if (eed->f2==1) /* second, we assign the angle*/
- eed->tmp.fp= RAD2DEG(VecAngle2(eed->tmp.f->n, efa->n))/180;
+ eed->tmp.fp= RAD2DEG(angle_v2v2(eed->tmp.f->n, efa->n))/180;
eed->f2++; /* f2==0 no face assigned. f2==1 one face found. f2==2 angle calculated.*/
}
j++;
@@ -985,11 +985,11 @@ static int similar_edge_select__internal(ToolSettings *ts, EditMesh *em, int mod
}
} else if (mode==SIMEDGE_DIR) { /* same direction */
float base_dir[3], dir[3], angle;
- VecSubf(base_dir, base_eed->v1->co, base_eed->v2->co);
+ sub_v3_v3v3(base_dir, base_eed->v1->co, base_eed->v2->co);
for(eed= em->edges.first; eed; eed= eed->next) {
if (!(eed->f & SELECT) && !eed->h) {
- VecSubf(dir, eed->v1->co, eed->v2->co);
- angle= RAD2DEG(VecAngle2(base_dir, dir));
+ sub_v3_v3v3(dir, eed->v1->co, eed->v2->co);
+ angle= RAD2DEG(angle_v2v2(base_dir, dir));
if (angle>90) /* use the smallest angle between the edges */
angle= fabs(angle-180.0f);
@@ -1161,7 +1161,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
float angle;
for(eve= em->verts.first; eve; eve= eve->next) {
if (!(eve->f & SELECT) && !eve->h) {
- angle= RAD2DEG(VecAngle2(base_eve->no, eve->no));
+ angle= RAD2DEG(angle_v2v2(base_eve->no, eve->no));
if (angle/180.0<=thresh) {
eve->f |= SELECT;
selcount++;
@@ -1388,34 +1388,34 @@ void EM_mesh_copy_edge(EditMesh *em, short type)
break;
case 3: /* copy length */
- eed_len_act = VecLenf(eed_act->v1->co, eed_act->v2->co);
+ eed_len_act = len_v3v3(eed_act->v1->co, eed_act->v2->co);
for(eed=em->edges.first; eed; eed=eed->next) {
if (eed->f & SELECT && eed != eed_act) {
- eed_len = VecLenf(eed->v1->co, eed->v2->co);
+ eed_len = len_v3v3(eed->v1->co, eed->v2->co);
if (eed_len == eed_len_act) continue;
/* if this edge is zero length we cont do anything with it*/
if (eed_len == 0.0f) continue;
if (eed_len_act == 0.0f) {
- VecAddf(vec_mid, eed->v1->co, eed->v2->co);
- VecMulf(vec_mid, 0.5);
+ add_v3_v3v3(vec_mid, eed->v1->co, eed->v2->co);
+ mul_v3_fl(vec_mid, 0.5);
VECCOPY(eed->v1->co, vec_mid);
VECCOPY(eed->v2->co, vec_mid);
} else {
/* copy the edge length */
- VecAddf(vec_mid, eed->v1->co, eed->v2->co);
- VecMulf(vec_mid, 0.5);
+ add_v3_v3v3(vec_mid, eed->v1->co, eed->v2->co);
+ mul_v3_fl(vec_mid, 0.5);
/* SCALE 1 */
- VecSubf(vec, eed->v1->co, vec_mid);
- VecMulf(vec, eed_len_act/eed_len);
- VecAddf(eed->v1->co, vec, vec_mid);
+ sub_v3_v3v3(vec, eed->v1->co, vec_mid);
+ mul_v3_fl(vec, eed_len_act/eed_len);
+ add_v3_v3v3(eed->v1->co, vec, vec_mid);
/* SCALE 2 */
- VecSubf(vec, eed->v2->co, vec_mid);
- VecMulf(vec, eed_len_act/eed_len);
- VecAddf(eed->v2->co, vec, vec_mid);
+ sub_v3_v3v3(vec, eed->v2->co, vec_mid);
+ mul_v3_fl(vec, eed_len_act/eed_len);
+ add_v3_v3v3(eed->v2->co, vec, vec_mid);
}
change = 1;
}
@@ -3873,7 +3873,7 @@ void righthandfaces(EditMesh *em, int select) /* makes faces righthand turning *
while(efa) {
if(efa->f1) {
- CalcCent3f(cent, efa->v1->co, efa->v2->co, efa->v3->co);
+ cent_tri_v3(cent, efa->v1->co, efa->v2->co, efa->v3->co);
cent[0]= cent[0]*cent[0] + cent[1]*cent[1] + cent[2]*cent[2];
if(cent[0]>maxx) {
@@ -3882,7 +3882,7 @@ void righthandfaces(EditMesh *em, int select) /* makes faces righthand turning *
tria_nr= 0;
}
if(efa->v4) {
- CalcCent3f(cent, efa->v1->co, efa->v3->co, efa->v4->co);
+ cent_tri_v3(cent, efa->v1->co, efa->v3->co, efa->v4->co);
cent[0]= cent[0]*cent[0] + cent[1]*cent[1] + cent[2]*cent[2];
if(cent[0]>maxx) {
@@ -3901,11 +3901,11 @@ void righthandfaces(EditMesh *em, int select) /* makes faces righthand turning *
/* set first face correct: calc normal */
if(tria_nr==1) {
- CalcNormFloat(startvl->v1->co, startvl->v3->co, startvl->v4->co, nor);
- CalcCent3f(cent, startvl->v1->co, startvl->v3->co, startvl->v4->co);
+ normal_tri_v3( nor,startvl->v1->co, startvl->v3->co, startvl->v4->co);
+ cent_tri_v3(cent, startvl->v1->co, startvl->v3->co, startvl->v4->co);
} else {
- CalcNormFloat(startvl->v1->co, startvl->v2->co, startvl->v3->co, nor);
- CalcCent3f(cent, startvl->v1->co, startvl->v2->co, startvl->v3->co);
+ normal_tri_v3( nor,startvl->v1->co, startvl->v2->co, startvl->v3->co);
+ cent_tri_v3(cent, startvl->v1->co, startvl->v2->co, startvl->v3->co);
}
/* first normal is oriented this way or the other */
if(select) {
@@ -4115,9 +4115,9 @@ void faceselect_align_view_to_selected(View3D *v3d, RegionView3D *rv3d, Mesh *me
v3= me->mvert[mf->v3].co;
if (mf->v4) {
float *v4= me->mvert[mf->v4].co;
- CalcNormFloat4(v1, v2, v3, v4, fno);
+ normal_quad_v3( fno,v1, v2, v3, v4);
} else {
- CalcNormFloat(v1, v2, v3, fno);
+ normal_tri_v3( fno,v1, v2, v3);
}
norm[0]+= fno[0];
@@ -4140,18 +4140,18 @@ static void face_getnormal_obspace(Object *obedit, EditFace *efa, float *fno)
float vec[4][3];
VECCOPY(vec[0], efa->v1->co);
- Mat4Mul3Vecfl(obedit->obmat, vec[0]);
+ mul_mat3_m4_v3(obedit->obmat, vec[0]);
VECCOPY(vec[1], efa->v2->co);
- Mat4Mul3Vecfl(obedit->obmat, vec[1]);
+ mul_mat3_m4_v3(obedit->obmat, vec[1]);
VECCOPY(vec[2], efa->v3->co);
- Mat4Mul3Vecfl(obedit->obmat, vec[2]);
+ mul_mat3_m4_v3(obedit->obmat, vec[2]);
if(efa->v4) {
VECCOPY(vec[3], efa->v4->co);
- Mat4Mul3Vecfl(obedit->obmat, vec[3]);
+ mul_mat3_m4_v3(obedit->obmat, vec[3]);
- CalcNormFloat4(vec[0], vec[1], vec[2], vec[3], fno);
+ normal_quad_v3( fno,vec[0], vec[1], vec[2], vec[3]);
}
- else CalcNormFloat(vec[0], vec[1], vec[2], fno);
+ else normal_tri_v3( fno,vec[0], vec[1], vec[2]);
}
@@ -4187,7 +4187,7 @@ void editmesh_align_view_to_selected(Object *obedit, EditMesh *em, wmOperator *o
if (eve->f & SELECT) {
if (leve) {
float tno[3];
- CalcNormFloat(cent, leve->co, eve->co, tno);
+ normal_tri_v3( tno,cent, leve->co, eve->co);
/* XXX, fixme, should be flipped intp a
* consistent direction. -zr
@@ -4200,7 +4200,7 @@ void editmesh_align_view_to_selected(Object *obedit, EditMesh *em, wmOperator *o
}
}
- Mat4Mul3Vecfl(obedit->obmat, norm);
+ mul_mat3_m4_v3(obedit->obmat, norm);
view3d_align_axis_to_vector(v3d, rv3d, axis, norm);
}
else if (nselverts==2) { /* Align view to edge (or 2 verts) */
@@ -4217,7 +4217,7 @@ void editmesh_align_view_to_selected(Object *obedit, EditMesh *em, wmOperator *o
leve= eve;
}
}
- Mat4Mul3Vecfl(obedit->obmat, norm);
+ mul_mat3_m4_v3(obedit->obmat, norm);
view3d_align_axis_to_vector(v3d, rv3d, axis, norm);
}
else if (nselverts==1) { /* Align view to vert normal */
@@ -4231,7 +4231,7 @@ void editmesh_align_view_to_selected(Object *obedit, EditMesh *em, wmOperator *o
break; /* we know this is the only selected vert, so no need to keep looking */
}
}
- Mat4Mul3Vecfl(obedit->obmat, norm);
+ mul_mat3_m4_v3(obedit->obmat, norm);
view3d_align_axis_to_vector(v3d, rv3d, axis, norm);
}
}
@@ -4312,11 +4312,11 @@ static int smooth_vertex(bContext *C, wmOperator *op)
if((eed->v1->f & SELECT) && eed->v1->f1<255) {
eed->v1->f1++;
- VecAddf(eed->v1->tmp.p, eed->v1->tmp.p, fvec);
+ add_v3_v3v3(eed->v1->tmp.p, eed->v1->tmp.p, fvec);
}
if((eed->v2->f & SELECT) && eed->v2->f1<255) {
eed->v2->f1++;
- VecAddf(eed->v2->tmp.p, eed->v2->tmp.p, fvec);
+ add_v3_v3v3(eed->v2->tmp.p, eed->v2->tmp.p, fvec);
}
}
eed= eed->next;
@@ -4435,7 +4435,7 @@ void vertexnoise(Object *obedit, EditMesh *em)
vec[1]= 0.2*(b2-BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1]+ofs, eve->co[2]));
vec[2]= 0.2*(b2-BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]+ofs));
- VecAddf(eve->co, eve->co, vec);
+ add_v3_v3v3(eve->co, eve->co, vec);
}
else {
float tin, dum;
@@ -4466,8 +4466,8 @@ void flipface(EditMesh *em, EditFace *efa)
EM_data_interp_from_faces(em, efa, NULL, efa, 0, 2, 1, 3);
}
- if(efa->v4) CalcNormFloat4(efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co, efa->n);
- else CalcNormFloat(efa->v1->co, efa->v2->co, efa->v3->co, efa->n);
+ if(efa->v4) normal_quad_v3( efa->n,efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
+ else normal_tri_v3( efa->n,efa->v1->co, efa->v2->co, efa->v3->co);
}
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index cea7ec33d3a..c59fb01ec99 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -58,7 +58,7 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise
#include "RNA_access.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
#include "BLI_ghash.h"
@@ -150,7 +150,7 @@ static void convert_to_triface(EditMesh *em, int direction)
if(efa->v4) {
if(efa->f & SELECT) {
/* choose shortest diagonal for split */
- fac= VecLenf(efa->v1->co, efa->v3->co) - VecLenf(efa->v2->co, efa->v4->co);
+ fac= len_v3v3(efa->v1->co, efa->v3->co) - len_v3v3(efa->v2->co, efa->v4->co);
/* this makes sure exact squares get split different in both cases */
if( (direction==0 && fac<FLT_EPSILON) || (direction && fac>0.0f) ) {
efan= EM_face_from_faces(em, efa, NULL, 0, 1, 2, -1);
@@ -689,8 +689,8 @@ void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op)
else {
// initTransform(TFM_TRANSLATION, CTX_NO_PET|CTX_NO_MIRROR);
if(transmode=='n') {
- Mat4MulVecfl(obedit->obmat, nor);
- VecSubf(nor, nor, obedit->obmat[3]);
+ mul_m4_v3(obedit->obmat, nor);
+ sub_v3_v3v3(nor, nor, obedit->obmat[3]);
// BIF_setSingleAxisConstraint(nor, "along normal");
}
// Transform();
@@ -816,15 +816,15 @@ static int extrude_repeat_mesh(bContext *C, wmOperator *op)
dvec[0]= rv3d->persinv[2][0];
dvec[1]= rv3d->persinv[2][1];
dvec[2]= rv3d->persinv[2][2];
- Normalize(dvec);
+ normalize_v3(dvec);
dvec[0]*= offs;
dvec[1]*= offs;
dvec[2]*= offs;
/* base correction */
- Mat3CpyMat4(bmat, obedit->obmat);
- Mat3Inv(tmat, bmat);
- Mat3MulVecfl(tmat, dvec);
+ copy_m3_m4(bmat, obedit->obmat);
+ invert_m3_m3(tmat, bmat);
+ mul_m3_v3(tmat, dvec);
for(a=0; a<steps; a++) {
extrudeflag(obedit, em, SELECT, nor);
@@ -879,30 +879,30 @@ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float
RNA_float_get_array(op->ptr, "center", cent);
/* imat and center and size */
- Mat3CpyMat4(bmat, obedit->obmat);
- Mat3Inv(imat,bmat);
+ copy_m3_m4(bmat, obedit->obmat);
+ invert_m3_m3(imat,bmat);
cent[0]-= obedit->obmat[3][0];
cent[1]-= obedit->obmat[3][1];
cent[2]-= obedit->obmat[3][2];
- Mat3MulVecfl(imat, cent);
+ mul_m3_v3(imat, cent);
phi= degr*M_PI/360.0;
phi/= steps;
if(ts->editbutflag & B_CLOCKWISE) phi= -phi;
RNA_float_get_array(op->ptr, "axis", n);
- Normalize(n);
+ normalize_v3(n);
q[0]= (float)cos(phi);
si= (float)sin(phi);
q[1]= n[0]*si;
q[2]= n[1]*si;
q[3]= n[2]*si;
- QuatToMat3(q, cmat);
+ quat_to_mat3( cmat,q);
- Mat3MulMat3(tmat,cmat,bmat);
- Mat3MulMat3(bmat,imat,tmat);
+ mul_m3_m3m3(tmat,cmat,bmat);
+ mul_m3_m3m3(bmat,imat,tmat);
if(dupli==0)
if(ts->editbutflag & B_KEEPORIG)
@@ -917,7 +917,7 @@ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float
rotateflag(em, SELECT, cent, bmat);
if(dvec) {
- Mat3MulVecfl(bmat,dvec);
+ mul_m3_v3(bmat,dvec);
translateflag(em, SELECT, dvec);
}
}
@@ -1362,8 +1362,8 @@ static void alter_co(float *co, EditEdge *edge, float smooth, float fractal, int
/* we calculate an offset vector vec1[], to be added to *co */
float len, fac, nor[3], nor1[3], nor2[3];
- VecSubf(nor, edge->v1->co, edge->v2->co);
- len= 0.5f*Normalize(nor);
+ sub_v3_v3v3(nor, edge->v1->co, edge->v2->co);
+ len= 0.5f*normalize_v3(nor);
VECCOPY(nor1, edge->v1->no);
VECCOPY(nor2, edge->v2->no);
@@ -1394,18 +1394,18 @@ static void alter_co(float *co, EditEdge *edge, float smooth, float fractal, int
co[2] += vec1[2];
}
else if(beauty & B_SPHERE) { /* subdivide sphere */
- Normalize(co);
+ normalize_v3(co);
co[0]*= smooth;
co[1]*= smooth;
co[2]*= smooth;
}
if(beauty & B_FRACTAL) {
- fac= fractal*VecLenf(edge->v1->co, edge->v2->co);
+ fac= fractal*len_v3v3(edge->v1->co, edge->v2->co);
vec1[0]= fac*(float)(0.5-BLI_drand());
vec1[1]= fac*(float)(0.5-BLI_drand());
vec1[2]= fac*(float)(0.5-BLI_drand());
- VecAddf(co, co, vec1);
+ add_v3_v3v3(co, co, vec1);
}
}
@@ -1446,7 +1446,7 @@ static EditVert *subdivide_edge_addvert(EditMesh *em, EditEdge *edge, float smoo
ev->no[0] = (edge->v2->no[0]-edge->v1->no[0])*percent + edge->v1->no[0];
ev->no[1] = (edge->v2->no[1]-edge->v1->no[1])*percent + edge->v1->no[1];
ev->no[2] = (edge->v2->no[2]-edge->v1->no[2])*percent + edge->v1->no[2];
- Normalize(ev->no);
+ normalize_v3(ev->no);
return ev;
}
@@ -1475,11 +1475,11 @@ static void facecopy(EditMesh *em, EditFace *source, EditFace *target)
target->flag = source->flag;
target->h = source->h;
- InterpWeightsQ3Dfl(v1, v2, v3, v4, target->v1->co, w[0]);
- InterpWeightsQ3Dfl(v1, v2, v3, v4, target->v2->co, w[1]);
- InterpWeightsQ3Dfl(v1, v2, v3, v4, target->v3->co, w[2]);
+ interp_weights_face_v3( w[0],v1, v2, v3, v4, target->v1->co);
+ interp_weights_face_v3( w[1],v1, v2, v3, v4, target->v2->co);
+ interp_weights_face_v3( w[2],v1, v2, v3, v4, target->v3->co);
if (target->v4)
- InterpWeightsQ3Dfl(v1, v2, v3, v4, target->v4->co, w[3]);
+ interp_weights_face_v3( w[3],v1, v2, v3, v4, target->v4->co);
CustomData_em_interp(&em->fdata, &source->data, NULL, (float*)w, 1, target->data);
}
@@ -2623,15 +2623,15 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float smooth, float
VECCOPY(v2mat, ef->v2->co);
VECCOPY(v3mat, ef->v3->co);
VECCOPY(v4mat, ef->v4->co);
- Mat4Mul3Vecfl(obedit->obmat, v1mat);
- Mat4Mul3Vecfl(obedit->obmat, v2mat);
- Mat4Mul3Vecfl(obedit->obmat, v3mat);
- Mat4Mul3Vecfl(obedit->obmat, v4mat);
-
- length[0] = VecLenf(v1mat, v2mat);
- length[1] = VecLenf(v2mat, v3mat);
- length[2] = VecLenf(v3mat, v4mat);
- length[3] = VecLenf(v4mat, v1mat);
+ mul_mat3_m4_v3(obedit->obmat, v1mat);
+ mul_mat3_m4_v3(obedit->obmat, v2mat);
+ mul_mat3_m4_v3(obedit->obmat, v3mat);
+ mul_mat3_m4_v3(obedit->obmat, v4mat);
+
+ length[0] = len_v3v3(v1mat, v2mat);
+ length[1] = len_v3v3(v2mat, v3mat);
+ length[2] = len_v3v3(v3mat, v4mat);
+ length[3] = len_v3v3(v4mat, v1mat);
sort[0] = ef->e1;
sort[1] = ef->e2;
sort[2] = ef->e3;
@@ -3121,43 +3121,43 @@ static float measure_facepair(EditVert *v1, EditVert *v2, EditVert *v3, EditVert
minarea, maxarea, areaA, areaB;
/*First Test: Normal difference*/
- CalcNormFloat(v1->co, v2->co, v3->co, noA1);
- CalcNormFloat(v1->co, v3->co, v4->co, noA2);
+ normal_tri_v3( noA1,v1->co, v2->co, v3->co);
+ normal_tri_v3( noA2,v1->co, v3->co, v4->co);
if(noA1[0] == noA2[0] && noA1[1] == noA2[1] && noA1[2] == noA2[2]) normalADiff = 0.0;
- else normalADiff = RAD2DEG(VecAngle2(noA1, noA2));
+ else normalADiff = RAD2DEG(angle_v2v2(noA1, noA2));
//if(!normalADiff) normalADiff = 179;
- CalcNormFloat(v2->co, v3->co, v4->co, noB1);
- CalcNormFloat(v4->co, v1->co, v2->co, noB2);
+ normal_tri_v3( noB1,v2->co, v3->co, v4->co);
+ normal_tri_v3( noB2,v4->co, v1->co, v2->co);
if(noB1[0] == noB2[0] && noB1[1] == noB2[1] && noB1[2] == noB2[2]) normalBDiff = 0.0;
- else normalBDiff = RAD2DEG(VecAngle2(noB1, noB2));
+ else normalBDiff = RAD2DEG(angle_v2v2(noB1, noB2));
//if(!normalBDiff) normalBDiff = 179;
measure += (normalADiff/360) + (normalBDiff/360);
if(measure > limit) return measure;
/*Second test: Colinearity*/
- VecSubf(edgeVec1, v1->co, v2->co);
- VecSubf(edgeVec2, v2->co, v3->co);
- VecSubf(edgeVec3, v3->co, v4->co);
- VecSubf(edgeVec4, v4->co, v1->co);
+ sub_v3_v3v3(edgeVec1, v1->co, v2->co);
+ sub_v3_v3v3(edgeVec2, v2->co, v3->co);
+ sub_v3_v3v3(edgeVec3, v3->co, v4->co);
+ sub_v3_v3v3(edgeVec4, v4->co, v1->co);
diff = 0.0;
diff = (
- fabs(RAD2DEG(VecAngle2(edgeVec1, edgeVec2)) - 90) +
- fabs(RAD2DEG(VecAngle2(edgeVec2, edgeVec3)) - 90) +
- fabs(RAD2DEG(VecAngle2(edgeVec3, edgeVec4)) - 90) +
- fabs(RAD2DEG(VecAngle2(edgeVec4, edgeVec1)) - 90)) / 360;
+ fabs(RAD2DEG(angle_v2v2(edgeVec1, edgeVec2)) - 90) +
+ fabs(RAD2DEG(angle_v2v2(edgeVec2, edgeVec3)) - 90) +
+ fabs(RAD2DEG(angle_v2v2(edgeVec3, edgeVec4)) - 90) +
+ fabs(RAD2DEG(angle_v2v2(edgeVec4, edgeVec1)) - 90)) / 360;
if(!diff) return 0.0;
measure += diff;
if(measure > limit) return measure;
/*Third test: Concavity*/
- areaA = AreaT3Dfl(v1->co, v2->co, v3->co) + AreaT3Dfl(v1->co, v3->co, v4->co);
- areaB = AreaT3Dfl(v2->co, v3->co, v4->co) + AreaT3Dfl(v4->co, v1->co, v2->co);
+ areaA = area_tri_v3(v1->co, v2->co, v3->co) + area_tri_v3(v1->co, v3->co, v4->co);
+ areaB = area_tri_v3(v2->co, v3->co, v4->co) + area_tri_v3(v4->co, v1->co, v2->co);
if(areaA <= areaB) minarea = areaA;
else minarea = areaB;
@@ -4370,9 +4370,9 @@ useless:
}
if(prop == 0) {
- len = VecLenf(upVert->co,downVert->co)*((perc+1)/2);
+ len = len_v3v3(upVert->co,downVert->co)*((perc+1)/2);
if(flip == 1) {
- len = VecLenf(upVert->co,downVert->co) - len;
+ len = len_v3v3(upVert->co,downVert->co) - len;
}
}
@@ -4387,7 +4387,7 @@ useless:
}
else
{
- len = MIN2(perc, VecLenf(upVert->co,downVert->co));
+ len = MIN2(perc, len_v3v3(upVert->co,downVert->co));
len = MAX2(len, 0);
}
}
@@ -4405,13 +4405,13 @@ useless:
tempsv = BLI_ghash_lookup(vertgh,ev);
tempev = editedge_getOtherVert((perc>=0)?tempsv->up:tempsv->down, ev);
- VecLerpf(ev->co, tempsv->origvert.co, tempev->co, fabs(perc));
+ interp_v3_v3v3(ev->co, tempsv->origvert.co, tempev->co, fabs(perc));
if (0) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
- Vec2Lerpf(uv_tmp, suv->origuv, (perc>=0)?suv->uv_up:suv->uv_down, fabs(perc));
+ interp_v2_v2v2(uv_tmp, suv->origuv, (perc>=0)?suv->uv_up:suv->uv_down, fabs(perc));
fuv_link = suv->fuv_list;
while (fuv_link) {
VECCOPY2D(((float *)fuv_link->link), uv_tmp);
@@ -4431,17 +4431,17 @@ useless:
float newlen;
ev = look->link;
tempsv = BLI_ghash_lookup(vertgh,ev);
- newlen = (len / VecLenf(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co));
+ newlen = (len / len_v3v3(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co));
if(newlen > 1.0) {newlen = 1.0;}
if(newlen < 0.0) {newlen = 0.0;}
if(flip == 0) {
- VecLerpf(ev->co, editedge_getOtherVert(tempsv->down,ev)->co, editedge_getOtherVert(tempsv->up,ev)->co, fabs(newlen));
+ interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->down,ev)->co, editedge_getOtherVert(tempsv->up,ev)->co, fabs(newlen));
if (0) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
/* dont do anything if no UVs */
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
- Vec2Lerpf(uv_tmp, suv->uv_down, suv->uv_up, fabs(newlen));
+ interp_v2_v2v2(uv_tmp, suv->uv_down, suv->uv_up, fabs(newlen));
fuv_link = suv->fuv_list;
while (fuv_link) {
VECCOPY2D(((float *)fuv_link->link), uv_tmp);
@@ -4451,14 +4451,14 @@ useless:
}
}
} else{
- VecLerpf(ev->co, editedge_getOtherVert(tempsv->up,ev)->co, editedge_getOtherVert(tempsv->down,ev)->co, fabs(newlen));
+ interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->up,ev)->co, editedge_getOtherVert(tempsv->down,ev)->co, fabs(newlen));
if (0) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
/* dont do anything if no UVs */
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
- Vec2Lerpf(uv_tmp, suv->uv_up, suv->uv_down, fabs(newlen));
+ interp_v2_v2v2(uv_tmp, suv->uv_up, suv->uv_down, fabs(newlen));
fuv_link = suv->fuv_list;
while (fuv_link) {
VECCOPY2D(((float *)fuv_link->link), uv_tmp);
@@ -4768,7 +4768,7 @@ static float mesh_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *c
mvalf[0]= (float)mval[0];
mvalf[1]= (float)mval[1];
- return PdistVL2Dfl(mvalf, vec1, vec2);
+ return dist_to_line_segment_v2(mvalf, vec1, vec2);
}
/* helper for below */
@@ -5120,11 +5120,11 @@ static int blend_from_shape_exec(bContext *C, wmOperator *op)
VECCOPY(co, data + eve->keyindex*3);
if(add) {
- VecMulf(co, blend);
- VecAddf(eve->co, eve->co, co);
+ mul_v3_fl(co, blend);
+ add_v3_v3v3(eve->co, eve->co, co);
}
else
- VecLerpf(eve->co, eve->co, co, blend);
+ interp_v3_v3v3(eve->co, eve->co, co, blend);
blended= 1;
}
@@ -5737,7 +5737,7 @@ static void em_snap_to_center(EditMesh *em)
for (eve=em->verts.first; eve; eve=eve->next) {
if (eve->f & SELECT) {
- VecAddf(cent, cent, eve->co);
+ add_v3_v3v3(cent, cent, eve->co);
i++;
}
}
@@ -5745,7 +5745,7 @@ static void em_snap_to_center(EditMesh *em)
if (!i)
return;
- VecMulf(cent, 1.0f / (float)i);
+ mul_v3_fl(cent, 1.0f / (float)i);
for (eve=em->verts.first; eve; eve=eve->next) {
if (eve->f & SELECT) {
@@ -5762,11 +5762,11 @@ static void em_snap_to_cursor(EditMesh *em, bContext *C)
EditVert *eve;
float co[3], *vco, invmat[4][4];
- Mat4Invert(invmat, ob->obmat);
+ invert_m4_m4(invmat, ob->obmat);
vco = give_cursor(scene, v3d);
VECCOPY(co, vco);
- Mat4MulVecfl(invmat, co);
+ mul_m4_v3(invmat, co);
for (eve=em->verts.first; eve; eve=eve->next) {
if (eve->f & SELECT) {
@@ -5987,7 +5987,7 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op)
newpe = MEM_mallocN(sizeof(PathEdge), "Path Edge");
newpe->v = ((PathNode*)eed->v2->tmp.p)->u;
if(physical){
- newpe->w = VecLenf(eed->v1->co, eed->v2->co);
+ newpe->w = len_v3v3(eed->v1->co, eed->v2->co);
}
else newpe->w = 1;
newpe->next = 0;
@@ -5999,7 +5999,7 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op)
newpe = MEM_mallocN(sizeof(PathEdge), "Path Edge");
newpe->v = ((PathNode*)eed->v1->tmp.p)->u;
if(physical){
- newpe->w = VecLenf(eed->v1->co, eed->v2->co);
+ newpe->w = len_v3v3(eed->v1->co, eed->v2->co);
}
else newpe->w = 1;
newpe->next = 0;
@@ -6813,20 +6813,20 @@ static void beauty_fill(EditMesh *em)
* the area divided by the total edge lengths
*/
- len1= VecLenf(v1->co, v2->co);
- len2= VecLenf(v2->co, v3->co);
- len3= VecLenf(v3->co, v4->co);
- len4= VecLenf(v4->co, v1->co);
- len5= VecLenf(v1->co, v3->co);
- len6= VecLenf(v2->co, v4->co);
+ len1= len_v3v3(v1->co, v2->co);
+ len2= len_v3v3(v2->co, v3->co);
+ len3= len_v3v3(v3->co, v4->co);
+ len4= len_v3v3(v4->co, v1->co);
+ len5= len_v3v3(v1->co, v3->co);
+ len6= len_v3v3(v2->co, v4->co);
- opp1= AreaT3Dfl(v1->co, v2->co, v3->co);
- opp2= AreaT3Dfl(v1->co, v3->co, v4->co);
+ opp1= area_tri_v3(v1->co, v2->co, v3->co);
+ opp2= area_tri_v3(v1->co, v3->co, v4->co);
fac1= opp1/(len1+len2+len5) + opp2/(len3+len4+len5);
- opp1= AreaT3Dfl(v2->co, v3->co, v4->co);
- opp2= AreaT3Dfl(v2->co, v4->co, v1->co);
+ opp1= area_tri_v3(v2->co, v3->co, v4->co);
+ opp2= area_tri_v3(v2->co, v4->co, v1->co);
fac2= opp1/(len2+len3+len6) + opp2/(len4+len1+len6);
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index f786a4a6c0b..eb6927cec65 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -50,7 +50,7 @@
#include "BKE_mesh.h"
#include "BKE_report.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_edgehash.h"
@@ -571,7 +571,7 @@ void ED_mesh_transform(Mesh *me, float *mat)
MVert *mvert= me->mvert;
for(i= 0; i < me->totvert; i++, mvert++)
- Mat4MulVecfl((float (*)[4])mat, mvert->co);
+ mul_m4_v3((float (*)[4])mat, mvert->co);
mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
}
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 9f16e7adbf8..ffa9dde4493 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -39,7 +39,7 @@
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 18125207eca..5313b68be9b 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -51,7 +51,7 @@
#include "DNA_windowmanager_types.h"
#include "DNA_world_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_ghash.h"
@@ -305,7 +305,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
faceofs= 0;
/* inverse transform for all selected meshes in this object */
- Mat4Invert(imat, ob->obmat);
+ invert_m4_m4(imat, ob->obmat);
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
/* only join if this is a mesh */
@@ -342,11 +342,11 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* if this is the object we're merging into, no need to do anything */
if(base->object != ob) {
/* watch this: switch matmul order really goes wrong */
- Mat4MulMat4(cmat, base->object->obmat, imat);
+ mul_m4_m4m4(cmat, base->object->obmat, imat);
/* transform vertex coordinates into new space */
for(a=0, mv=mvert; a < me->totvert; a++, mv++) {
- Mat4MulVecfl(cmat, mv->co);
+ mul_m4_v3(cmat, mv->co);
}
/* for each shapekey in destination mesh:
@@ -366,7 +366,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
fp2= ((float *)(okb->data));
for(a=0; a < me->totvert; a++, fp1+=3, fp2+=3) {
VECCOPY(fp1, fp2);
- Mat4MulVecfl(cmat, fp1);
+ mul_m4_v3(cmat, fp1);
}
}
else {
@@ -633,15 +633,15 @@ void sort_faces(Scene *scene, View3D *v3d)
float cur[3];
if (event == 1)
- Mat4MulMat4(mat, OBACT->obmat, rv3d->viewmat); /* apply the view matrix to the object matrix */
+ mul_m4_m4m4(mat, OBACT->obmat, rv3d->viewmat); /* apply the view matrix to the object matrix */
else if (event == 2) { /* sort from cursor */
if( v3d && v3d->localvd ) {
VECCOPY(cur, v3d->cursor);
} else {
VECCOPY(cur, scene->cursor);
}
- Mat4Invert(mat, OBACT->obmat);
- Mat4MulVecfl(mat, cur);
+ invert_m4_m4(mat, OBACT->obmat);
+ mul_m4_v3(mat, cur);
}
mf= me->mface;
@@ -655,21 +655,21 @@ void sort_faces(Scene *scene, View3D *v3d)
else face_sort_floats[i] = reverse;
} else {
/* find the faces center */
- VecAddf(vec, (me->mvert+mf->v1)->co, (me->mvert+mf->v2)->co);
+ add_v3_v3v3(vec, (me->mvert+mf->v1)->co, (me->mvert+mf->v2)->co);
if (mf->v4) {
- VecAddf(vec, vec, (me->mvert+mf->v3)->co);
- VecAddf(vec, vec, (me->mvert+mf->v4)->co);
- VecMulf(vec, 0.25f);
+ add_v3_v3v3(vec, vec, (me->mvert+mf->v3)->co);
+ add_v3_v3v3(vec, vec, (me->mvert+mf->v4)->co);
+ mul_v3_fl(vec, 0.25f);
} else {
- VecAddf(vec, vec, (me->mvert+mf->v3)->co);
- VecMulf(vec, 1.0f/3.0f);
+ add_v3_v3v3(vec, vec, (me->mvert+mf->v3)->co);
+ mul_v3_fl(vec, 1.0f/3.0f);
} /* done */
if (event == 1) { /* sort on view axis */
- Mat4MulVecfl(mat, vec);
+ mul_m4_v3(mat, vec);
face_sort_floats[i] = vec[2] * reverse;
} else { /* distance from cursor*/
- face_sort_floats[i] = VecLenf(cur, vec) * reverse; /* back to front */
+ face_sort_floats[i] = len_v3v3(cur, vec) * reverse; /* back to front */
}
}
}
@@ -811,12 +811,12 @@ static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, float *co)
/* does mesh verts and editmode, code looks potential dangerous, octree should really be filled OK! */
if(mvert) {
vec= (mvert+(*bt)->index[a]-1)->co;
- if(FloatCompare(vec, co, MOC_THRESH))
+ if(compare_v3v3(vec, co, MOC_THRESH))
return (*bt)->index[a]-1;
}
else {
EditVert *eve= (EditVert *)((*bt)->index[a]);
- if(FloatCompare(eve->co, co, MOC_THRESH))
+ if(compare_v3v3(eve->co, co, MOC_THRESH))
return (*bt)->index[a];
}
}
@@ -881,12 +881,12 @@ intptr_t mesh_octree_table(Object *ob, EditMesh *em, float *co, char mode)
MeshOctree.offs[1]-= MOC_THRESH;
MeshOctree.offs[2]-= MOC_THRESH;
- VecSubf(MeshOctree.div, max, min);
+ sub_v3_v3v3(MeshOctree.div, max, min);
MeshOctree.div[0]+= 2*MOC_THRESH; /* and divide with 2 threshold unit more extra (try 8x8 unit grid on paint) */
MeshOctree.div[1]+= 2*MOC_THRESH;
MeshOctree.div[2]+= 2*MOC_THRESH;
- VecMulf(MeshOctree.div, 1.0f/MOC_RES);
+ mul_v3_fl(MeshOctree.div, 1.0f/MOC_RES);
if(MeshOctree.div[0]==0.0f) MeshOctree.div[0]= 1.0f;
if(MeshOctree.div[1]==0.0f) MeshOctree.div[1]= 1.0f;
if(MeshOctree.div[2]==0.0f) MeshOctree.div[2]= 1.0f;
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index f335e47188f..3751f8875f6 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -37,7 +37,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "DNA_meta_types.h"
@@ -116,7 +116,7 @@ MetaElem *add_metaball_primitive(bContext *C, int type, int newname)
ml= ml->next;
}
- Mat3CpyMat4(mat, obedit->obmat);
+ copy_m3_m4(mat, obedit->obmat);
if(v3d) {
curs= give_cursor(scene, v3d);
VECCOPY(cent, curs);
@@ -130,16 +130,16 @@ MetaElem *add_metaball_primitive(bContext *C, int type, int newname)
if (rv3d) {
if (!(newname) || U.flag & USER_ADD_VIEWALIGNED)
- Mat3CpyMat4(imat, rv3d->viewmat);
+ copy_m3_m4(imat, rv3d->viewmat);
else
- Mat3One(imat);
- Mat3MulVecfl(imat, cent);
- Mat3MulMat3(cmat, imat, mat);
- Mat3Inv(imat,cmat);
- Mat3MulVecfl(imat, cent);
+ unit_m3(imat);
+ mul_m3_v3(imat, cent);
+ mul_m3_m3m3(cmat, imat, mat);
+ invert_m3_m3(imat,cmat);
+ mul_m3_v3(imat, cent);
}
else
- Mat3One(imat);
+ unit_m3(imat);
ml= MEM_callocN(sizeof(MetaElem), "metaelem");
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 5378ee47f89..61377d76c56 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -46,7 +46,7 @@
#include "DNA_view3d_types.h"
#include "DNA_vfont_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BKE_anim.h"
@@ -126,7 +126,7 @@ void ED_object_base_init_from_view(bContext *C, Base *base, int view_align)
RegionView3D *rv3d = CTX_wm_region_view3d(C);
if(rv3d) {
rv3d->viewquat[0]= -rv3d->viewquat[0];
- QuatToEul(rv3d->viewquat, ob->rot);
+ quat_to_eul( ob->rot,rv3d->viewquat);
rv3d->viewquat[0]= -rv3d->viewquat[0];
}
}
@@ -928,7 +928,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base)
ob->disp.first= ob->disp.last= NULL;
ob->transflag &= ~OB_DUPLI;
- Mat4CpyMat4(ob->obmat, dob->mat);
+ copy_m4_m4(ob->obmat, dob->mat);
ED_object_apply_obmat(ob);
}
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 35b11571a61..2d98a284df0 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -33,7 +33,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_dynstr.h"
#include "DNA_action_types.h"
@@ -577,7 +577,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op)
float imat[4][4], tmat[4][4];
/* make copy of pchan's original pose-mat (for use later) */
- Mat4CpyMat4(pmat, pchan->pose_mat);
+ copy_m4_m4(pmat, pchan->pose_mat);
/* disable constraint for pose to be solved without it */
cinf= con->enforce;
@@ -590,9 +590,9 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op)
* pchan->pose_mat from the original pchan->pose_mat, thus determining
* the effect of the constraint
*/
- Mat4Invert(imat, pchan->pose_mat);
- Mat4MulMat4(tmat, imat, pmat);
- Mat4Invert(data->invmat, tmat);
+ invert_m4_m4(imat, pchan->pose_mat);
+ mul_m4_m4m4(tmat, imat, pmat);
+ invert_m4_m4(data->invmat, tmat);
/* recalculate pose with new inv-mat */
con->enforce= cinf;
@@ -604,10 +604,10 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op)
* NOTE: what_does_parent uses a static workob defined in object.c
*/
what_does_parent(scene, ob, &workob);
- Mat4Invert(data->invmat, workob.obmat);
+ invert_m4_m4(data->invmat, workob.obmat);
}
else
- Mat4One(data->invmat);
+ unit_m4(data->invmat);
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
@@ -637,7 +637,7 @@ static int childof_clear_inverse_exec (bContext *C, wmOperator *op)
bChildOfConstraint *data= (bChildOfConstraint *)con->data;
/* simply clear the matrix */
- Mat4One(data->invmat);
+ unit_m4(data->invmat);
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
@@ -1052,9 +1052,9 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
* if adding a target for an IK Constraint
*/
if (con_type == CONSTRAINT_TYPE_KINEMATIC)
- VecMat4MulVecfl(obt->loc, obact->obmat, pchanact->pose_tail);
+ mul_v3_m4v3(obt->loc, obact->obmat, pchanact->pose_tail);
else
- VecMat4MulVecfl(obt->loc, obact->obmat, pchanact->pose_head);
+ mul_v3_m4v3(obt->loc, obact->obmat, pchanact->pose_head);
}
else
VECCOPY(obt->loc, obact->obmat[3]);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 0cfdd914222..7bb345bf46c 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -67,7 +67,7 @@
#include "DNA_modifier_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_ghash.h"
#include "BLI_rand.h"
@@ -161,16 +161,16 @@ void ED_object_apply_obmat(Object *ob)
/* from obmat to loc rot size */
if(ob==NULL) return;
- Mat3CpyMat4(mat, ob->obmat);
+ copy_m3_m4(mat, ob->obmat);
VECCOPY(ob->loc, ob->obmat[3]);
- Mat3ToEul(mat, ob->rot);
- EulToMat3(ob->rot, tmat);
+ mat3_to_eul( ob->rot,mat);
+ eul_to_mat3( tmat,ob->rot);
- Mat3Inv(imat, tmat);
+ invert_m3_m3(imat, tmat);
- Mat3MulMat3(tmat, imat, mat);
+ mul_m3_m3m3(tmat, imat, mat);
ob->size[0]= tmat[0][0];
ob->size[1]= tmat[1][1];
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 22a6329a097..91aebc8b149 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -30,7 +30,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
@@ -77,12 +77,12 @@ static int return_editmesh_indexar(EditMesh *em, int *tot, int **indexar, float
for(eve= em->verts.first; eve; eve= eve->next) {
if(eve->f & SELECT) {
*index= nr; index++;
- VecAddf(cent, cent, eve->co);
+ add_v3_v3v3(cent, cent, eve->co);
}
nr++;
}
- VecMulf(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f/(float)totvert);
return totvert;
}
@@ -105,7 +105,7 @@ static int return_editmesh_vgroup(Object *obedit, EditMesh *em, char *name, floa
for(i=0; i<dvert->totweight; i++){
if(dvert->dw[i].def_nr == (obedit->actdef-1)) {
totvert++;
- VecAddf(cent, cent, eve->co);
+ add_v3_v3v3(cent, cent, eve->co);
}
}
}
@@ -113,7 +113,7 @@ static int return_editmesh_vgroup(Object *obedit, EditMesh *em, char *name, floa
if(totvert) {
bDeformGroup *defGroup = BLI_findlink(&obedit->defbase, obedit->actdef-1);
strcpy(name, defGroup->name);
- VecMulf(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f/(float)totvert);
return 1;
}
}
@@ -170,14 +170,14 @@ static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar
if(bp->f1 & SELECT) {
if(bp->hide==0) {
*index= nr; index++;
- VecAddf(cent, cent, bp->vec);
+ add_v3_v3v3(cent, cent, bp->vec);
}
}
bp++;
nr++;
}
- VecMulf(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f/(float)totvert);
return totvert;
}
@@ -243,17 +243,17 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
while(a--) {
if(bezt->f1 & SELECT) {
*index= nr; index++;
- VecAddf(cent, cent, bezt->vec[0]);
+ add_v3_v3v3(cent, cent, bezt->vec[0]);
}
nr++;
if(bezt->f2 & SELECT) {
*index= nr; index++;
- VecAddf(cent, cent, bezt->vec[1]);
+ add_v3_v3v3(cent, cent, bezt->vec[1]);
}
nr++;
if(bezt->f3 & SELECT) {
*index= nr; index++;
- VecAddf(cent, cent, bezt->vec[2]);
+ add_v3_v3v3(cent, cent, bezt->vec[2]);
}
nr++;
bezt++;
@@ -265,7 +265,7 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
while(a--) {
if(bp->f1 & SELECT) {
*index= nr; index++;
- VecAddf(cent, cent, bp->vec);
+ add_v3_v3v3(cent, cent, bp->vec);
}
nr++;
bp++;
@@ -273,7 +273,7 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
}
}
- VecMulf(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f/(float)totvert);
return totvert;
}
@@ -465,7 +465,7 @@ void add_hook(Scene *scene, View3D *v3d, int mode)
ob->lay= newbase->lay;
/* transform cent to global coords for loc */
- VecMat4MulVecfl(ob->loc, obedit->obmat, cent);
+ mul_v3_m4v3(ob->loc, obedit->obmat, cent);
/* restore, add_object sets active */
BASACT= base;
@@ -489,7 +489,7 @@ void add_hook(Scene *scene, View3D *v3d, int mode)
hmd->object= ob;
hmd->indexar= indexar;
- VecCopyf(hmd->cent, cent);
+ copy_v3_v3(hmd->cent, cent);
hmd->totindex= tot;
BLI_strncpy(hmd->name, name, 32);
@@ -501,9 +501,9 @@ void add_hook(Scene *scene, View3D *v3d, int mode)
where_is_object(scene, ob);
- Mat4Invert(ob->imat, ob->obmat);
+ invert_m4_m4(ob->imat, ob->obmat);
/* apparently this call goes from right to left... */
- Mat4MulSerie(hmd->parentinv, ob->imat, obedit->obmat, NULL,
+ mul_serie_m4(hmd->parentinv, ob->imat, obedit->obmat, NULL,
NULL, NULL, NULL, NULL, NULL);
}
}
@@ -520,9 +520,9 @@ void add_hook(Scene *scene, View3D *v3d, int mode)
// FIXME: this is now OBJECT_OT_hook_reset operator
where_is_object(scene, ob); /* ob is hook->parent */
- Mat4Invert(ob->imat, ob->obmat);
+ invert_m4_m4(ob->imat, ob->obmat);
/* this call goes from right to left... */
- Mat4MulSerie(hmd->parentinv, ob->imat, obedit->obmat, NULL,
+ mul_serie_m4(hmd->parentinv, ob->imat, obedit->obmat, NULL,
NULL, NULL, NULL, NULL, NULL);
}
@@ -577,8 +577,8 @@ void hookmenu(Scene *scene, View3D *v3d)
if (event==1) {
if(hmd->object) {
- Mat4Invert(hmd->object->imat, hmd->object->obmat);
- Mat4MulSerie(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
+ invert_m4_m4(hmd->object->imat, hmd->object->obmat);
+ mul_serie_m4(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
changed= 1;
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
@@ -589,14 +589,14 @@ void hookmenu(Scene *scene, View3D *v3d)
where_is_object(scene, ob);
- Mat3CpyMat4(bmat, ob->obmat);
- Mat3Inv(imat, bmat);
+ copy_m3_m4(bmat, ob->obmat);
+ invert_m3_m3(imat, bmat);
curs= give_cursor(scene, v3d);
hmd->cent[0]= curs[0]-ob->obmat[3][0];
hmd->cent[1]= curs[1]-ob->obmat[3][1];
hmd->cent[2]= curs[2]-ob->obmat[3][2];
- Mat3MulVecfl(imat, hmd->cent);
+ mul_m3_v3(imat, hmd->cent);
changed= 1;
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 0683cb6842f..f3588a91984 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -40,7 +40,7 @@
#include "DNA_object_force.h"
#include "DNA_scene_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BKE_action.h"
@@ -841,14 +841,14 @@ static int hook_reset_exec(bContext *C, wmOperator *op)
float imat[4][4], mat[4][4];
/* calculate the world-space matrix for the pose-channel target first, then carry on as usual */
- Mat4MulMat4(mat, pchan->pose_mat, hmd->object->obmat);
+ mul_m4_m4m4(mat, pchan->pose_mat, hmd->object->obmat);
- Mat4Invert(imat, mat);
- Mat4MulSerie(hmd->parentinv, imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
+ invert_m4_m4(imat, mat);
+ mul_serie_m4(hmd->parentinv, imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
}
else {
- Mat4Invert(hmd->object->imat, hmd->object->obmat);
- Mat4MulSerie(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
+ invert_m4_m4(hmd->object->imat, hmd->object->obmat);
+ mul_serie_m4(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
}
}
@@ -879,11 +879,11 @@ static int hook_recenter_exec(bContext *C, wmOperator *op)
HookModifierData *hmd= ptr.data;
float bmat[3][3], imat[3][3];
- Mat3CpyMat4(bmat, ob->obmat);
- Mat3Inv(imat, bmat);
+ copy_m3_m4(bmat, ob->obmat);
+ invert_m3_m3(imat, bmat);
VECSUB(hmd->cent, scene->cursor, ob->obmat[3]);
- Mat3MulVecfl(imat, hmd->cent);
+ mul_m3_v3(imat, hmd->cent);
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index ccb6e8cdea3..75a95323ce1 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -39,7 +39,7 @@
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index cbd1e1be8d5..95b874e7145 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -48,7 +48,7 @@
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
@@ -221,7 +221,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
/* inverse parent matrix */
what_does_parent(scene, ob, &workob);
- Mat4Invert(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.obmat);
}
else {
ob->partype= PARVERT1;
@@ -229,7 +229,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
/* inverse parent matrix */
what_does_parent(scene, ob, &workob);
- Mat4Invert(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.obmat);
}
}
}
@@ -451,7 +451,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
ED_object_apply_obmat(ob);
}
else if(type == 2)
- Mat4One(ob->parentinv);
+ unit_m4(ob->parentinv);
ob->recalc |= OB_RECALC;
}
@@ -617,7 +617,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
add_constraint_to_object(con, ob);
get_constraint_target_matrix(scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra - give_timeoffset(ob));
- VecSubf(vec, ob->obmat[3], cmat[3]);
+ sub_v3_v3v3(vec, ob->obmat[3], cmat[3]);
ob->loc[0] = vec[0];
ob->loc[1] = vec[1];
@@ -637,12 +637,12 @@ static int parent_set_exec(bContext *C, wmOperator *op)
ob->partype= PARSKEL;
- Mat4Invert(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.obmat);
}
else {
/* calculate inverse parent matrix */
what_does_parent(scene, ob, &workob);
- Mat4Invert(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.obmat);
}
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
@@ -734,7 +734,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
}
else {
/* clear inverse matrix and also the object location */
- Mat4One(ob->parentinv);
+ unit_m4(ob->parentinv);
memset(ob->loc, 0, 3*sizeof(float));
/* set recalc flags */
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 47730496296..20f3ea3df9e 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -40,7 +40,7 @@
#include "DNA_scene_types.h"
#include "DNA_texture_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_rand.h"
#include "BLI_string.h"
@@ -524,7 +524,7 @@ static short select_grouped_color(bContext *C, Object *ob)
char changed = 0;
CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
- if (!(base->flag & SELECT) && (FloatCompare(base->object->col, ob->col, 0.005f))) {
+ if (!(base->flag & SELECT) && (compare_v3v3(base->object->col, ob->col, 0.005f))) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
}
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index f52927a1a00..878c61aac48 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -37,7 +37,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_action_types.h"
#include "DNA_curve_types.h"
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 0c09e0a03de..48db13c0709 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -38,7 +38,7 @@
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_listbase.h"
@@ -159,10 +159,10 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op)
if (ob->rotmode == ROT_MODE_QUAT) {
QUATCOPY(quat1, ob->quat);
- QuatToEul(ob->quat, oldeul);
+ quat_to_eul( oldeul,ob->quat);
}
else if (ob->rotmode == ROT_MODE_AXISANGLE) {
- AxisAngleToEulO(ob->rotAxis, ob->rotAngle, oldeul, EULER_ORDER_DEFAULT);
+ axis_angle_to_eulO( oldeul, EULER_ORDER_DEFAULT,ob->rotAxis, ob->rotAngle);
}
else {
VECCOPY(oldeul, ob->rot);
@@ -178,14 +178,14 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op)
eul[2]= oldeul[2];
if (ob->rotmode == ROT_MODE_QUAT) {
- EulToQuat(eul, ob->quat);
+ eul_to_quat( ob->quat,eul);
/* quaternions flip w sign to accumulate rotations correctly */
if ((quat1[0]<0.0f && ob->quat[0]>0.0f) || (quat1[0]>0.0f && ob->quat[0]<0.0f)) {
- QuatMulf(ob->quat, -1.0f);
+ mul_qt_fl(ob->quat, -1.0f);
}
}
else if (ob->rotmode == ROT_MODE_AXISANGLE) {
- EulOToAxisAngle(eul, EULER_ORDER_DEFAULT, ob->rotAxis, &ob->rotAngle);
+ eulO_to_axis_angle( ob->rotAxis, &ob->rotAngle,eul, EULER_ORDER_DEFAULT);
}
else {
VECCOPY(ob->rot, eul);
@@ -290,12 +290,12 @@ static int object_origin_clear_exec(bContext *C, wmOperator *op)
v1= ob->loc;
v3= ob->parentinv[3];
- Mat3CpyMat4(mat, ob->parentinv);
+ copy_m3_m4(mat, ob->parentinv);
VECCOPY(v3, v1);
v3[0]= -v3[0];
v3[1]= -v3[1];
v3[2]= -v3[2];
- Mat3MulVecfl(mat, v3);
+ mul_m3_v3(mat, v3);
}
ob->recalc |= OB_RECALC_OB;
}
@@ -338,7 +338,7 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob )
if(ob_child->parent == ob) {
ED_object_apply_obmat(ob_child);
what_does_parent(scene, ob_child, &workob);
- Mat4Invert(ob_child->parentinv, workob.obmat);
+ invert_m4_m4(ob_child->parentinv, workob.obmat);
}
}
}
@@ -402,20 +402,20 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
else if(apply_rot)
object_rot_to_mat3(ob, rsmat);
else
- Mat3One(rsmat);
+ unit_m3(rsmat);
- Mat4CpyMat3(mat, rsmat);
+ copy_m4_m3(mat, rsmat);
/* calculate translation */
if(apply_loc) {
- VecCopyf(mat[3], ob->loc);
+ copy_v3_v3(mat[3], ob->loc);
if(!(apply_scale && apply_rot)) {
/* correct for scale and rotation that is still applied */
object_to_mat3(ob, obmat);
- Mat3Inv(iobmat, obmat);
- Mat3MulMat3(tmat, rsmat, iobmat);
- Mat3MulVecfl(tmat, mat[3]);
+ invert_m3_m3(iobmat, obmat);
+ mul_m3_m3m3(tmat, rsmat, iobmat);
+ mul_m3_v3(tmat, mat[3]);
}
}
@@ -426,7 +426,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
/* adjust data */
mvert= me->mvert;
for(a=0; a<me->totvert; a++, mvert++)
- Mat4MulVecfl(mat, mvert->co);
+ mul_m4_v3(mat, mvert->co);
if(me->key) {
KeyBlock *kb;
@@ -435,7 +435,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
float *fp= kb->data;
for(a=0; a<kb->totelem; a++, fp+=3)
- Mat4MulVecfl(mat, fp);
+ mul_m4_v3(mat, fp);
}
}
@@ -448,15 +448,15 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
cu= ob->data;
- scale = Mat3ToScalef(rsmat);
+ scale = mat3_to_scale(rsmat);
for(nu=cu->nurb.first; nu; nu=nu->next) {
if(nu->type == CU_BEZIER) {
a= nu->pntsu;
for(bezt= nu->bezt; a--; bezt++) {
- Mat4MulVecfl(mat, bezt->vec[0]);
- Mat4MulVecfl(mat, bezt->vec[1]);
- Mat4MulVecfl(mat, bezt->vec[2]);
+ mul_m4_v3(mat, bezt->vec[0]);
+ mul_m4_v3(mat, bezt->vec[1]);
+ mul_m4_v3(mat, bezt->vec[2]);
bezt->radius *= scale;
bezt++;
}
@@ -464,7 +464,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
else {
a= nu->pntsu*nu->pntsv;
for(bp= nu->bp; a--; bp++)
- Mat4MulVecfl(mat, bp->vec);
+ mul_m4_v3(mat, bp->vec);
}
}
}
@@ -503,8 +503,8 @@ static int visual_transform_apply_exec(bContext *C, wmOperator *op)
where_is_object(scene, ob);
VECCOPY(ob->loc, ob->obmat[3]);
- Mat4ToSize(ob->obmat, ob->size);
- Mat4ToEul(ob->obmat, ob->rot);
+ mat4_to_size( ob->size,ob->obmat);
+ mat4_to_eul( ob->rot,ob->obmat);
where_is_object(scene, ob);
@@ -709,7 +709,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
}
if(v3d->around==V3D_CENTROID) {
- VecMulf(cent, 1.0f/(float)total);
+ mul_v3_fl(cent, 1.0f/(float)total);
}
else {
cent[0]= (min[0]+max[0])/2.0f;
@@ -718,7 +718,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
}
for(eve= em->verts.first; eve; eve= eve->next) {
- VecSubf(eve->co, eve->co, cent);
+ sub_v3_v3v3(eve->co, eve->co, cent);
}
recalc_editnormals(em);
@@ -748,8 +748,8 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
} else {
if(centermode==2) {
VECCOPY(cent, give_cursor(scene, v3d));
- Mat4Invert(ob->imat, ob->obmat);
- Mat4MulVecfl(ob->imat, cent);
+ invert_m4_m4(ob->imat, ob->obmat);
+ mul_m4_v3(ob->imat, cent);
} else {
INIT_MINMAX(min, max);
mvert= me->mvert;
@@ -764,7 +764,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
mvert= me->mvert;
for(a=0; a<me->totvert; a++, mvert++) {
- VecSubf(mvert->co, mvert->co, cent);
+ sub_v3_v3v3(mvert->co, mvert->co, cent);
}
if (me->key) {
@@ -773,7 +773,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
float *fp= kb->data;
for (a=0; a<kb->totelem; a++, fp+=3) {
- VecSubf(fp, fp, cent);
+ sub_v3_v3v3(fp, fp, cent);
}
}
}
@@ -781,10 +781,10 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
me->flag |= ME_ISDONE;
if(centermode) {
- Mat3CpyMat4(omat, ob->obmat);
+ copy_m3_m4(omat, ob->obmat);
VECCOPY(centn, cent);
- Mat3MulVecfl(omat, centn);
+ mul_m3_v3(omat, centn);
ob->loc[0]+= centn[0];
ob->loc[1]+= centn[1];
ob->loc[2]+= centn[2];
@@ -802,9 +802,9 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
ob_other->flag |= OB_DONE;
ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA;
- Mat3CpyMat4(omat, ob_other->obmat);
+ copy_m3_m4(omat, ob_other->obmat);
VECCOPY(centn, cent);
- Mat3MulVecfl(omat, centn);
+ mul_m3_v3(omat, centn);
ob_other->loc[0]+= centn[0];
ob_other->loc[1]+= centn[1];
ob_other->loc[2]+= centn[2];
@@ -815,7 +815,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
if(tme && (tme->flag & ME_ISDONE)==0) {
mvert= tme->mvert;
for(a=0; a<tme->totvert; a++, mvert++) {
- VecSubf(mvert->co, mvert->co, cent);
+ sub_v3_v3v3(mvert->co, mvert->co, cent);
}
if (tme->key) {
@@ -824,7 +824,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
float *fp= kb->data;
for (a=0; a<kb->totelem; a++, fp+=3) {
- VecSubf(fp, fp, cent);
+ sub_v3_v3v3(fp, fp, cent);
}
}
}
@@ -858,8 +858,8 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
} else {
if(centermode==2) {
VECCOPY(cent, give_cursor(scene, v3d));
- Mat4Invert(ob->imat, ob->obmat);
- Mat4MulVecfl(ob->imat, cent);
+ invert_m4_m4(ob->imat, ob->obmat);
+ mul_m4_v3(ob->imat, cent);
/* don't allow Z change if curve is 2D */
if( !( cu->flag & CU_3D ) )
@@ -884,23 +884,23 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
if(nu->type == CU_BEZIER) {
a= nu->pntsu;
while (a--) {
- VecSubf(nu->bezt[a].vec[0], nu->bezt[a].vec[0], cent);
- VecSubf(nu->bezt[a].vec[1], nu->bezt[a].vec[1], cent);
- VecSubf(nu->bezt[a].vec[2], nu->bezt[a].vec[2], cent);
+ sub_v3_v3v3(nu->bezt[a].vec[0], nu->bezt[a].vec[0], cent);
+ sub_v3_v3v3(nu->bezt[a].vec[1], nu->bezt[a].vec[1], cent);
+ sub_v3_v3v3(nu->bezt[a].vec[2], nu->bezt[a].vec[2], cent);
}
}
else {
a= nu->pntsu*nu->pntsv;
while (a--)
- VecSubf(nu->bp[a].vec, nu->bp[a].vec, cent);
+ sub_v3_v3v3(nu->bp[a].vec, nu->bp[a].vec, cent);
}
nu= nu->next;
}
if(centermode && obedit==NULL) {
- Mat3CpyMat4(omat, ob->obmat);
+ copy_m3_m4(omat, ob->obmat);
- Mat3MulVecfl(omat, cent);
+ mul_m3_v3(omat, cent);
ob->loc[0]+= cent[0];
ob->loc[1]+= cent[1];
ob->loc[2]+= cent[2];
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 75c56575474..b5007ff72ce 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -60,7 +60,7 @@
#include "BKE_utildefines.h"
#include "BKE_pointcache.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
#include "BLI_kdtree.h"
@@ -587,13 +587,13 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
if(pset->selectmode==SCE_SELECT_PATH)
selected= 0;
- Mat4One(imat);
- Mat4One(mat);
+ unit_m4(imat);
+ unit_m4(mat);
LOOP_VISIBLE_POINTS {
if(edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(data->ob, psmd->dm, psys->part->from, psys->particles + p, mat);
- Mat4Invert(imat,mat);
+ invert_m4_m4(imat,mat);
}
if(pset->selectmode==SCE_SELECT_END) {
@@ -698,7 +698,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
key = pa->hair;
psys_mat_hair_to_orco(ob, psmd->dm, psys->part->from, pa, mat);
VECCOPY(co, key->co);
- Mat4MulVecfl(mat, co);
+ mul_m4_v3(mat, co);
BLI_kdtree_insert(tree, p, co, NULL);
}
@@ -712,7 +712,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
key = pa->hair;
psys_mat_hair_to_orco(ob, psmd->dm, psys->part->from, pa, mat);
VECCOPY(co, key->co);
- Mat4MulVecfl(mat, co);
+ mul_m4_v3(mat, co);
co[0]= -co[0];
index= BLI_kdtree_find_nearest(tree, co, NULL, &nearest);
@@ -785,7 +785,7 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys
/* mirror positions and tags */
psys_mat_hair_to_orco(ob, dm, psys->part->from, pa, mat);
psys_mat_hair_to_orco(ob, dm, psys->part->from, mpa, mmat);
- Mat4Invert(immat, mmat);
+ invert_m4_m4(immat, mmat);
hkey=pa->hair;
mhkey=mpa->hair;
@@ -793,9 +793,9 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys
mkey= mpoint->keys;
for(k=0; k<pa->totkey; k++, hkey++, mhkey++, key++, mkey++) {
VECCOPY(mhkey->co, hkey->co);
- Mat4MulVecfl(mat, mhkey->co);
+ mul_m4_v3(mat, mhkey->co);
mhkey->co[0]= -mhkey->co[0];
- Mat4MulVecfl(immat, mhkey->co);
+ mul_m4_v3(immat, mhkey->co);
if(key->flag & PEK_TAG)
mkey->flag |= PEK_TAG;
@@ -867,12 +867,12 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
psys_mat_hair_to_object(ob, psmd->dm, psys->part->from, psys->particles + p, hairmat);
LOOP_KEYS {
- Mat4MulVecfl(hairmat, key->co);
+ mul_m4_v3(hairmat, key->co);
}
LOOP_KEYS {
if(k==0) {
- dist_1st = VecLenf((key+1)->co, key->co);
+ dist_1st = len_v3v3((key+1)->co, key->co);
dist_1st *= 0.75f * pset->emitterdist;
}
else {
@@ -881,32 +881,32 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
vec=edit->emitter_cosnos +index*6;
nor=vec+3;
- VecSubf(dvec, key->co, vec);
+ sub_v3_v3v3(dvec, key->co, vec);
- dot=Inpf(dvec,nor);
+ dot=dot_v3v3(dvec,nor);
VECCOPY(dvec,nor);
if(dot>0.0f) {
if(dot<dist_1st) {
- Normalize(dvec);
- VecMulf(dvec,dist_1st-dot);
- VecAddf(key->co,key->co,dvec);
+ normalize_v3(dvec);
+ mul_v3_fl(dvec,dist_1st-dot);
+ add_v3_v3v3(key->co,key->co,dvec);
}
}
else {
- Normalize(dvec);
- VecMulf(dvec,dist_1st-dot);
- VecAddf(key->co,key->co,dvec);
+ normalize_v3(dvec);
+ mul_v3_fl(dvec,dist_1st-dot);
+ add_v3_v3v3(key->co,key->co,dvec);
}
if(k==1)
dist_1st*=1.3333f;
}
}
- Mat4Invert(hairimat,hairmat);
+ invert_m4_m4(hairimat,hairmat);
LOOP_KEYS {
- Mat4MulVecfl(hairimat, key->co);
+ mul_m4_v3(hairimat, key->co);
}
}
}
@@ -927,10 +927,10 @@ void PE_apply_lengths(Scene *scene, PTCacheEdit *edit)
LOOP_EDITED_POINTS {
LOOP_KEYS {
if(k) {
- VecSubf(dv1, key->co, (key - 1)->co);
- Normalize(dv1);
- VecMulf(dv1, (key - 1)->length);
- VecAddf(key->co, (key - 1)->co, dv1);
+ sub_v3_v3v3(dv1, key->co, (key - 1)->co);
+ normalize_v3(dv1);
+ mul_v3_fl(dv1, (key - 1)->length);
+ add_v3_v3v3(key->co, (key - 1)->co, dv1);
}
}
}
@@ -970,19 +970,19 @@ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit)
for(; k<point->totkey; k++, key++) {
if(k) {
- VecSubf(dv0, (key - 1)->co, key->co);
- tlen= Normalize(dv0);
- VecMulf(dv0, (mul * (tlen - (key - 1)->length)));
+ sub_v3_v3v3(dv0, (key - 1)->co, key->co);
+ tlen= normalize_v3(dv0);
+ mul_v3_fl(dv0, (mul * (tlen - (key - 1)->length)));
}
if(k < point->totkey - 1) {
- VecSubf(dv2, (key + 1)->co, key->co);
- tlen= Normalize(dv2);
- VecMulf(dv2, mul * (tlen - key->length));
+ sub_v3_v3v3(dv2, (key + 1)->co, key->co);
+ tlen= normalize_v3(dv2);
+ mul_v3_fl(dv2, mul * (tlen - key->length));
}
if(k) {
- VecAddf((key-1)->co,(key-1)->co,dv1);
+ add_v3_v3v3((key-1)->co,(key-1)->co,dv1);
}
VECADD(dv1,dv0,dv2);
@@ -1001,7 +1001,7 @@ static void recalc_lengths(PTCacheEdit *edit)
LOOP_EDITED_POINTS {
key= point->keys;
for(k=0; k<point->totkey-1; k++, key++) {
- key->length= VecLenf(key->co, (key + 1)->co);
+ key->length= len_v3v3(key->co, (key + 1)->co);
}
}
}
@@ -1055,12 +1055,12 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
VECADD(vec,vec,mvert->co);
VECADD(nor,nor,mvert->no);
- VecMulf(vec,0.25);
+ mul_v3_fl(vec,0.25);
}
else
- VecMulf(vec,0.3333f);
+ mul_v3_fl(vec,0.3333f);
- Normalize(nor);
+ normalize_v3(nor);
BLI_kdtree_insert(edit->emitter_field, i, vec, NULL);
}
@@ -1114,7 +1114,7 @@ static void update_world_cos(Object *ob, PTCacheEdit *edit)
LOOP_KEYS {
VECCOPY(key->world_co,key->co);
if(!(psys->flag & PSYS_GLOBAL_HAIR))
- Mat4MulVecfl(hairmat, key->world_co);
+ mul_m4_v3(hairmat, key->world_co);
}
}
}
@@ -1142,7 +1142,7 @@ static void update_velocities(Object *ob, PTCacheEdit *edit)
if(point->totkey>2) {
VECSUB(vec1, (key+1)->co, (key+2)->co);
- Projf(vec2, vec1, key->vel);
+ project_v3_v3v3(vec2, vec1, key->vel);
VECSUB(vec2, vec1, vec2);
VECADDFAC(key->vel, key->vel, vec2, 0.5f);
}
@@ -1157,7 +1157,7 @@ static void update_velocities(Object *ob, PTCacheEdit *edit)
if(point->totkey>2) {
VECSUB(vec1, (key-2)->co, (key-1)->co);
- Projf(vec2, vec1, key->vel);
+ project_v3_v3v3(vec2, vec1, key->vel);
VECSUB(vec2, vec1, vec2);
VECADDFAC(key->vel, key->vel, vec2, 0.5f);
}
@@ -1170,7 +1170,7 @@ static void update_velocities(Object *ob, PTCacheEdit *edit)
VECSUB(key->vel, (key+1)->co, (key-1)->co);
}
- VecMulf(key->vel, frs_sec/dfra);
+ mul_v3_fl(key->vel, frs_sec/dfra);
}
}
}
@@ -1537,7 +1537,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short select)
if(!PE_start_edit(edit))
return OPERATOR_CANCELLED;
- Mat4One(mat);
+ unit_m4(mat);
LOOP_VISIBLE_POINTS {
if(edit->psys && !(psys->flag & PSYS_GLOBAL_HAIR))
@@ -1546,7 +1546,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short select)
if(pset->selectmode==SCE_SELECT_POINT) {
LOOP_KEYS {
VECCOPY(co, key->co);
- Mat4MulVecfl(mat, co);
+ mul_m4_v3(mat, co);
project_short(ar, co, vertco);
if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1])) {
if(select && !(key->flag & PEK_SELECT)) {
@@ -1564,7 +1564,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short select)
key= point->keys + point->totkey - 1;
VECCOPY(co, key->co);
- Mat4MulVecfl(mat, co);
+ mul_m4_v3(mat, co);
project_short(ar, co,vertco);
if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1])) {
if(select && !(key->flag & PEK_SELECT)) {
@@ -2255,7 +2255,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
LOOP_SELECTED_POINTS {
psys_mat_hair_to_object(ob, psmd->dm, psys->part->from, psys->particles+p, mat);
VECCOPY(co, point->keys->co);
- Mat4MulVecfl(mat, co);
+ mul_m4_v3(mat, co);
BLI_kdtree_insert(tree, p, co, NULL);
}
@@ -2265,7 +2265,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
LOOP_SELECTED_POINTS {
psys_mat_hair_to_object(ob, psmd->dm, psys->part->from, psys->particles+p, mat);
VECCOPY(co, point->keys->co);
- Mat4MulVecfl(mat, co);
+ mul_m4_v3(mat, co);
totn= BLI_kdtree_find_n_nearest(tree,10,co,NULL,nearest);
@@ -2736,8 +2736,8 @@ static void brush_comb(PEData *data, float mat[][4], float imat[][4], int point_
fac= (float)pow((double)(1.0f - data->dist / data->rad), (double)data->combfac);
VECCOPY(cvec,data->dvec);
- Mat4Mul3Vecfl(imat,cvec);
- VecMulf(cvec, fac);
+ mul_mat3_m4_v3(imat,cvec);
+ mul_v3_fl(cvec, fac);
VECADD(key->co, key->co, cvec);
(data->edit->points + point_index)->flag |= PEP_EDIT_RECALC;
@@ -2854,7 +2854,7 @@ static void brush_length(PEData *data, int point_index)
else {
VECSUB(dvec,key->co,pvec);
VECCOPY(pvec,key->co);
- VecMulf(dvec,data->growfac);
+ mul_v3_fl(dvec,data->growfac);
VECADD(key->co,(key-1)->co,dvec);
}
}
@@ -2873,25 +2873,25 @@ static void brush_puff(PEData *data, int point_index)
if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(data->ob, data->dm, psys->part->from, psys->particles + point_index, mat);
- Mat4Invert(imat,mat);
+ invert_m4_m4(imat,mat);
}
else {
- Mat4One(mat);
- Mat4One(imat);
+ unit_m4(mat);
+ unit_m4(imat);
}
LOOP_KEYS {
if(k==0) {
/* find root coordinate and normal on emitter */
VECCOPY(co, key->co);
- Mat4MulVecfl(mat, co);
+ mul_m4_v3(mat, co);
point_index= BLI_kdtree_find_nearest(edit->emitter_field, co, NULL, NULL);
if(point_index == -1) return;
VECCOPY(rootco, co);
- VecCopyf(nor, &edit->emitter_cosnos[point_index*6+3]);
- Normalize(nor);
+ copy_v3_v3(nor, &edit->emitter_cosnos[point_index*6+3]);
+ normalize_v3(nor);
length= 0.0f;
fac= (float)pow((double)(1.0f - data->dist / data->rad), (double)data->pufffac);
@@ -2903,8 +2903,8 @@ static void brush_puff(PEData *data, int point_index)
/* compute position as if hair was standing up straight */
VECCOPY(lastco, co);
VECCOPY(co, key->co);
- Mat4MulVecfl(mat, co);
- length += VecLenf(lastco, co);
+ mul_m4_v3(mat, co);
+ length += len_v3v3(lastco, co);
VECADDFAC(kco, rootco, nor, length);
@@ -2913,7 +2913,7 @@ static void brush_puff(PEData *data, int point_index)
VECADDFAC(co, co, dco, fac);
VECCOPY(key->co, co);
- Mat4MulVecfl(imat, key->co);
+ mul_m4_v3(imat, key->co);
}
}
@@ -2925,8 +2925,8 @@ static void brush_smooth_get(PEData *data, float mat[][4], float imat[][4], int
if(key_index) {
float dvec[3];
- VecSubf(dvec,key->co,(key-1)->co);
- Mat4Mul3Vecfl(mat,dvec);
+ sub_v3_v3v3(dvec,key->co,(key-1)->co);
+ mul_mat3_m4_v3(mat,dvec);
VECADD(data->vec,data->vec,dvec);
data->tot++;
}
@@ -2938,12 +2938,12 @@ static void brush_smooth_do(PEData *data, float mat[][4], float imat[][4], int p
if(key_index) {
VECCOPY(vec,data->vec);
- Mat4Mul3Vecfl(imat,vec);
+ mul_mat3_m4_v3(imat,vec);
- VecSubf(dvec,key->co,(key-1)->co);
+ sub_v3_v3v3(dvec,key->co,(key-1)->co);
VECSUB(dvec,vec,dvec);
- VecMulf(dvec,data->smoothfac);
+ mul_v3_fl(dvec,data->smoothfac);
VECADD(key->co,key->co,dvec);
}
@@ -2969,7 +2969,7 @@ static int brush_add(PEData *data, short number)
short size= pset->brush[PE_BRUSH_ADD].size;
short size2= size*size;
DerivedMesh *dm=0;
- Mat4Invert(imat,ob->obmat);
+ invert_m4_m4(imat,ob->obmat);
if(psys->flag & PSYS_GLOBAL_HAIR)
return 0;
@@ -2995,8 +2995,8 @@ static int brush_add(PEData *data, short number)
mco[1]= data->mval[1] + dmy;
viewline(data->vc.ar, data->vc.v3d, mco, co1, co2);
- Mat4MulVecfl(imat,co1);
- Mat4MulVecfl(imat,co2);
+ mul_m4_v3(imat,co1);
+ mul_m4_v3(imat,co2);
min_d=2.0;
/* warning, returns the derived mesh face */
@@ -3102,18 +3102,18 @@ static int brush_add(PEData *data, short number)
key[0].time= hkey->time/ 100.0f;
psys_get_particle_on_path(&sim, ptn[0].index, key, 0);
- VecMulf(key[0].co, weight[0]);
+ mul_v3_fl(key[0].co, weight[0]);
if(maxw>1) {
key[1].time= key[0].time;
psys_get_particle_on_path(&sim, ptn[1].index, key + 1, 0);
- VecMulf(key[1].co, weight[1]);
+ mul_v3_fl(key[1].co, weight[1]);
VECADD(key[0].co, key[0].co, key[1].co);
if(maxw>2) {
key[2].time= key[0].time;
psys_get_particle_on_path(&sim, ptn[2].index, key + 2, 0);
- VecMulf(key[2].co, weight[2]);
+ mul_v3_fl(key[2].co, weight[2]);
VECADD(key[0].co, key[0].co, key[2].co);
}
}
@@ -3134,8 +3134,8 @@ static int brush_add(PEData *data, short number)
}
for(k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
- Mat4Invert(imat,hairmat);
- Mat4MulVecfl(imat, hkey->co);
+ invert_m4_m4(imat,hairmat);
+ mul_m4_v3(imat, hkey->co);
}
}
@@ -3250,7 +3250,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
else
data.combfac= 1.0f - data.combfac;
- Mat4Invert(ob->imat, ob->obmat);
+ invert_m4_m4(ob->imat, ob->obmat);
window_to_3d_delta(ar, vec, dx, dy);
data.dvec= vec;
@@ -3320,7 +3320,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
data.pufffac= 1.0f - data.pufffac;
data.invert= (brush->invert ^ flip);
- Mat4Invert(ob->imat, ob->obmat);
+ invert_m4_m4(ob->imat, ob->obmat);
foreach_mouse_hit_point(&data, brush_puff, selected);
}
@@ -3356,12 +3356,12 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
data.smoothfac= (float)(brush->strength / 100.0f);
- Mat4Invert(ob->imat, ob->obmat);
+ invert_m4_m4(ob->imat, ob->obmat);
foreach_mouse_hit_key(&data, brush_smooth_get, selected);
if(data.tot) {
- VecMulf(data.vec, 1.0f / (float)data.tot);
+ mul_v3_fl(data.vec, 1.0f / (float)data.tot);
foreach_mouse_hit_key(&data, brush_smooth_do, selected);
}
@@ -3784,7 +3784,7 @@ int PE_minmax(Scene *scene, float *min, float *max)
if(psys)
psmd= psys_get_modifier(ob, psys);
else
- Mat4One(mat);
+ unit_m4(mat);
LOOP_VISIBLE_POINTS {
if(psys)
@@ -3792,7 +3792,7 @@ int PE_minmax(Scene *scene, float *min, float *max)
LOOP_SELECTED_KEYS {
VECCOPY(co, key->co);
- Mat4MulVecfl(mat, co);
+ mul_m4_v3(mat, co);
DO_MINMAX(co, min, max);
ok= 1;
}
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index d763c0500d2..1ef3ffa6c34 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -37,7 +37,7 @@
#include "DNA_scene_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BKE_context.h"
@@ -548,7 +548,7 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
for(k=0,key=pa->hair; k<pa->totkey; k++,key++) {
- Mat4MulVecfl(hairmat,key->co);
+ mul_m4_v3(hairmat,key->co);
if(ekey) {
ekey->flag &= ~PEK_USE_WCO;
@@ -638,7 +638,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
/* convert to global coordinates */
for (i=0; i<numverts; i++)
- Mat4MulVecfl (ob->obmat, CDDM_get_vert(dm, i)->co);
+ mul_m4_v3(ob->obmat, CDDM_get_vert(dm, i)->co);
bvhtree_from_mesh_faces(&bvhtree, dm, 0.0, 2, 6);
@@ -657,21 +657,21 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
mface = CDDM_get_face(dm,nearest.index);
- VecCopyf(v[0], CDDM_get_vert(dm,mface->v1)->co);
- VecCopyf(v[1], CDDM_get_vert(dm,mface->v2)->co);
- VecCopyf(v[2], CDDM_get_vert(dm,mface->v3)->co);
+ copy_v3_v3(v[0], CDDM_get_vert(dm,mface->v1)->co);
+ copy_v3_v3(v[1], CDDM_get_vert(dm,mface->v2)->co);
+ copy_v3_v3(v[2], CDDM_get_vert(dm,mface->v3)->co);
if(mface->v4) {
- VecCopyf(v[3], CDDM_get_vert(dm,mface->v4)->co);
- MeanValueWeights(v, 4, nearest.co, pa->fuv);
+ copy_v3_v3(v[3], CDDM_get_vert(dm,mface->v4)->co);
+ interp_weights_poly_v3( pa->fuv,v, 4, nearest.co);
}
else
- MeanValueWeights(v, 3, nearest.co, pa->fuv);
+ interp_weights_poly_v3( pa->fuv,v, 3, nearest.co);
pa->num = nearest.index;
pa->num_dmcache = psys_particle_dm_face_lookup(ob,psmd->dm,pa->num,pa->fuv,NULL);
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
- Mat4Invert(imat,hairmat);
+ invert_m4_m4(imat,hairmat);
VECSUB(vec, nearest.co, key->co);
@@ -682,7 +682,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
for(k=0,key=pa->hair; k<pa->totkey; k++,key++) {
VECADD(key->co, key->co, vec);
- Mat4MulVecfl(imat,key->co);
+ mul_m4_v3(imat,key->co);
if(ekey) {
ekey->flag |= PEK_USE_WCO;
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index b72c4991094..e5d553dacc7 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -62,7 +62,7 @@
#include "BLI_blenlib.h"
#include "BLI_threads.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BKE_blender.h"
#include "BKE_context.h"
@@ -839,8 +839,8 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *ob)
}
// init trafo matrix
- Mat4CpyMat4(domainMat, fsDomain->obmat);
- if(!Mat4Invert(invDomMat, domainMat)) {
+ copy_m4_m4(domainMat, fsDomain->obmat);
+ if(!invert_m4_m4(invDomMat, domainMat)) {
snprintf(debugStrBuffer,256,"fluidsimBake::error - Invalid obj matrix?\n");
elbeemDebugOut(debugStrBuffer);
BKE_report(reports, RPT_ERROR, "Invalid object matrix.");
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 92380a56d3d..74e1cca5579 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -42,7 +42,7 @@
#include "BLO_readfile.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_threads.h"
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index a9023194271..59b220dec63 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -52,7 +52,7 @@
#include "BKE_utildefines.h"
#include "BKE_world.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_listbase.h"
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index be76e153fae..0f22b3041fb 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -35,7 +35,7 @@
#include "DNA_userdef_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 1445c6b5cf8..742fab07bcc 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -37,7 +37,7 @@
#include "BKE_utildefines.h"
#include "BKE_colortools.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_threads.h"
#include "BIF_gl.h"
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 5cc2039393a..0df7b326834 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -31,7 +31,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_dlrbTree.h"
@@ -400,7 +400,7 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
for(az= sa->actionzones.first; az; az= az->next) {
if(BLI_in_rcti(&az->rect, x, y)) {
if(az->type == AZONE_AREA) {
- if(IsPointInTri2DInts(az->x1, az->y1, az->x2, az->y2, x, y))
+ if(isect_point_tri_v2_int(az->x1, az->y1, az->x2, az->y2, x, y))
break;
}
else if(az->type == AZONE_REGION) {
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 929f854242f..e34330c2e42 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -40,7 +40,7 @@
#ifdef WIN32
#include "BLI_winstuff.h"
#endif
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
#include "BLI_linklist.h"
@@ -669,7 +669,7 @@ static int project_paint_PickFace(const ProjPaintState *ps, float pt[2], float w
v2= ps->screenCoords[mf->v2];
v3= ps->screenCoords[mf->v3];
- if (IsectPT2Df(pt, v1, v2, v3)) {
+ if (isect_point_tri_v2(pt, v1, v2, v3)) {
if (ps->is_ortho) z_depth= VecZDepthOrtho(pt, v1, v2, v3, w_tmp);
else z_depth= VecZDepthPersp(pt, v1, v2, v3, w_tmp);
@@ -683,7 +683,7 @@ static int project_paint_PickFace(const ProjPaintState *ps, float pt[2], float w
else if (mf->v4) {
v4= ps->screenCoords[mf->v4];
- if (IsectPT2Df(pt, v1, v3, v4)) {
+ if (isect_point_tri_v2(pt, v1, v3, v4)) {
if (ps->is_ortho) z_depth= VecZDepthOrtho(pt, v1, v3, v4, w_tmp);
else z_depth= VecZDepthPersp(pt, v1, v3, v4, w_tmp);
@@ -734,10 +734,10 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float
tf = ps->dm_mtface + face_index;
if (side == 0) {
- Vec2Lerp3f(uv, tf->uv[0], tf->uv[1], tf->uv[2], w);
+ interp_v2_v2v2v2(uv, tf->uv[0], tf->uv[1], tf->uv[2], w);
}
else { /* QUAD */
- Vec2Lerp3f(uv, tf->uv[0], tf->uv[2], tf->uv[3], w);
+ interp_v2_v2v2v2(uv, tf->uv[0], tf->uv[2], tf->uv[3], w);
}
ibuf = tf->tpage->ibufs.first; /* we must have got the imbuf before getting here */
@@ -818,7 +818,7 @@ static int project_paint_occlude_ptv(float pt[3], float v1[3], float v2[3], floa
return 0;
/* do a 2D point in try intersection */
- if (!IsectPT2Df(pt, v1, v2, v3))
+ if (!isect_point_tri_v2(pt, v1, v2, v3))
return 0; /* we know there is */
@@ -858,10 +858,10 @@ static int project_paint_occlude_ptv_clip(
}
/* Test if we're in the clipped area, */
- if (side) VecLerp3f(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w);
- else VecLerp3f(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w);
+ if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w);
+ else interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w);
- Mat4MulVecfl(ps->ob->obmat, wco);
+ mul_m4_v3(ps->ob->obmat, wco);
if(!view3d_test_clipping(ps->rv3d, wco)) {
return 1;
}
@@ -1162,51 +1162,51 @@ static void uv_image_outset(float (*orig_uv)[2], float (*outset_uv)[2], const fl
}
/* face edge directions */
- Vec2Subf(dir1, puv[1], puv[0]);
- Vec2Subf(dir2, puv[2], puv[1]);
- Normalize2(dir1);
- Normalize2(dir2);
+ sub_v2_v2v2(dir1, puv[1], puv[0]);
+ sub_v2_v2v2(dir2, puv[2], puv[1]);
+ normalize_v2(dir1);
+ normalize_v2(dir2);
if (is_quad) {
- Vec2Subf(dir3, puv[3], puv[2]);
- Vec2Subf(dir4, puv[0], puv[3]);
- Normalize2(dir3);
- Normalize2(dir4);
+ sub_v2_v2v2(dir3, puv[3], puv[2]);
+ sub_v2_v2v2(dir4, puv[0], puv[3]);
+ normalize_v2(dir3);
+ normalize_v2(dir4);
}
else {
- Vec2Subf(dir3, puv[0], puv[2]);
- Normalize2(dir3);
+ sub_v2_v2v2(dir3, puv[0], puv[2]);
+ normalize_v2(dir3);
}
if (is_quad) {
- a1 = AngleToLength(NormalizedVecAngle2_2D(dir4, dir1));
- a2 = AngleToLength(NormalizedVecAngle2_2D(dir1, dir2));
- a3 = AngleToLength(NormalizedVecAngle2_2D(dir2, dir3));
- a4 = AngleToLength(NormalizedVecAngle2_2D(dir3, dir4));
+ a1 = shell_angle_to_dist(angle_normalized_v2v2(dir4, dir1));
+ a2 = shell_angle_to_dist(angle_normalized_v2v2(dir1, dir2));
+ a3 = shell_angle_to_dist(angle_normalized_v2v2(dir2, dir3));
+ a4 = shell_angle_to_dist(angle_normalized_v2v2(dir3, dir4));
}
else {
- a1 = AngleToLength(NormalizedVecAngle2_2D(dir3, dir1));
- a2 = AngleToLength(NormalizedVecAngle2_2D(dir1, dir2));
- a3 = AngleToLength(NormalizedVecAngle2_2D(dir2, dir3));
+ a1 = shell_angle_to_dist(angle_normalized_v2v2(dir3, dir1));
+ a2 = shell_angle_to_dist(angle_normalized_v2v2(dir1, dir2));
+ a3 = shell_angle_to_dist(angle_normalized_v2v2(dir2, dir3));
}
if (is_quad) {
- Vec2Subf(no1, dir4, dir1);
- Vec2Subf(no2, dir1, dir2);
- Vec2Subf(no3, dir2, dir3);
- Vec2Subf(no4, dir3, dir4);
- Normalize2(no1);
- Normalize2(no2);
- Normalize2(no3);
- Normalize2(no4);
- Vec2Mulf(no1, a1*scaler);
- Vec2Mulf(no2, a2*scaler);
- Vec2Mulf(no3, a3*scaler);
- Vec2Mulf(no4, a4*scaler);
- Vec2Addf(outset_uv[0], puv[0], no1);
- Vec2Addf(outset_uv[1], puv[1], no2);
- Vec2Addf(outset_uv[2], puv[2], no3);
- Vec2Addf(outset_uv[3], puv[3], no4);
+ sub_v2_v2v2(no1, dir4, dir1);
+ sub_v2_v2v2(no2, dir1, dir2);
+ sub_v2_v2v2(no3, dir2, dir3);
+ sub_v2_v2v2(no4, dir3, dir4);
+ normalize_v2(no1);
+ normalize_v2(no2);
+ normalize_v2(no3);
+ normalize_v2(no4);
+ mul_v2_fl(no1, a1*scaler);
+ mul_v2_fl(no2, a2*scaler);
+ mul_v2_fl(no3, a3*scaler);
+ mul_v2_fl(no4, a4*scaler);
+ add_v2_v2v2(outset_uv[0], puv[0], no1);
+ add_v2_v2v2(outset_uv[1], puv[1], no2);
+ add_v2_v2v2(outset_uv[2], puv[2], no3);
+ add_v2_v2v2(outset_uv[3], puv[3], no4);
outset_uv[0][0] *= ibuf_x_inv;
outset_uv[0][1] *= ibuf_y_inv;
@@ -1220,18 +1220,18 @@ static void uv_image_outset(float (*orig_uv)[2], float (*outset_uv)[2], const fl
outset_uv[3][1] *= ibuf_y_inv;
}
else {
- Vec2Subf(no1, dir3, dir1);
- Vec2Subf(no2, dir1, dir2);
- Vec2Subf(no3, dir2, dir3);
- Normalize2(no1);
- Normalize2(no2);
- Normalize2(no3);
- Vec2Mulf(no1, a1*scaler);
- Vec2Mulf(no2, a2*scaler);
- Vec2Mulf(no3, a3*scaler);
- Vec2Addf(outset_uv[0], puv[0], no1);
- Vec2Addf(outset_uv[1], puv[1], no2);
- Vec2Addf(outset_uv[2], puv[2], no3);
+ sub_v2_v2v2(no1, dir3, dir1);
+ sub_v2_v2v2(no2, dir1, dir2);
+ sub_v2_v2v2(no3, dir2, dir3);
+ normalize_v2(no1);
+ normalize_v2(no2);
+ normalize_v2(no3);
+ mul_v2_fl(no1, a1*scaler);
+ mul_v2_fl(no2, a2*scaler);
+ mul_v2_fl(no3, a3*scaler);
+ add_v2_v2v2(outset_uv[0], puv[0], no1);
+ add_v2_v2v2(outset_uv[1], puv[1], no2);
+ add_v2_v2v2(outset_uv[2], puv[2], no3);
outset_uv[0][0] *= ibuf_x_inv;
outset_uv[0][1] *= ibuf_y_inv;
@@ -1288,7 +1288,7 @@ static float lambda_cp_line2(const float p[2], const float l1[2], const float l2
h[0] = p[0] - l1[0];
h[1] = p[1] - l1[1];
- return(Inp2f(u, h)/Inp2f(u, u));
+ return(dot_v2v2(u, h)/dot_v2v2(u, u));
}
@@ -1304,7 +1304,7 @@ static void screen_px_from_ortho(
float w[3])
{
BarycentricWeights2f(uv, uv1co, uv2co, uv3co, w);
- VecLerp3f(pixelScreenCo, v1co, v2co, v3co, w);
+ interp_v3_v3v3v3(pixelScreenCo, v1co, v2co, v3co, w);
}
/* same as screen_px_from_ortho except we need to take into account
@@ -1338,7 +1338,7 @@ static void screen_px_from_persp(
}
/* done re-weighting */
- VecLerp3f(pixelScreenCo, v1co, v2co, v3co, w);
+ interp_v3_v3v3v3(pixelScreenCo, v1co, v2co, v3co, w);
}
static void project_face_pixel(const MTFace *tf_other, ImBuf *ibuf_other, const float w[3], int side, unsigned char rgba_ub[4], float rgba_f[4])
@@ -1356,7 +1356,7 @@ static void project_face_pixel(const MTFace *tf_other, ImBuf *ibuf_other, const
uvCo3 = (float *)tf_other->uv[2];
}
- Vec2Lerp3f(uv_other, uvCo1, uvCo2, uvCo3, w);
+ interp_v2_v2v2v2(uv_other, uvCo1, uvCo2, uvCo3, w);
/* use */
uvco_to_wrapped_pxco(uv_other, ibuf_other->x, ibuf_other->y, &x, &y);
@@ -1432,11 +1432,11 @@ float project_paint_uvpixel_mask(
no[0] = w[0]*no1[0] + w[1]*no2[0] + w[2]*no3[0];
no[1] = w[0]*no1[1] + w[1]*no2[1] + w[2]*no3[1];
no[2] = w[0]*no1[2] + w[1]*no2[2] + w[2]*no3[2];
- Normalize(no);
+ normalize_v3(no);
/* now we can use the normal as a mask */
if (ps->is_ortho) {
- angle = NormalizedVecAngle2((float *)ps->viewDir, no);
+ angle = angle_normalized_v3v3((float *)ps->viewDir, no);
}
else {
/* Annoying but for the perspective view we need to get the pixels location in 3D space :/ */
@@ -1456,9 +1456,9 @@ float project_paint_uvpixel_mask(
viewDirPersp[0] = (ps->viewPos[0] - (w[0]*co1[0] + w[1]*co2[0] + w[2]*co3[0]));
viewDirPersp[1] = (ps->viewPos[1] - (w[0]*co1[1] + w[1]*co2[1] + w[2]*co3[1]));
viewDirPersp[2] = (ps->viewPos[2] - (w[0]*co1[2] + w[1]*co2[2] + w[2]*co3[2]));
- Normalize(viewDirPersp);
+ normalize_v3(viewDirPersp);
- angle = NormalizedVecAngle2(viewDirPersp, no);
+ angle = angle_normalized_v3v3(viewDirPersp, no);
}
if (angle >= ps->normal_angle) {
@@ -1578,7 +1578,7 @@ static ProjPixel *project_paint_uvpixel_init(
}
else {
float co[2];
- Vec2Subf(co, projPixel->projCoSS, (float *)ps->cloneOffset);
+ sub_v2_v2v2(co, projPixel->projCoSS, (float *)ps->cloneOffset);
/* no need to initialize the bucket, we're only checking buckets faces and for this
* the faces are alredy initialized in project_paint_delayed_face_init(...) */
@@ -1769,20 +1769,20 @@ static void scale_quad(float insetCos[4][3], float *origCos[4], const float inse
cent[1] = (origCos[0][1] + origCos[1][1] + origCos[2][1] + origCos[3][1]) / 4.0f;
cent[2] = (origCos[0][2] + origCos[1][2] + origCos[2][2] + origCos[3][2]) / 4.0f;
- VecSubf(insetCos[0], origCos[0], cent);
- VecSubf(insetCos[1], origCos[1], cent);
- VecSubf(insetCos[2], origCos[2], cent);
- VecSubf(insetCos[3], origCos[3], cent);
+ sub_v3_v3v3(insetCos[0], origCos[0], cent);
+ sub_v3_v3v3(insetCos[1], origCos[1], cent);
+ sub_v3_v3v3(insetCos[2], origCos[2], cent);
+ sub_v3_v3v3(insetCos[3], origCos[3], cent);
- VecMulf(insetCos[0], inset);
- VecMulf(insetCos[1], inset);
- VecMulf(insetCos[2], inset);
- VecMulf(insetCos[3], inset);
+ mul_v3_fl(insetCos[0], inset);
+ mul_v3_fl(insetCos[1], inset);
+ mul_v3_fl(insetCos[2], inset);
+ mul_v3_fl(insetCos[3], inset);
- VecAddf(insetCos[0], insetCos[0], cent);
- VecAddf(insetCos[1], insetCos[1], cent);
- VecAddf(insetCos[2], insetCos[2], cent);
- VecAddf(insetCos[3], insetCos[3], cent);
+ add_v3_v3v3(insetCos[0], insetCos[0], cent);
+ add_v3_v3v3(insetCos[1], insetCos[1], cent);
+ add_v3_v3v3(insetCos[2], insetCos[2], cent);
+ add_v3_v3v3(insetCos[3], insetCos[3], cent);
}
@@ -1793,17 +1793,17 @@ static void scale_tri(float insetCos[4][3], float *origCos[4], const float inset
cent[1] = (origCos[0][1] + origCos[1][1] + origCos[2][1]) / 3.0f;
cent[2] = (origCos[0][2] + origCos[1][2] + origCos[2][2]) / 3.0f;
- VecSubf(insetCos[0], origCos[0], cent);
- VecSubf(insetCos[1], origCos[1], cent);
- VecSubf(insetCos[2], origCos[2], cent);
+ sub_v3_v3v3(insetCos[0], origCos[0], cent);
+ sub_v3_v3v3(insetCos[1], origCos[1], cent);
+ sub_v3_v3v3(insetCos[2], origCos[2], cent);
- VecMulf(insetCos[0], inset);
- VecMulf(insetCos[1], inset);
- VecMulf(insetCos[2], inset);
+ mul_v3_fl(insetCos[0], inset);
+ mul_v3_fl(insetCos[1], inset);
+ mul_v3_fl(insetCos[2], inset);
- VecAddf(insetCos[0], insetCos[0], cent);
- VecAddf(insetCos[1], insetCos[1], cent);
- VecAddf(insetCos[2], insetCos[2], cent);
+ add_v3_v3v3(insetCos[0], insetCos[0], cent);
+ add_v3_v3v3(insetCos[1], insetCos[1], cent);
+ add_v3_v3v3(insetCos[2], insetCos[2], cent);
}
@@ -1891,22 +1891,22 @@ static void rect_to_uvspace_ortho(
uv[0] = bucket_bounds->xmax;
uv[1] = bucket_bounds->ymin;
BarycentricWeights2f(uv, v1coSS, v2coSS, v3coSS, w);
- Vec2Lerp3f(bucket_bounds_uv[flip?3:0], uv1co, uv2co, uv3co, w);
+ interp_v2_v2v2v2(bucket_bounds_uv[flip?3:0], uv1co, uv2co, uv3co, w);
//uv[0] = bucket_bounds->xmax; // set above
uv[1] = bucket_bounds->ymax;
BarycentricWeights2f(uv, v1coSS, v2coSS, v3coSS, w);
- Vec2Lerp3f(bucket_bounds_uv[flip?2:1], uv1co, uv2co, uv3co, w);
+ interp_v2_v2v2v2(bucket_bounds_uv[flip?2:1], uv1co, uv2co, uv3co, w);
uv[0] = bucket_bounds->xmin;
//uv[1] = bucket_bounds->ymax; // set above
BarycentricWeights2f(uv, v1coSS, v2coSS, v3coSS, w);
- Vec2Lerp3f(bucket_bounds_uv[flip?1:2], uv1co, uv2co, uv3co, w);
+ interp_v2_v2v2v2(bucket_bounds_uv[flip?1:2], uv1co, uv2co, uv3co, w);
//uv[0] = bucket_bounds->xmin; // set above
uv[1] = bucket_bounds->ymin;
BarycentricWeights2f(uv, v1coSS, v2coSS, v3coSS, w);
- Vec2Lerp3f(bucket_bounds_uv[flip?0:3], uv1co, uv2co, uv3co, w);
+ interp_v2_v2v2v2(bucket_bounds_uv[flip?0:3], uv1co, uv2co, uv3co, w);
}
/* same as above but use BarycentricWeightsPersp2f */
@@ -1925,22 +1925,22 @@ static void rect_to_uvspace_persp(
uv[0] = bucket_bounds->xmax;
uv[1] = bucket_bounds->ymin;
BarycentricWeightsPersp2f(uv, v1coSS, v2coSS, v3coSS, w);
- Vec2Lerp3f(bucket_bounds_uv[flip?3:0], uv1co, uv2co, uv3co, w);
+ interp_v2_v2v2v2(bucket_bounds_uv[flip?3:0], uv1co, uv2co, uv3co, w);
//uv[0] = bucket_bounds->xmax; // set above
uv[1] = bucket_bounds->ymax;
BarycentricWeightsPersp2f(uv, v1coSS, v2coSS, v3coSS, w);
- Vec2Lerp3f(bucket_bounds_uv[flip?2:1], uv1co, uv2co, uv3co, w);
+ interp_v2_v2v2v2(bucket_bounds_uv[flip?2:1], uv1co, uv2co, uv3co, w);
uv[0] = bucket_bounds->xmin;
//uv[1] = bucket_bounds->ymax; // set above
BarycentricWeightsPersp2f(uv, v1coSS, v2coSS, v3coSS, w);
- Vec2Lerp3f(bucket_bounds_uv[flip?1:2], uv1co, uv2co, uv3co, w);
+ interp_v2_v2v2v2(bucket_bounds_uv[flip?1:2], uv1co, uv2co, uv3co, w);
//uv[0] = bucket_bounds->xmin; // set above
uv[1] = bucket_bounds->ymin;
BarycentricWeightsPersp2f(uv, v1coSS, v2coSS, v3coSS, w);
- Vec2Lerp3f(bucket_bounds_uv[flip?0:3], uv1co, uv2co, uv3co, w);
+ interp_v2_v2v2v2(bucket_bounds_uv[flip?0:3], uv1co, uv2co, uv3co, w);
}
/* This works as we need it to but we can save a few steps and not use it */
@@ -1967,7 +1967,7 @@ static float angle_2d_clockwise(const float p1[2], const float p2[2], const floa
/* limit must be a fraction over 1.0f */
static int IsectPT2Df_limit(float pt[2], float v1[2], float v2[2], float v3[2], float limit)
{
- return ((AreaF2Dfl(pt,v1,v2) + AreaF2Dfl(pt,v2,v3) + AreaF2Dfl(pt,v3,v1)) / (AreaF2Dfl(v1,v2,v3))) < limit;
+ return ((area_tri_v2(pt,v1,v2) + area_tri_v2(pt,v2,v3) + area_tri_v2(pt,v3,v1)) / (area_tri_v2(v1,v2,v3))) < limit;
}
/* Clip the face by a bucket and set the uv-space bucket_bounds_uv
@@ -2184,13 +2184,13 @@ static void project_bucket_clip_face(
if (is_ortho) {
for(i=0; i<(*tot); i++) {
BarycentricWeights2f(isectVCosSS[i], v1coSS, v2coSS, v3coSS, w);
- Vec2Lerp3f(bucket_bounds_uv[i], uv1co, uv2co, uv3co, w);
+ interp_v2_v2v2v2(bucket_bounds_uv[i], uv1co, uv2co, uv3co, w);
}
}
else {
for(i=0; i<(*tot); i++) {
BarycentricWeightsPersp2f(isectVCosSS[i], v1coSS, v2coSS, v3coSS, w);
- Vec2Lerp3f(bucket_bounds_uv[i], uv1co, uv2co, uv3co, w);
+ interp_v2_v2v2v2(bucket_bounds_uv[i], uv1co, uv2co, uv3co, w);
}
}
}
@@ -2445,8 +2445,8 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
/* a pitty we need to get the worldspace pixel location here */
if(ps->rv3d->rflag & RV3D_CLIPPING) {
- VecLerp3f(wco, ps->dm_mvert[ (*(&mf->v1 + i1)) ].co, ps->dm_mvert[ (*(&mf->v1 + i2)) ].co, ps->dm_mvert[ (*(&mf->v1 + i3)) ].co, w);
- Mat4MulVecfl(ps->ob->obmat, wco);
+ interp_v3_v3v3v3(wco, ps->dm_mvert[ (*(&mf->v1 + i1)) ].co, ps->dm_mvert[ (*(&mf->v1 + i2)) ].co, ps->dm_mvert[ (*(&mf->v1 + i3)) ].co, w);
+ mul_m4_v3(ps->ob->obmat, wco);
if(view3d_test_clipping(ps->rv3d, wco)) {
continue; /* Watch out that no code below this needs to run */
}
@@ -2567,7 +2567,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
line_clip_rect2f(bucket_bounds, vCoSS[fidx1], vCoSS[fidx2], bucket_clip_edges[0], bucket_clip_edges[1])
) {
- ftot = Vec2Lenf(vCoSS[fidx1], vCoSS[fidx2]); /* screenspace edge length */
+ ftot = len_v2v2(vCoSS[fidx1], vCoSS[fidx2]); /* screenspace edge length */
if (ftot > 0.0f) { /* avoid div by zero */
if (mf->v4) {
@@ -2575,19 +2575,19 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
else side= 0;
}
- fac1 = Vec2Lenf(vCoSS[fidx1], bucket_clip_edges[0]) / ftot;
- fac2 = Vec2Lenf(vCoSS[fidx1], bucket_clip_edges[1]) / ftot;
+ fac1 = len_v2v2(vCoSS[fidx1], bucket_clip_edges[0]) / ftot;
+ fac2 = len_v2v2(vCoSS[fidx1], bucket_clip_edges[1]) / ftot;
- Vec2Lerpf(seam_subsection[0], tf_uv_pxoffset[fidx1], tf_uv_pxoffset[fidx2], fac1);
- Vec2Lerpf(seam_subsection[1], tf_uv_pxoffset[fidx1], tf_uv_pxoffset[fidx2], fac2);
+ interp_v2_v2v2(seam_subsection[0], tf_uv_pxoffset[fidx1], tf_uv_pxoffset[fidx2], fac1);
+ interp_v2_v2v2(seam_subsection[1], tf_uv_pxoffset[fidx1], tf_uv_pxoffset[fidx2], fac2);
- Vec2Lerpf(seam_subsection[2], outset_uv[fidx1], outset_uv[fidx2], fac2);
- Vec2Lerpf(seam_subsection[3], outset_uv[fidx1], outset_uv[fidx2], fac1);
+ interp_v2_v2v2(seam_subsection[2], outset_uv[fidx1], outset_uv[fidx2], fac2);
+ interp_v2_v2v2(seam_subsection[3], outset_uv[fidx1], outset_uv[fidx2], fac1);
/* if the bucket_clip_edges values Z values was kept we could avoid this
* Inset needs to be added so occlusion tests wont hit adjacent faces */
- VecLerpf(edge_verts_inset_clip[0], insetCos[fidx1], insetCos[fidx2], fac1);
- VecLerpf(edge_verts_inset_clip[1], insetCos[fidx1], insetCos[fidx2], fac2);
+ interp_v3_v3v3(edge_verts_inset_clip[0], insetCos[fidx1], insetCos[fidx2], fac1);
+ interp_v3_v3v3(edge_verts_inset_clip[1], insetCos[fidx1], insetCos[fidx2], fac2);
if (pixel_bounds_uv(seam_subsection[0], seam_subsection[1], seam_subsection[2], seam_subsection[3], &bounds_px, ibuf->x, ibuf->y, 1)) {
@@ -2604,7 +2604,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
uv[0] = (float)x / ibuf_xf; /* use offset uvs instead */
/* test we're inside uvspace bucket and triangle bounds */
- if (IsectPQ2Df(uv, seam_subsection[0], seam_subsection[1], seam_subsection[2], seam_subsection[3])) {
+ if (isect_point_quad_v2(uv, seam_subsection[0], seam_subsection[1], seam_subsection[2], seam_subsection[3])) {
/* We need to find the closest point along the face edge,
* getting the screen_px_from_*** wont work because our actual location
@@ -2621,11 +2621,11 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
fac = lambda_cp_line2(uv, seam_subsection[0], seam_subsection[1]);
if (fac < 0.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[0]); }
else if (fac > 1.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[1]); }
- else { VecLerpf(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac); }
+ else { interp_v3_v3v3(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac); }
if (!is_ortho) {
pixelScreenCo[3] = 1.0f;
- Mat4MulVec4fl((float(*)[4])ps->projectMat, pixelScreenCo); /* cast because of const */
+ mul_m4_v4((float(*)[4])ps->projectMat, pixelScreenCo); /* cast because of const */
pixelScreenCo[0] = (float)(ps->ar->winx/2.0f)+(ps->ar->winx/2.0f)*pixelScreenCo[0]/pixelScreenCo[3];
pixelScreenCo[1] = (float)(ps->ar->winy/2.0f)+(ps->ar->winy/2.0f)*pixelScreenCo[1]/pixelScreenCo[3];
pixelScreenCo[2] = pixelScreenCo[2]/pixelScreenCo[3]; /* Use the depth for bucket point occlusion */
@@ -2661,10 +2661,10 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
/* a pitty we need to get the worldspace pixel location here */
if(ps->rv3d->rflag & RV3D_CLIPPING) {
- if (side) VecLerp3f(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w);
- else VecLerp3f(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w);
+ if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w);
+ else interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w);
- Mat4MulVecfl(ps->ob->obmat, wco);
+ mul_m4_v3(ps->ob->obmat, wco);
if(view3d_test_clipping(ps->rv3d, wco)) {
continue; /* Watch out that no code below this needs to run */
}
@@ -2824,23 +2824,23 @@ static int project_bucket_face_isect(ProjPaintState *ps, float min[2], float max
p4[0] = bucket_bounds.xmax; p4[1] = bucket_bounds.ymin;
if (mf->v4) {
- if( IsectPQ2Df(p1, v1, v2, v3, v4) || IsectPQ2Df(p2, v1, v2, v3, v4) || IsectPQ2Df(p3, v1, v2, v3, v4) || IsectPQ2Df(p4, v1, v2, v3, v4) ||
+ if( isect_point_quad_v2(p1, v1, v2, v3, v4) || isect_point_quad_v2(p2, v1, v2, v3, v4) || isect_point_quad_v2(p3, v1, v2, v3, v4) || isect_point_quad_v2(p4, v1, v2, v3, v4) ||
/* we can avoid testing v3,v1 because another intersection MUST exist if this intersects */
- (IsectLL2Df(p1, p2, v1, v2) || IsectLL2Df(p1, p2, v2, v3) || IsectLL2Df(p1, p2, v3, v4)) ||
- (IsectLL2Df(p2, p3, v1, v2) || IsectLL2Df(p2, p3, v2, v3) || IsectLL2Df(p2, p3, v3, v4)) ||
- (IsectLL2Df(p3, p4, v1, v2) || IsectLL2Df(p3, p4, v2, v3) || IsectLL2Df(p3, p4, v3, v4)) ||
- (IsectLL2Df(p4, p1, v1, v2) || IsectLL2Df(p4, p1, v2, v3) || IsectLL2Df(p4, p1, v3, v4))
+ (isect_line_line_v2(p1, p2, v1, v2) || isect_line_line_v2(p1, p2, v2, v3) || isect_line_line_v2(p1, p2, v3, v4)) ||
+ (isect_line_line_v2(p2, p3, v1, v2) || isect_line_line_v2(p2, p3, v2, v3) || isect_line_line_v2(p2, p3, v3, v4)) ||
+ (isect_line_line_v2(p3, p4, v1, v2) || isect_line_line_v2(p3, p4, v2, v3) || isect_line_line_v2(p3, p4, v3, v4)) ||
+ (isect_line_line_v2(p4, p1, v1, v2) || isect_line_line_v2(p4, p1, v2, v3) || isect_line_line_v2(p4, p1, v3, v4))
) {
return 1;
}
}
else {
- if( IsectPT2Df(p1, v1, v2, v3) || IsectPT2Df(p2, v1, v2, v3) || IsectPT2Df(p3, v1, v2, v3) || IsectPT2Df(p4, v1, v2, v3) ||
+ if( isect_point_tri_v2(p1, v1, v2, v3) || isect_point_tri_v2(p2, v1, v2, v3) || isect_point_tri_v2(p3, v1, v2, v3) || isect_point_tri_v2(p4, v1, v2, v3) ||
/* we can avoid testing v3,v1 because another intersection MUST exist if this intersects */
- (IsectLL2Df(p1, p2, v1, v2) || IsectLL2Df(p1, p2, v2, v3)) ||
- (IsectLL2Df(p2, p3, v1, v2) || IsectLL2Df(p2, p3, v2, v3)) ||
- (IsectLL2Df(p3, p4, v1, v2) || IsectLL2Df(p3, p4, v2, v3)) ||
- (IsectLL2Df(p4, p1, v1, v2) || IsectLL2Df(p4, p1, v2, v3))
+ (isect_line_line_v2(p1, p2, v1, v2) || isect_line_line_v2(p1, p2, v2, v3)) ||
+ (isect_line_line_v2(p2, p3, v1, v2) || isect_line_line_v2(p2, p3, v2, v3)) ||
+ (isect_line_line_v2(p3, p4, v1, v2) || isect_line_line_v2(p3, p4, v2, v3)) ||
+ (isect_line_line_v2(p4, p1, v1, v2) || isect_line_line_v2(p4, p1, v2, v3))
) {
return 1;
}
@@ -3000,18 +3000,18 @@ static void project_paint_begin(ProjPaintState *ps)
view3d_get_object_project_mat(ps->rv3d, ps->ob, ps->projectMat);
/* viewDir - object relative */
- Mat4Invert(ps->ob->imat, ps->ob->obmat);
- Mat3CpyMat4(mat, ps->rv3d->viewinv);
- Mat3MulVecfl(mat, ps->viewDir);
- Mat3CpyMat4(mat, ps->ob->imat);
- Mat3MulVecfl(mat, ps->viewDir);
- Normalize(ps->viewDir);
+ invert_m4_m4(ps->ob->imat, ps->ob->obmat);
+ copy_m3_m4(mat, ps->rv3d->viewinv);
+ mul_m3_v3(mat, ps->viewDir);
+ copy_m3_m4(mat, ps->ob->imat);
+ mul_m3_v3(mat, ps->viewDir);
+ normalize_v3(ps->viewDir);
/* viewPos - object relative */
VECCOPY(ps->viewPos, ps->rv3d->viewinv[3]);
- Mat3CpyMat4(mat, ps->ob->imat);
- Mat3MulVecfl(mat, ps->viewPos);
- VecAddf(ps->viewPos, ps->viewPos, ps->ob->imat[3]);
+ copy_m3_m4(mat, ps->ob->imat);
+ mul_m3_v3(mat, ps->viewPos);
+ add_v3_v3v3(ps->viewPos, ps->viewPos, ps->ob->imat[3]);
{ /* only use these for running 'get_view3d_viewplane' */
rctf viewplane;
@@ -3045,7 +3045,7 @@ static void project_paint_begin(ProjPaintState *ps)
if (ps->is_ortho) {
for(a=0; a < ps->dm_totvert; a++, projScreenCo++) {
VECCOPY((*projScreenCo), ps->dm_mvert[a].co);
- Mat4MulVecfl(ps->projectMat, (*projScreenCo));
+ mul_m4_v3(ps->projectMat, (*projScreenCo));
/* screen space, not clamped */
(*projScreenCo)[0] = (float)(ps->ar->winx/2.0f)+(ps->ar->winx/2.0f)*(*projScreenCo)[0];
@@ -3058,7 +3058,7 @@ static void project_paint_begin(ProjPaintState *ps)
VECCOPY((*projScreenCo), ps->dm_mvert[a].co);
(*projScreenCo)[3] = 1.0f;
- Mat4MulVec4fl(ps->projectMat, (*projScreenCo));
+ mul_m4_v4(ps->projectMat, (*projScreenCo));
if ((*projScreenCo)[3] > ps->clipsta) {
@@ -3152,14 +3152,14 @@ static void project_paint_begin(ProjPaintState *ps)
no[2] = (float)(v->no[2] / 32767.0f);
if (ps->is_ortho) {
- if (NormalizedVecAngle2(ps->viewDir, no) >= ps->normal_angle) { /* 1 vert of this face is towards us */
+ if (angle_normalized_v3v3(ps->viewDir, no) >= ps->normal_angle) { /* 1 vert of this face is towards us */
ps->vertFlags[a] |= PROJ_VERT_CULL;
}
}
else {
- VecSubf(viewDirPersp, ps->viewPos, v->co);
- Normalize(viewDirPersp);
- if (NormalizedVecAngle2(viewDirPersp, no) >= ps->normal_angle) { /* 1 vert of this face is towards us */
+ sub_v3_v3v3(viewDirPersp, ps->viewPos, v->co);
+ normalize_v3(viewDirPersp);
+ if (angle_normalized_v3v3(viewDirPersp, no) >= ps->normal_angle) { /* 1 vert of this face is towards us */
ps->vertFlags[a] |= PROJ_VERT_CULL;
}
}
@@ -3298,10 +3298,10 @@ static void project_paint_begin_clone(ProjPaintState *ps, int mouse[2])
float projCo[4];
float *curs= give_cursor(ps->scene, ps->v3d);
VECCOPY(projCo, curs);
- Mat4MulVecfl(ps->ob->imat, projCo);
+ mul_m4_v3(ps->ob->imat, projCo);
projCo[3] = 1.0f;
- Mat4MulVec4fl(ps->projectMat, projCo);
+ mul_m4_v4(ps->projectMat, projCo);
ps->cloneOffset[0] = mouse[0] - ((float)(ps->ar->winx/2.0f)+(ps->ar->winx/2.0f)*projCo[0]/projCo[3]);
ps->cloneOffset[1] = mouse[1] - ((float)(ps->ar->winy/2.0f)+(ps->ar->winy/2.0f)*projCo[1]/projCo[3]);
}
@@ -3742,7 +3742,7 @@ static void *do_projectpaint_thread(void *ph_v)
projPixel = (ProjPixel *)node->link;
- /*dist = Vec2Lenf(projPixel->projCoSS, pos);*/ /* correct but uses a sqrtf */
+ /*dist = len_v2v2(projPixel->projCoSS, pos);*/ /* correct but uses a sqrtf */
dist_nosqrt = Vec2Lenf_nosqrt(projPixel->projCoSS, pos);
/*if (dist < s->brush->size) {*/ /* correct but uses a sqrtf */
@@ -3811,7 +3811,7 @@ static void *do_projectpaint_thread(void *ph_v)
}
break;
case PAINT_TOOL_SMEAR:
- Vec2Subf(co, projPixel->projCoSS, pos_ofs);
+ sub_v2_v2v2(co, projPixel->projCoSS, pos_ofs);
if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, rgba, alpha, mask, smearArena, &smearPixels_f, co);
else do_projectpaint_smear(ps, projPixel, rgba, alpha, mask, smearArena, &smearPixels, co);
@@ -4200,14 +4200,14 @@ static int imapaint_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *p
static int texpaint_break_stroke(float *prevuv, float *fwuv, float *bkuv, float *uv)
{
float d1[2], d2[2];
- float mismatch = Vec2Lenf(fwuv, uv);
- float len1 = Vec2Lenf(prevuv, fwuv);
- float len2 = Vec2Lenf(bkuv, uv);
+ float mismatch = len_v2v2(fwuv, uv);
+ float len1 = len_v2v2(prevuv, fwuv);
+ float len2 = len_v2v2(bkuv, uv);
- Vec2Subf(d1, fwuv, prevuv);
- Vec2Subf(d2, uv, bkuv);
+ sub_v2_v2v2(d1, fwuv, prevuv);
+ sub_v2_v2v2(d2, uv, bkuv);
- return ((Inp2f(d1, d2) < 0.0f) || (mismatch > MAX2(len1, len2)*2));
+ return ((dot_v2v2(d1, d2) < 0.0f) || (mismatch > MAX2(len1, len2)*2));
}
/* ImagePaint Common */
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 6e256bee7f2..0b86034958f 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -41,7 +41,7 @@
#include "WM_api.h"
#include "WM_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "PIL_time.h"
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 15104068350..24d9e0f4bc1 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -13,7 +13,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BKE_brush.h"
#include "BKE_context.h"
@@ -43,9 +43,9 @@ static void imapaint_project(Object *ob, float *model, float *proj, float *co, f
VECCOPY(pco, co);
pco[3]= 1.0f;
- Mat4MulVecfl(ob->obmat, pco);
- Mat4MulVecfl((float(*)[4])model, pco);
- Mat4MulVec4fl((float(*)[4])proj, pco);
+ mul_m4_v3(ob->obmat, pco);
+ mul_m4_v3((float(*)[4])model, pco);
+ mul_m4_v4((float(*)[4])proj, pco);
}
static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, float *co, float *w)
@@ -79,15 +79,15 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl
wmat[0][1]= pv1[1]; wmat[1][1]= pv2[1]; wmat[2][1]= pv3[1];
wmat[0][2]= pv1[3]; wmat[1][2]= pv2[3]; wmat[2][2]= pv3[3];
- Mat3Inv(invwmat, wmat);
- Mat3MulVecfl(invwmat, h);
+ invert_m3_m3(invwmat, wmat);
+ mul_m3_v3(invwmat, h);
VECCOPY(w, h);
/* w is still divided by perspdiv, make it sum to one */
divw= w[0] + w[1] + w[2];
if(divw != 0.0f)
- VecMulf(w, 1.0f/divw);
+ mul_v3_fl(w, 1.0f/divw);
}
/* compute uv coordinates of mouse in face */
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 2045397f3c9..35723769f88 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -42,7 +42,7 @@
#include "IMB_imbuf_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_ghash.h"
#include "DNA_anim_types.h"
@@ -1379,9 +1379,9 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *event)
// if(ob->lay & v3d->lay); else error("Active object is not in this layer");
/* imat for normals */
- Mat4MulMat4(mat, ob->obmat, wpd->vc.rv3d->viewmat);
- Mat4Invert(imat, mat);
- Mat3CpyMat4(wpd->wpimat, imat);
+ mul_m4_m4m4(mat, ob->obmat, wpd->vc.rv3d->viewmat);
+ invert_m4_m4(imat, mat);
+ copy_m3_m4(wpd->wpimat, imat);
/* if mirror painting, find the other group */
if(me->editflag & ME_EDIT_MIRROR_X) {
@@ -1437,7 +1437,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
mval[0]-= vc->ar->winrct.xmin;
mval[1]-= vc->ar->winrct.ymin;
- Mat4SwapMat4(wpd->vc.rv3d->persmat, mat);
+ swap_m4m4(wpd->vc.rv3d->persmat, mat);
/* which faces are involved */
if(wp->flag & VP_AREA) {
@@ -1562,7 +1562,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
}
}
- Mat4SwapMat4(vc->rv3d->persmat, mat);
+ swap_m4m4(vc->rv3d->persmat, mat);
DAG_id_flush_update(ob->data, OB_RECALC_DATA);
ED_region_tag_redraw(vc->ar);
@@ -1795,9 +1795,9 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent
copy_vpaint_prev(vp, (unsigned int *)me->mcol, me->totface);
/* some old cruft to sort out later */
- Mat4MulMat4(mat, ob->obmat, vpd->vc.rv3d->viewmat);
- Mat4Invert(imat, mat);
- Mat3CpyMat4(vpd->vpimat, imat);
+ mul_m4_m4m4(mat, ob->obmat, vpd->vc.rv3d->viewmat);
+ invert_m4_m4(imat, mat);
+ copy_m3_m4(vpd->vpimat, imat);
return 1;
}
@@ -1871,14 +1871,14 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
else totindex= 0;
}
- Mat4SwapMat4(vc->rv3d->persmat, mat);
+ swap_m4m4(vc->rv3d->persmat, mat);
for(index=0; index<totindex; index++) {
if(indexar[index] && indexar[index]<=me->totface)
vpaint_paint_face(vp, vpd, ob, indexar[index]-1, mval);
}
- Mat4SwapMat4(vc->rv3d->persmat, mat);
+ swap_m4m4(vc->rv3d->persmat, mat);
/* was disabled because it is slow, but necessary for blur */
if(vp->mode == VP_BLUR)
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index c4c7f436f12..7575464fd57 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -32,7 +32,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
@@ -256,12 +256,12 @@ static void add_norm_if(float view_vec[3], float out[3], float out_flip[3], cons
{
float fno[3] = {no[0], no[1], no[2]};
- Normalize(fno);
+ normalize_v3(fno);
- if((Inpf(view_vec, fno)) > 0) {
- VecAddf(out, out, fno);
+ if((dot_v3v3(view_vec, fno)) > 0) {
+ add_v3_v3v3(out, out, fno);
} else {
- VecAddf(out_flip, out_flip, fno); /* out_flip is used when out is {0,0,0} */
+ add_v3_v3v3(out_flip, out_flip, fno); /* out_flip is used when out is {0,0,0} */
}
}
@@ -291,7 +291,7 @@ static void calc_area_normal(Sculpt *sd, SculptSession *ss, float out[3], const
VECCOPY(out, out_flip);
}
- Normalize(out);
+ normalize_v3(out);
if(out_dir) {
out[0] = out_dir[0] * view + out[0] * (10-view);
@@ -299,7 +299,7 @@ static void calc_area_normal(Sculpt *sd, SculptSession *ss, float out[3], const
out[2] = out_dir[2] * view + out[2] * (10-view);
}
- Normalize(out);
+ normalize_v3(out);
}
static void do_draw_brush(Sculpt *sd, SculptSession *ss, const ListBase* active_verts)
@@ -349,7 +349,7 @@ static void neighbor_average(SculptSession *ss, float avg[3], const int vert)
/* Don't modify corner vertices */
if(ncount==1) {
- VecCopyf(avg, ss->mvert[vert].co);
+ copy_v3_v3(avg, ss->mvert[vert].co);
return;
}
@@ -365,7 +365,7 @@ static void neighbor_average(SculptSession *ss, float avg[3], const int vert)
for(i=0; i<(f->v4?4:3); ++i) {
if(i != skip && (ncount!=2 || BLI_countlist(&ss->fmap[(&f->v1)[i]]) <= 2)) {
- VecAddf(avg, avg, ss->mvert[(&f->v1)[i]].co);
+ add_v3_v3v3(avg, avg, ss->mvert[(&f->v1)[i]].co);
++total;
}
}
@@ -374,9 +374,9 @@ static void neighbor_average(SculptSession *ss, float avg[3], const int vert)
}
if(total>0)
- VecMulf(avg, 1.0f / total);
+ mul_v3_fl(avg, 1.0f / total);
else
- VecCopyf(avg, ss->mvert[vert].co);
+ copy_v3_v3(avg, ss->mvert[vert].co);
}
static void do_smooth_brush(Sculpt *s, SculptSession *ss, const ListBase* active_verts)
@@ -443,14 +443,14 @@ static void do_grab_brush(Sculpt *sd, SculptSession *ss)
float grab_delta[3];
float *buffer = ss->drawobject!=0?(float *)GPU_buffer_lock( ss->drawobject->vertices ):0;
- VecCopyf(grab_delta, ss->cache->grab_delta_symmetry);
+ copy_v3_v3(grab_delta, ss->cache->grab_delta_symmetry);
while(node) {
float *co= ss->mvert[node->Index].co;
- VecCopyf(add, grab_delta);
- VecMulf(add, node->Fade);
- VecAddf(add, add, co);
+ copy_v3_v3(add, grab_delta);
+ mul_v3_fl(add, node->Fade);
+ add_v3_v3v3(add, add, co);
if( buffer != 0 ) {
IndexLink *cur = &ss->drawobject->indices[node->Index];
@@ -526,11 +526,11 @@ static void do_inflate_brush(Sculpt *s, SculptSession *ss, const ListBase *activ
add[0]= no[0]/ 32767.0f;
add[1]= no[1]/ 32767.0f;
add[2]= no[2]/ 32767.0f;
- VecMulf(add, node->Fade * ss->cache->radius);
+ mul_v3_fl(add, node->Fade * ss->cache->radius);
add[0]*= ss->cache->scale[0];
add[1]*= ss->cache->scale[1];
add[2]*= ss->cache->scale[2];
- VecAddf(add, add, co);
+ add_v3_v3v3(add, add, co);
if( buffer != 0 ) {
IndexLink *cur = &ss->drawobject->indices[node->Index];
@@ -567,8 +567,8 @@ static void calc_flatten_center(SculptSession *ss, ActiveData *node, float co[3]
co[0] = co[1] = co[2] = 0.0f;
for(i = 0; i < FLATTEN_SAMPLE_SIZE; ++i)
- VecAddf(co, co, ss->mvert[outer[i]->Index].co);
- VecMulf(co, 1.0f / FLATTEN_SAMPLE_SIZE);
+ add_v3_v3v3(co, co, ss->mvert[outer[i]->Index].co);
+ mul_v3_fl(co, 1.0f / FLATTEN_SAMPLE_SIZE);
}
/* Projects a point onto a plane along the plane's normal */
@@ -577,12 +577,12 @@ static void point_plane_project(float intr[3], float co[3], float plane_normal[3
float p1[3], sub1[3], sub2[3];
/* Find the intersection between squash-plane and vertex (along the area normal) */
- VecSubf(p1, co, plane_normal);
- VecSubf(sub1, plane_center, p1);
- VecSubf(sub2, co, p1);
- VecSubf(intr, co, p1);
- VecMulf(intr, Inpf(plane_normal, sub1) / Inpf(plane_normal, sub2));
- VecAddf(intr, intr, p1);
+ sub_v3_v3v3(p1, co, plane_normal);
+ sub_v3_v3v3(sub1, plane_center, p1);
+ sub_v3_v3v3(sub2, co, p1);
+ sub_v3_v3v3(intr, co, p1);
+ mul_v3_fl(intr, dot_v3v3(plane_normal, sub1) / dot_v3v3(plane_normal, sub2));
+ add_v3_v3v3(intr, intr, p1);
}
static int plane_point_side(float co[3], float plane_normal[3], float plane_center[3], int flip)
@@ -590,8 +590,8 @@ static int plane_point_side(float co[3], float plane_normal[3], float plane_cent
float delta[3];
float d;
- VecSubf(delta, co, plane_center);
- d = Inpf(plane_normal, delta);
+ sub_v3_v3v3(delta, co, plane_center);
+ d = dot_v3v3(plane_normal, delta);
if(flip)
d = -d;
@@ -629,22 +629,22 @@ static void do_flatten_clay_brush(Sculpt *sd, SculptSession *ss, const ListBase
/* Find the intersection between squash-plane and vertex (along the area normal) */
point_plane_project(intr, co, area_normal, cntr);
- VecSubf(val, intr, co);
+ sub_v3_v3v3(val, intr, co);
if(clay) {
if(bstr > FLT_EPSILON)
- VecMulf(val, node->Fade / bstr);
+ mul_v3_fl(val, node->Fade / bstr);
else
- VecMulf(val, node->Fade);
+ mul_v3_fl(val, node->Fade);
/* Clay displacement */
val[0]+=area_normal[0] * ss->cache->scale[0]*node->Fade;
val[1]+=area_normal[1] * ss->cache->scale[1]*node->Fade;
val[2]+=area_normal[2] * ss->cache->scale[2]*node->Fade;
}
else
- VecMulf(val, fabs(node->Fade));
+ mul_v3_fl(val, fabs(node->Fade));
- VecAddf(val, val, co);
+ add_v3_v3v3(val, val, co);
if( buffer != 0 ) {
IndexLink *cur = &ss->drawobject->indices[node->Index];
@@ -747,7 +747,7 @@ static float tex_strength(Sculpt *sd, SculptSession *ss, float *point, const flo
/* If the active area is being applied for symmetry, flip it
across the symmetry axis in order to project it. This insures
that the brush texture will be oriented correctly. */
- VecCopyf(flip, point);
+ copy_v3_v3(flip, point);
flip_coord(flip, flip, ss->cache->symmetry);
projectf(ss->cache->mats, flip, point_2d);
@@ -852,7 +852,7 @@ static void do_brush_action(Sculpt *sd, SculptSession *ss, StrokeCache *cache)
if(ss->multires || ss->projverts[i].inside) {
//vert= ss->vertexcosnos ? &ss->vertexcosnos[i*6] : a->verts[i].co;
vert= ss->mvert[i].co;
- av_dist= VecLenf(ss->cache->location, vert);
+ av_dist= len_v3v3(ss->cache->location, vert);
if(av_dist < cache->radius) {
adata= (ActiveData*)MEM_mallocN(sizeof(ActiveData), "ActiveData");
@@ -911,7 +911,7 @@ static void do_brush_action(Sculpt *sd, SculptSession *ss, StrokeCache *cache)
for(; adata; adata= adata->next)
if(adata->Index < keyblock->totelem)
- VecCopyf(&co[adata->Index*3], me->mvert[adata->Index].co);
+ copy_v3_v3(&co[adata->Index*3], me->mvert[adata->Index].co);
}
}
@@ -940,8 +940,8 @@ static void do_symmetrical_brush_actions(Sculpt *sd, SculptSession *ss)
const char symm = sd->flags & 7;
int i;
- VecCopyf(cache->location, cache->true_location);
- VecCopyf(cache->grab_delta_symmetry, cache->grab_delta);
+ copy_v3_v3(cache->location, cache->true_location);
+ copy_v3_v3(cache->grab_delta_symmetry, cache->grab_delta);
cache->symmetry = 0;
do_brush_action(sd, ss, cache);
@@ -963,15 +963,15 @@ static void add_face_normal(vec3f *norm, MVert *mvert, const MFace* face, float
vec3f s1, s2;
float final[3];
- VecSubf(&s1.x,&a.x,&b.x);
- VecSubf(&s2.x,&c.x,&b.x);
+ sub_v3_v3v3(&s1.x,&a.x,&b.x);
+ sub_v3_v3v3(&s2.x,&c.x,&b.x);
final[0] = s1.y * s2.z - s1.z * s2.y;
final[1] = s1.z * s2.x - s1.x * s2.z;
final[2] = s1.x * s2.y - s1.y * s2.x;
if(fn)
- VecCopyf(fn, final);
+ copy_v3_v3(fn, final);
norm->x+= final[0];
norm->y+= final[1];
@@ -994,7 +994,7 @@ static void update_damaged_vert(SculptSession *ss, ListBase *lb)
add_face_normal(&norm, ss->mvert, &ss->mface[face->index], fn);
face= face->next;
}
- Normalize(&norm.x);
+ normalize_v3(&norm.x);
ss->mvert[vert->Index].no[0]=norm.x*32767;
ss->mvert[vert->Index].no[1]=norm.y*32767;
@@ -1010,9 +1010,9 @@ static void update_damaged_vert(SculptSession *ss, ListBase *lb)
else {
float norm[3];
if( ss->mface[i].v4 )
- CalcNormFloat4(ss->mvert[ss->mface[i].v1].co, ss->mvert[ss->mface[i].v2].co, ss->mvert[ss->mface[i].v3].co, ss->mvert[ss->mface[i].v4].co, norm);
+ normal_quad_v3( norm,ss->mvert[ss->mface[i].v1].co, ss->mvert[ss->mface[i].v2].co, ss->mvert[ss->mface[i].v3].co, ss->mvert[ss->mface[i].v4].co);
else
- CalcNormFloat(ss->mvert[ss->mface[i].v1].co, ss->mvert[ss->mface[i].v2].co, ss->mvert[ss->mface[i].v3].co, norm);
+ normal_tri_v3( norm,ss->mvert[ss->mface[i].v1].co, ss->mvert[ss->mface[i].v2].co, ss->mvert[ss->mface[i].v3].co);
VECCOPY(&buffer[(cur->element-cur->element%3)*3],norm);
VECCOPY(&buffer[(cur->element-cur->element%3+1)*3],norm);
VECCOPY(&buffer[(cur->element-cur->element%3+2)*3],norm);
@@ -1259,7 +1259,7 @@ static float unproject_brush_radius(SculptSession *ss, float offset)
view3d_unproject(ss->cache->mats, brush_edge, ss->cache->initial_mouse[0] + offset,
ss->cache->initial_mouse[1], ss->cache->depth);
- return VecLenf(ss->cache->true_location, brush_edge);
+ return len_v3v3(ss->cache->true_location, brush_edge);
}
static void sculpt_cache_free(StrokeCache *cache)
@@ -1318,7 +1318,7 @@ static void sculpt_update_cache_invariants(Sculpt *sd, SculptSession *ss, bConte
ss->mesh_co_orig= MEM_mallocN(sizeof(float) * 3 * ss->totvert,
"sculpt mesh vertices copy");
for(i = 0; i < ss->totvert; ++i)
- VecCopyf(ss->mesh_co_orig[i], ss->mvert[i].co);
+ copy_v3_v3(ss->mesh_co_orig[i], ss->mvert[i].co);
}
if(brush->flag & BRUSH_ANCHORED) {
@@ -1333,7 +1333,7 @@ static void sculpt_update_cache_invariants(Sculpt *sd, SculptSession *ss, bConte
float *fn = ss->face_normals;
cache->face_norms= MEM_mallocN(sizeof(float) * 3 * ss->totface, "Sculpt face norms");
for(i = 0; i < ss->totface; ++i, fn += 3)
- VecCopyf(cache->face_norms[i], fn);
+ copy_v3_v3(cache->face_norms[i], fn);
}
}
}
@@ -1400,8 +1400,8 @@ static void sculpt_update_cache_variants(Sculpt *sd, SculptSession *ss, PointerR
if(brush->sculpt_tool == SCULPT_TOOL_GRAB) {
view3d_unproject(cache->mats, grab_location, cache->mouse[0], cache->mouse[1], cache->depth);
if(!cache->first_time)
- VecSubf(cache->grab_delta, grab_location, cache->old_grab_location);
- VecCopyf(cache->old_grab_location, grab_location);
+ sub_v3_v3v3(cache->grab_delta, grab_location, cache->old_grab_location);
+ copy_v3_v3(cache->old_grab_location, grab_location);
}
}
@@ -1477,7 +1477,7 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss)
buffer= (float *)GPU_buffer_lock(ss->drawobject->normals);
for(i = 0; i < ss->totvert; ++i) {
- VecCopyf(ss->mvert[i].co, ss->mesh_co_orig[i]);
+ copy_v3_v3(ss->mvert[i].co, ss->mesh_co_orig[i]);
ss->mvert[i].no[0] = cache->orig_norms[i][0];
ss->mvert[i].no[1] = cache->orig_norms[i][1];
ss->mvert[i].no[2] = cache->orig_norms[i][2];
@@ -1495,7 +1495,7 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss)
if(ss->face_normals) {
float *fn = ss->face_normals;
for(i = 0; i < ss->totface; ++i, fn += 3)
- VecCopyf(fn, cache->face_norms[i]);
+ copy_v3_v3(fn, cache->face_norms[i]);
}
if(brush->sculpt_tool == SCULPT_TOOL_LAYER)
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index 7f2e1bd09e4..77cfc2cd484 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -41,7 +41,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
/* Types --------------------------------------------------------------- */
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 0bcf4b037cb..a7c012fc654 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -39,7 +39,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_anim_types.h"
#include "DNA_action_types.h"
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index cc8688031b0..c4f2e40e958 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -36,7 +36,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_dlrbTree.h"
#include "DNA_anim_types.h"
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 07de15a26b4..870a67de330 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -39,7 +39,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
diff --git a/source/blender/editors/space_api/space.c b/source/blender/editors/space_api/space.c
index 3112cfffb22..5318eb33b1f 100644
--- a/source/blender/editors/space_api/space.c
+++ b/source/blender/editors/space_api/space.c
@@ -32,7 +32,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BKE_context.h"
#include "BKE_screen.h"
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index f05c652c39d..2c918bd9b30 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -38,7 +38,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index c6565eb6ecc..3dca5a4db4b 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -36,7 +36,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 91d917acfe7..576736f026f 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -43,7 +43,7 @@
#include "BLO_readfile.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_storage_types.h"
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index a4c98ecbf8e..38289e98391 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -41,7 +41,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 40b7c071141..6e0878972f8 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -42,7 +42,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_anim_types.h"
#include "DNA_action_types.h"
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index b467d7b4ca0..2088ee4030c 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -39,7 +39,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_anim_types.h"
#include "DNA_action_types.h"
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 09fde389f6f..8d2e2921b7f 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -36,7 +36,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_anim_types.h"
#include "DNA_action_types.h"
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index ee4e371e1f1..40fe3393a60 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -41,7 +41,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 342afab7534..f076bb5549e 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -38,7 +38,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 87b6ec8bb71..a184ea2b2c4 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -44,7 +44,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 8d7295e9f20..9ef7a4d9ae4 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -50,7 +50,7 @@
#include "BKE_report.h"
#include "BKE_screen.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "IMB_imbuf.h"
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 36d1573a12c..8478b40092f 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -40,7 +40,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 518553c9a7a..c28e86a6fa6 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -37,7 +37,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c
index c8f96fe3373..e159af65c74 100644
--- a/source/blender/editors/space_logic/logic_buttons.c
+++ b/source/blender/editors/space_logic/logic_buttons.c
@@ -37,7 +37,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BKE_context.h"
#include "BKE_global.h"
diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c
index 836ac4c6659..62ed6a0a769 100644
--- a/source/blender/editors/space_logic/space_logic.c
+++ b/source/blender/editors/space_logic/space_logic.c
@@ -40,7 +40,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BKE_context.h"
#include "BKE_screen.h"
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index b193b89d65a..3d43265b862 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -41,7 +41,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 07dc3f0ad89..a9380c03346 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -53,7 +53,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_animsys.h"
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index b21f37ab678..c32058545fb 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -56,7 +56,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_dlrbTree.h"
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index e53ccd004db..12e43465a29 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -42,7 +42,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_animsys.h"
diff --git a/source/blender/editors/space_nla/nla_header.c b/source/blender/editors/space_nla/nla_header.c
index a2524a1b2dc..0c0deaf75ef 100644
--- a/source/blender/editors/space_nla/nla_header.c
+++ b/source/blender/editors/space_nla/nla_header.c
@@ -41,7 +41,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_animsys.h"
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 6c940f32c24..d210016d201 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -41,7 +41,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_animsys.h"
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index 7c8f2aef9d0..801434c4794 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -41,7 +41,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_animsys.h"
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 5f2f75b7b6f..743f6e24d05 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -39,7 +39,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_animsys.h"
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 110fb709db8..9a17a43620f 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -32,7 +32,7 @@
#include <string.h>
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_ID.h"
#include "DNA_node_types.h"
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index b45b27f426a..d63b6403028 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -48,7 +48,7 @@
#include "DNA_text_types.h"
#include "DNA_userdef_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_threads.h"
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 9eabf834a76..81c6490fda6 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -64,7 +64,7 @@
#include "BIF_gl.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_storage_types.h"
@@ -2154,7 +2154,7 @@ static int cut_links_intersect(bNodeLink *link, float mcoords[][2], int tot)
for(i=0; i<tot-1; i++)
for(b=0; b<LINK_RESOL-1; b++)
- if(IsectLL2Df(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0)
+ if(isect_line_line_v2(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0)
return 1;
}
return 0;
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 46461eff76b..d8c6272dd77 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -40,7 +40,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 93fdc96e9f7..5c6a8701f18 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -43,7 +43,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
diff --git a/source/blender/editors/space_script/script_ops.c b/source/blender/editors/space_script/script_ops.c
index bf0a7e5769e..fd87705648f 100644
--- a/source/blender/editors/space_script/script_ops.c
+++ b/source/blender/editors/space_script/script_ops.c
@@ -37,7 +37,7 @@
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c
index eae0f77d0e1..fc2f10670df 100644
--- a/source/blender/editors/space_script/space_script.c
+++ b/source/blender/editors/space_script/space_script.c
@@ -37,7 +37,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index bd5259ddb52..824dbd1caa8 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -38,7 +38,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_storage_types.h"
#include "IMB_imbuf_types.h"
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 76bed3772b1..ff9edeaeb4b 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -31,7 +31,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "IMB_imbuf_types.h"
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index bf7d0e78c92..a44b59d1377 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -39,7 +39,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_storage_types.h"
#include "IMB_imbuf_types.h"
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index 3e2f05f2901..94b79fdf685 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -38,7 +38,7 @@
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 381d9241094..2ead426c18a 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -38,7 +38,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_curve_types.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 206070b7095..ed532edb0ec 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -37,7 +37,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
diff --git a/source/blender/editors/space_sound/space_sound.c b/source/blender/editors/space_sound/space_sound.c
index 7cd9988eea0..314e711234a 100644
--- a/source/blender/editors/space_sound/space_sound.c
+++ b/source/blender/editors/space_sound/space_sound.c
@@ -38,7 +38,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index e9cd2644ba6..0b30587c521 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -39,7 +39,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index fca7d6d7a9f..4c2fc1c5015 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -51,7 +51,7 @@
#include "DNA_userdef_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_dlrbTree.h"
#include "BKE_animsys.h"
@@ -510,36 +510,36 @@ static void draw_bone_solid_octahedral(void)
glBegin(GL_TRIANGLES);
/* bottom */
- CalcNormFloat(vec[2], vec[1], vec[0], nor);
+ normal_tri_v3( nor,vec[2], vec[1], vec[0]);
glNormal3fv(nor);
glVertex3fv(vec[2]); glVertex3fv(vec[1]); glVertex3fv(vec[0]);
- CalcNormFloat(vec[3], vec[2], vec[0], nor);
+ normal_tri_v3( nor,vec[3], vec[2], vec[0]);
glNormal3fv(nor);
glVertex3fv(vec[3]); glVertex3fv(vec[2]); glVertex3fv(vec[0]);
- CalcNormFloat(vec[4], vec[3], vec[0], nor);
+ normal_tri_v3( nor,vec[4], vec[3], vec[0]);
glNormal3fv(nor);
glVertex3fv(vec[4]); glVertex3fv(vec[3]); glVertex3fv(vec[0]);
- CalcNormFloat(vec[1], vec[4], vec[0], nor);
+ normal_tri_v3( nor,vec[1], vec[4], vec[0]);
glNormal3fv(nor);
glVertex3fv(vec[1]); glVertex3fv(vec[4]); glVertex3fv(vec[0]);
/* top */
- CalcNormFloat(vec[5], vec[1], vec[2], nor);
+ normal_tri_v3( nor,vec[5], vec[1], vec[2]);
glNormal3fv(nor);
glVertex3fv(vec[5]); glVertex3fv(vec[1]); glVertex3fv(vec[2]);
- CalcNormFloat(vec[5], vec[2], vec[3], nor);
+ normal_tri_v3( nor,vec[5], vec[2], vec[3]);
glNormal3fv(nor);
glVertex3fv(vec[5]); glVertex3fv(vec[2]); glVertex3fv(vec[3]);
- CalcNormFloat(vec[5], vec[3], vec[4], nor);
+ normal_tri_v3( nor,vec[5], vec[3], vec[4]);
glNormal3fv(nor);
glVertex3fv(vec[5]); glVertex3fv(vec[3]); glVertex3fv(vec[4]);
- CalcNormFloat(vec[5], vec[4], vec[1], nor);
+ normal_tri_v3( nor,vec[5], vec[4], vec[1]);
glNormal3fv(nor);
glVertex3fv(vec[5]); glVertex3fv(vec[4]); glVertex3fv(vec[1]);
@@ -642,7 +642,7 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], int boneflag
/* figure out the sizes of spheres */
if (ebone) {
/* this routine doesn't call get_matrix_editbone() that calculates it */
- ebone->length = VecLenf(ebone->head, ebone->tail);
+ ebone->length = len_v3v3(ebone->head, ebone->tail);
length= ebone->length;
tail= ebone->rad_tail;
@@ -669,19 +669,19 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], int boneflag
/* ***** draw it ***** */
/* move vector to viewspace */
- VecSubf(dirvec, tailvec, headvec);
- Mat4Mul3Vecfl(smat, dirvec);
+ sub_v3_v3v3(dirvec, tailvec, headvec);
+ mul_mat3_m4_v3(smat, dirvec);
/* clear zcomp */
dirvec[2]= 0.0f;
/* move vector back */
- Mat4Mul3Vecfl(imat, dirvec);
+ mul_mat3_m4_v3(imat, dirvec);
- if (0.0f != Normalize(dirvec)) {
+ if (0.0f != normalize_v3(dirvec)) {
float norvec[3], vec1[3], vec2[3], vec[3];
int a;
- //VecMulf(dirvec, head);
- Crossf(norvec, dirvec, imat[2]);
+ //mul_v3_fl(dirvec, head);
+ cross_v3_v3v3(norvec, dirvec, imat[2]);
glBegin(GL_QUAD_STRIP);
@@ -752,7 +752,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag,
/* figure out the sizes of spheres */
if (ebone) {
/* this routine doesn't call get_matrix_editbone() that calculates it */
- ebone->length = VecLenf(ebone->head, ebone->tail);
+ ebone->length = len_v3v3(ebone->head, ebone->tail);
length= ebone->length;
tail= ebone->rad_tail;
@@ -807,25 +807,25 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag,
else UI_ThemeColor(TH_WIRE);
}
- VecSubf(dirvec, tailvec, headvec);
+ sub_v3_v3v3(dirvec, tailvec, headvec);
/* move vector to viewspace */
- Mat4Mul3Vecfl(smat, dirvec);
+ mul_mat3_m4_v3(smat, dirvec);
/* clear zcomp */
dirvec[2]= 0.0f;
/* move vector back */
- Mat4Mul3Vecfl(imat, dirvec);
+ mul_mat3_m4_v3(imat, dirvec);
- if (0.0f != Normalize(dirvec)) {
+ if (0.0f != normalize_v3(dirvec)) {
float norvech[3], norvect[3], vec[3];
VECCOPY(vec, dirvec);
- VecMulf(dirvec, head);
- Crossf(norvech, dirvec, imat[2]);
+ mul_v3_fl(dirvec, head);
+ cross_v3_v3v3(norvech, dirvec, imat[2]);
- VecMulf(vec, tail);
- Crossf(norvect, vec, imat[2]);
+ mul_v3_fl(vec, tail);
+ cross_v3_v3v3(norvect, vec, imat[2]);
if (id != -1)
glLoadName(id | BONESEL_BONE);
@@ -1463,12 +1463,12 @@ static void draw_pose_dofs(Object *ob)
glTranslatef(posetrans[0], posetrans[1], posetrans[2]);
if (pchan->parent) {
- Mat4CpyMat4(mat, pchan->parent->pose_mat);
+ copy_m4_m4(mat, pchan->parent->pose_mat);
mat[3][0]= mat[3][1]= mat[3][2]= 0.0f;
glMultMatrixf(mat);
}
- Mat4CpyMat3(mat, pchan->bone->bone_mat);
+ copy_m4_m3(mat, pchan->bone->bone_mat);
glMultMatrixf(mat);
scale= bone->length*pchan->size[1];
@@ -1555,8 +1555,8 @@ static void bone_matrix_translate_y(float mat[][4], float y)
float trans[3];
VECCOPY(trans, mat[1]);
- VecMulf(trans, y);
- VecAddf(mat[3], mat[3], trans);
+ mul_v3_fl(trans, y);
+ add_v3_v3v3(mat[3], mat[3], trans);
}
/* assumes object is Armature with pose */
@@ -1582,8 +1582,8 @@ static void draw_pose_channels(Scene *scene, View3D *v3d, ARegion *ar, Base *bas
if (arm->drawtype==ARM_ENVELOPE) {
/* precalc inverse matrix for drawing screen aligned */
wmGetMatrix(smat);
- Mat4MulFloat3(smat[0], 1.0f/VecLength(ob->obmat[0]));
- Mat4Invert(imat, smat);
+ mul_mat3_m4_fl(smat[0], 1.0f/len_v3(ob->obmat[0]));
+ invert_m4_m4(imat, smat);
/* and draw blended distances */
if (arm->flag & ARM_POSEMODE) {
@@ -1874,14 +1874,14 @@ static void draw_pose_channels(Scene *scene, View3D *v3d, ARegion *ar, Base *bas
/* Draw names of bone */
if (arm->flag & ARM_DRAWNAMES) {
- VecMidf(vec, pchan->pose_head, pchan->pose_tail);
+ mid_v3_v3v3(vec, pchan->pose_head, pchan->pose_tail);
view3d_cached_text_draw_add(vec[0], vec[1], vec[2], pchan->name, 10);
}
/* Draw additional axes on the bone tail */
if ( (arm->flag & ARM_DRAWAXES) && (arm->flag & ARM_POSEMODE) ) {
glPushMatrix();
- Mat4CpyMat4(bmat, pchan->pose_mat);
+ copy_m4_m4(bmat, pchan->pose_mat);
bone_matrix_translate_y(bmat, pchan->bone->length);
glMultMatrixf(bmat);
@@ -1908,14 +1908,14 @@ static void get_matrix_editbone(EditBone *eBone, float bmat[][4])
float mat[3][3];
/* Compose the parent transforms (i.e. their translations) */
- VecSubf(delta, eBone->tail, eBone->head);
+ sub_v3_v3v3(delta, eBone->tail, eBone->head);
eBone->length = (float)sqrt(delta[0]*delta[0] + delta[1]*delta[1] +delta[2]*delta[2]);
vec_roll_to_mat3(delta, eBone->roll, mat);
- Mat4CpyMat3(bmat, mat);
+ copy_m4_m3(bmat, mat);
- VecAddf(bmat[3], bmat[3], eBone->head);
+ add_v3_v3v3(bmat[3], bmat[3], eBone->head);
}
static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
@@ -1931,8 +1931,8 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
if(arm->drawtype==ARM_ENVELOPE) {
/* precalc inverse matrix for drawing screen aligned */
wmGetMatrix(smat);
- Mat4MulFloat3(smat[0], 1.0f/VecLength(ob->obmat[0]));
- Mat4Invert(imat, smat);
+ mul_mat3_m4_fl(smat[0], 1.0f/len_v3(ob->obmat[0]));
+ invert_m4_m4(imat, smat);
/* and draw blended distances */
glEnable(GL_BLEND);
@@ -2070,7 +2070,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
/* Draw name */
if (arm->flag & ARM_DRAWNAMES) {
- VecMidf(vec, eBone->head, eBone->tail);
+ mid_v3_v3v3(vec, eBone->head, eBone->tail);
glRasterPos3fv(vec);
view3d_cached_text_draw_add(vec[0], vec[1], vec[2], eBone->name, 10);
}
@@ -2243,7 +2243,7 @@ static void draw_pose_paths(Scene *scene, View3D *v3d, ARegion *ar, Object *ob)
view3d_cached_text_draw_add(fp[0], fp[1], fp[2], str, 0);
}
else if ((a > stepsize) && (a < len-stepsize)) {
- if ((VecEqual(fp, fp-(stepsize*3))==0) || (VecEqual(fp, fp+(stepsize*3))==0)) {
+ if ((equals_v3v3(fp, fp-(stepsize*3))==0) || (equals_v3v3(fp, fp+(stepsize*3))==0)) {
sprintf(str, "%d", (a+sfra));
view3d_cached_text_draw_add(fp[0], fp[1], fp[2], str, 0);
}
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 365b9ff03f7..bf73e70367c 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -31,7 +31,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_editVert.h"
@@ -614,7 +614,7 @@ void draw_mesh_text(Scene *scene, Object *ob, int glsl)
if (!mf_smooth) {
float nor[3];
- CalcNormFloat(v1, v2, v3, nor);
+ normal_tri_v3( nor,v1, v2, v3);
glNormal3fv(nor);
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 22fd77afd88..339dc830016 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -65,7 +65,7 @@
#include "DNA_world_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_edgehash.h"
#include "BLI_rand.h"
@@ -152,7 +152,7 @@ static void view3d_project_short_clip(ARegion *ar, float *vec, short *adr)
/* clipplanes in eye space */
if(rv3d->rflag & RV3D_CLIPPING) {
VECCOPY(vec4, vec);
- Mat4MulVecfl(rv3d->viewmatob, vec4);
+ mul_m4_v3(rv3d->viewmatob, vec4);
if(view3d_test_clipping(rv3d, vec4))
return;
}
@@ -160,7 +160,7 @@ static void view3d_project_short_clip(ARegion *ar, float *vec, short *adr)
VECCOPY(vec4, vec);
vec4[3]= 1.0;
- Mat4MulVec4fl(rv3d->persmatob, vec4);
+ mul_m4_v4(rv3d->persmatob, vec4);
/* clipplanes in window space */
if( vec4[3]>BL_NEAR_CLIP ) { /* is the NEAR clipping cutoff for picking */
@@ -189,7 +189,7 @@ static void view3d_project_short_noclip(ARegion *ar, float *vec, short *adr)
VECCOPY(vec4, vec);
vec4[3]= 1.0;
- Mat4MulVec4fl(rv3d->persmatob, vec4);
+ mul_m4_v4(rv3d->persmatob, vec4);
if( vec4[3]>BL_NEAR_CLIP ) { /* is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
@@ -456,8 +456,8 @@ void drawcircball(int mode, float *cent, float rad, float tmat[][4])
VECCOPY(vx, tmat[0]);
VECCOPY(vy, tmat[1]);
- VecMulf(vx, rad);
- VecMulf(vy, rad);
+ mul_v3_fl(vx, rad);
+ mul_v3_fl(vy, rad);
glBegin(mode);
for(a=0; a<tot; a++) {
@@ -544,7 +544,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
/* project first and test */
for(vos= strings->first; vos; vos= vos->next) {
if(mat)
- Mat4MulVecfl(mat, vos->vec);
+ mul_m4_v3(mat, vos->vec);
view3d_project_short_clip(ar, vos->vec, vos->mval);
if(vos->mval[0]!=IS_CLIPPED)
tot++;
@@ -674,7 +674,7 @@ static void drawshadbuflimits(Lamp *la, float mat[][4])
lavec[0]= -mat[2][0];
lavec[1]= -mat[2][1];
lavec[2]= -mat[2][2];
- Normalize(lavec);
+ normalize_v3(lavec);
sta[0]= mat[3][0]+ la->clipsta*lavec[0];
sta[1]= mat[3][1]+ la->clipsta*lavec[1];
@@ -705,13 +705,13 @@ static void spotvolume(float *lvec, float *vvec, float inp)
/* camera is at 0,0,0 */
float temp[3],plane[3],mat1[3][3],mat2[3][3],mat3[3][3],mat4[3][3],q[4],co,si,angle;
- Normalize(lvec);
- Normalize(vvec); /* is this the correct vector ? */
+ normalize_v3(lvec);
+ normalize_v3(vvec); /* is this the correct vector ? */
- Crossf(temp,vvec,lvec); /* equation for a plane through vvec en lvec */
- Crossf(plane,lvec,temp); /* a plane perpendicular to this, parrallel with lvec */
+ cross_v3_v3v3(temp,vvec,lvec); /* equation for a plane through vvec en lvec */
+ cross_v3_v3v3(plane,lvec,temp); /* a plane perpendicular to this, parrallel with lvec */
- Normalize(plane);
+ normalize_v3(plane);
/* now we've got two equations: one of a cone and one of a plane, but we have
three unknowns. We remove one unkown by rotating the plane to z=0 (the plane normal) */
@@ -724,7 +724,7 @@ static void spotvolume(float *lvec, float *vvec, float inp)
q[1] = plane[1] ;
q[2] = -plane[0] ;
q[3] = 0 ;
- Normalize(&q[1]);
+ normalize_v3(&q[1]);
angle = saacos(plane[2])/2.0;
co = cos(angle);
@@ -735,7 +735,7 @@ static void spotvolume(float *lvec, float *vvec, float inp)
q[2] *= si;
q[3] = 0;
- QuatToMat3(q,mat1);
+ quat_to_mat3(mat1,q);
/* rotate lamp vector now over acos(inp) degrees */
@@ -743,7 +743,7 @@ static void spotvolume(float *lvec, float *vvec, float inp)
vvec[1] = lvec[1] ;
vvec[2] = lvec[2] ;
- Mat3One(mat2);
+ unit_m3(mat2);
co = inp;
si = sqrt(1-inp*inp);
@@ -751,17 +751,17 @@ static void spotvolume(float *lvec, float *vvec, float inp)
mat2[1][0] = -si;
mat2[0][1] = si;
mat2[1][1] = co;
- Mat3MulMat3(mat3,mat2,mat1);
+ mul_m3_m3m3(mat3,mat2,mat1);
mat2[1][0] = si;
mat2[0][1] = -si;
- Mat3MulMat3(mat4,mat2,mat1);
- Mat3Transp(mat1);
+ mul_m3_m3m3(mat4,mat2,mat1);
+ transpose_m3(mat1);
- Mat3MulMat3(mat2,mat1,mat3);
- Mat3MulVecfl(mat2,lvec);
- Mat3MulMat3(mat2,mat1,mat4);
- Mat3MulVecfl(mat2,vvec);
+ mul_m3_m3m3(mat2,mat1,mat3);
+ mul_m3_v3(mat2,lvec);
+ mul_m3_m3m3(mat2,mat1,mat4);
+ mul_m3_v3(mat2,vvec);
return;
}
@@ -789,9 +789,9 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob)
lampsize= pixsize*((float)U.obcenter_dia*0.5f);
/* and view aligned matrix: */
- Mat4CpyMat4(imat, rv3d->viewinv);
- Normalize(imat[0]);
- Normalize(imat[1]);
+ copy_m4_m4(imat, rv3d->viewinv);
+ normalize_v3(imat[0]);
+ normalize_v3(imat[1]);
/* for AA effects */
glGetFloatv(GL_CURRENT_COLOR, curcol);
@@ -835,13 +835,13 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob)
short axis;
/* setup a 45 degree rotation matrix */
- VecRotToMat3(imat[2], M_PI/4.0f, mat);
+ vec_rot_to_mat3( mat,imat[2], M_PI/4.0f);
/* vectors */
VECCOPY(v1, imat[0]);
- VecMulf(v1, circrad*1.2f);
+ mul_v3_fl(v1, circrad*1.2f);
VECCOPY(v2, imat[0]);
- VecMulf(v2, circrad*2.5f);
+ mul_v3_fl(v2, circrad*2.5f);
/* center */
glTranslatef(vec[0], vec[1], vec[2]);
@@ -852,8 +852,8 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob)
for (axis=0; axis<8; axis++) {
glVertex3fv(v1);
glVertex3fv(v2);
- Mat3MulVecfl(mat, v1);
- Mat3MulVecfl(mat, v2);
+ mul_m3_v3(mat, v1);
+ mul_m3_v3(mat, v2);
}
glEnd();
@@ -1144,11 +1144,11 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
if(flag==0) {
if(cam->flag & (CAM_SHOWLIMITS+CAM_SHOWMIST)) {
wmLoadMatrix(rv3d->viewmat);
- Mat4CpyMat4(vec, ob->obmat);
- Mat4Ortho(vec);
+ copy_m4_m4(vec, ob->obmat);
+ normalize_m4(vec);
wmMultMatrix(vec);
- Mat4SwapMat4(rv3d->persmat, tmat);
+ swap_m4m4(rv3d->persmat, tmat);
wmGetSingleMatrix(rv3d->persmat);
if(cam->flag & CAM_SHOWLIMITS) {
@@ -1161,7 +1161,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
if(cam->flag & CAM_SHOWMIST)
if(wrld) draw_limit_line(wrld->miststa, wrld->miststa+wrld->mistdist, 0xFFFFFF);
- Mat4SwapMat4(rv3d->persmat, tmat);
+ swap_m4m4(rv3d->persmat, tmat);
}
}
}
@@ -2271,13 +2271,13 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
z= 0.5f*(v1[2]+v2[2]);
if(v3d->flag & V3D_GLOBAL_STATS) {
- Mat4MulVecfl(ob->obmat, v1);
- Mat4MulVecfl(ob->obmat, v2);
+ mul_m4_v3(ob->obmat, v1);
+ mul_m4_v3(ob->obmat, v2);
}
if(unit->system)
- bUnit_AsString(val, sizeof(val), VecLenf(v1, v2)*unit->scale_length, 3, unit->system, B_UNIT_LENGTH, do_split, FALSE);
+ bUnit_AsString(val, sizeof(val), len_v3v3(v1, v2)*unit->scale_length, 3, unit->system, B_UNIT_LENGTH, do_split, FALSE);
else
- sprintf(val, conv_float, VecLenf(v1, v2));
+ sprintf(val, conv_float, len_v3v3(v1, v2));
view3d_cached_text_draw_add(x, y, z, val, 0);
}
@@ -2302,16 +2302,16 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
VECCOPY(v4, efa->v4->co);
}
if(v3d->flag & V3D_GLOBAL_STATS) {
- Mat4MulVecfl(ob->obmat, v1);
- Mat4MulVecfl(ob->obmat, v2);
- Mat4MulVecfl(ob->obmat, v3);
- if (efa->v4) Mat4MulVecfl(ob->obmat, v4);
+ mul_m4_v3(ob->obmat, v1);
+ mul_m4_v3(ob->obmat, v2);
+ mul_m4_v3(ob->obmat, v3);
+ if (efa->v4) mul_m4_v3(ob->obmat, v4);
}
if (efa->v4)
- area= AreaQ3Dfl(v1, v2, v3, v4);
+ area= area_quad_v3(v1, v2, v3, v4);
else
- area = AreaT3Dfl(v1, v2, v3);
+ area = area_tri_v3(v1, v2, v3);
if(unit->system)
bUnit_AsString(val, sizeof(val), area*unit->scale_length, 3, unit->system, B_UNIT_LENGTH, do_split, FALSE); // XXX should be B_UNIT_AREA
@@ -2343,10 +2343,10 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
VECCOPY(v4, v3);
}
if(v3d->flag & V3D_GLOBAL_STATS) {
- Mat4MulVecfl(ob->obmat, v1);
- Mat4MulVecfl(ob->obmat, v2);
- Mat4MulVecfl(ob->obmat, v3);
- Mat4MulVecfl(ob->obmat, v4);
+ mul_m4_v3(ob->obmat, v1);
+ mul_m4_v3(ob->obmat, v2);
+ mul_m4_v3(ob->obmat, v3);
+ mul_m4_v3(ob->obmat, v4);
}
e1= efa->e1;
@@ -2358,30 +2358,30 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
if( (e4->f & e1->f & SELECT) || (G.moving && (efa->v1->f & SELECT)) ) {
/* Vec 1 */
- sprintf(val,"%.3f", RAD2DEG(VecAngle3(v4, v1, v2)));
- VecLerpf(fvec, efa->cent, efa->v1->co, 0.8f);
+ sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v4, v1, v2)));
+ interp_v3_v3v3(fvec, efa->cent, efa->v1->co, 0.8f);
view3d_cached_text_draw_add(efa->cent[0], efa->cent[1], efa->cent[2], val, 0);
}
if( (e1->f & e2->f & SELECT) || (G.moving && (efa->v2->f & SELECT)) ) {
/* Vec 2 */
- sprintf(val,"%.3f", RAD2DEG(VecAngle3(v1, v2, v3)));
- VecLerpf(fvec, efa->cent, efa->v2->co, 0.8f);
+ sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v1, v2, v3)));
+ interp_v3_v3v3(fvec, efa->cent, efa->v2->co, 0.8f);
view3d_cached_text_draw_add(fvec[0], fvec[1], fvec[2], val, 0);
}
if( (e2->f & e3->f & SELECT) || (G.moving && (efa->v3->f & SELECT)) ) {
/* Vec 3 */
if(efa->v4)
- sprintf(val,"%.3f", RAD2DEG(VecAngle3(v2, v3, v4)));
+ sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v2, v3, v4)));
else
- sprintf(val,"%.3f", RAD2DEG(VecAngle3(v2, v3, v1)));
- VecLerpf(fvec, efa->cent, efa->v3->co, 0.8f);
+ sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v2, v3, v1)));
+ interp_v3_v3v3(fvec, efa->cent, efa->v3->co, 0.8f);
view3d_cached_text_draw_add(fvec[0], fvec[1], fvec[2], val, 0);
}
/* Vec 4 */
if(efa->v4) {
if( (e3->f & e4->f & SELECT) || (G.moving && (efa->v4->f & SELECT)) ) {
- sprintf(val,"%.3f", RAD2DEG(VecAngle3(v3, v4, v1)));
- VecLerpf(fvec, efa->cent, efa->v4->co, 0.8f);
+ sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v3, v4, v1)));
+ interp_v3_v3v3(fvec, efa->cent, efa->v4->co, 0.8f);
view3d_cached_text_draw_add(fvec[0], fvec[1], fvec[2], val, 0);
}
}
@@ -3434,7 +3434,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
{
vec[0]=2.0f*pixsize;
vec[1]=vec[2]=0.0;
- QuatMulVecf(state->rot,vec);
+ mul_qt_v3(state->rot,vec);
if(draw_as==PART_DRAW_AXIS) {
cd[1]=cd[2]=cd[4]=cd[5]=0.0;
cd[0]=cd[3]=1.0;
@@ -3462,7 +3462,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
vec[1]=2.0f*pixsize;
vec[0]=vec[2]=0.0;
- QuatMulVecf(state->rot,vec);
+ mul_qt_v3(state->rot,vec);
if(draw_as==PART_DRAW_AXIS){
VECCOPY(vec2,state->co);
}
@@ -3474,7 +3474,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
vec[2]=2.0f*pixsize;
vec[0]=vec[1]=0.0;
- QuatMulVecf(state->rot,vec);
+ mul_qt_v3(state->rot,vec);
if(draw_as==PART_DRAW_AXIS){
VECCOPY(vec2,state->co);
}
@@ -3489,9 +3489,9 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
case PART_DRAW_LINE:
{
VECCOPY(vec,state->vel);
- Normalize(vec);
+ normalize_v3(vec);
if(draw & PART_DRAW_VEL_LENGTH)
- VecMulf(vec,VecLength(state->vel));
+ mul_v3_fl(vec,len_v3(state->vel));
VECADDFAC(pdd->vd,state->co,vec,-draw_line[0]); pdd->vd+=3;
VECADDFAC(pdd->vd,state->co,vec,draw_line[1]); pdd->vd+=3;
if(cd) {
@@ -3649,7 +3649,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
float mat[4][4];
- Mat4MulMat4(mat, psys->imat, ob->obmat);
+ mul_m4_m4m4(mat, psys->imat, ob->obmat);
wmMultMatrix(mat);
}
@@ -3671,9 +3671,9 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
break;
case PART_DRAW_CIRC:
/* calculate view aligned matrix: */
- Mat4CpyMat4(imat, rv3d->viewinv);
- Normalize(imat[0]);
- Normalize(imat[1]);
+ copy_m4_m4(imat, rv3d->viewinv);
+ normalize_v3(imat[0]);
+ normalize_v3(imat[1]);
/* no break! */
case PART_DRAW_CROSS:
case PART_DRAW_AXIS:
@@ -3729,9 +3729,9 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
break;
}
if(part->draw & PART_DRAW_SIZE && part->draw_as!=PART_DRAW_CIRC){
- Mat4CpyMat4(imat, rv3d->viewinv);
- Normalize(imat[0]);
- Normalize(imat[1]);
+ copy_m4_m4(imat, rv3d->viewinv);
+ normalize_v3(imat[0]);
+ normalize_v3(imat[1]);
}
if(!create_cdata && pdd && pdd->cdata) {
@@ -3903,7 +3903,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
psys_get_particle_on_path(&sim,a,&state,need_v);
if(psys->parent)
- Mat4MulVecfl(psys->parent->obmat, state.co);
+ mul_m4_v3(psys->parent->obmat, state.co);
/* create actiual particle data */
if(draw_as == PART_DRAW_BB) {
@@ -3923,7 +3923,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
state.time=cfra;
if(psys_get_particle_state(&sim,a,&state,0)){
if(psys->parent)
- Mat4MulVecfl(psys->parent->obmat, state.co);
+ mul_m4_v3(psys->parent->obmat, state.co);
/* create actiual particle data */
if(draw_as == PART_DRAW_BB) {
@@ -3946,7 +3946,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
VECCOPY(pdd->ved,state.co);
pdd->ved+=3;
VECCOPY(vel,state.vel);
- VecMulf(vel,timestep);
+ mul_v3_fl(vel,timestep);
VECADD(pdd->ved,state.co,vel);
pdd->ved+=3;
@@ -4566,10 +4566,10 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
float vec_a[3] = { fac,0, 0}; // Offset perpendicular to the curve
float vec_b[3] = {-fac,0, 0}; // Delta along the curve
- QuatMulVecf(bevp->quat, vec_a);
- QuatMulVecf(bevp->quat, vec_b);
- VecAddf(vec_a, vec_a, bevp->vec);
- VecAddf(vec_b, vec_b, bevp->vec);
+ mul_qt_v3(bevp->quat, vec_a);
+ mul_qt_v3(bevp->quat, vec_b);
+ add_v3_v3v3(vec_a, vec_a, bevp->vec);
+ add_v3_v3v3(vec_b, vec_b, bevp->vec);
VECSUBFAC(vec_a, vec_a, bevp->dir, fac);
VECSUBFAC(vec_b, vec_b, bevp->dir, fac);
@@ -4711,8 +4711,8 @@ static void drawspiral(float *cent, float rad, float tmat[][4], int start)
VECCOPY(vx, tmat[0]);
VECCOPY(vy, tmat[1]);
- VecMulf(vx, rad);
- VecMulf(vy, rad);
+ mul_v3_fl(vx, rad);
+ mul_v3_fl(vy, rad);
VECCOPY(vec, cent);
@@ -4776,7 +4776,7 @@ static void drawtube(float *vec, float radius, float height, float tmat[][4])
float cur[3];
drawcircball(GL_LINE_LOOP, vec, radius, tmat);
- VecCopyf(cur,vec);
+ copy_v3_v3(cur,vec);
cur[2]+=height;
drawcircball(GL_LINE_LOOP, cur, radius, tmat);
@@ -4797,7 +4797,7 @@ static void drawcone(float *vec, float radius, float height, float tmat[][4])
{
float cur[3];
- VecCopyf(cur,vec);
+ copy_v3_v3(cur,vec);
cur[2]+=height;
drawcircball(GL_LINE_LOOP, cur, radius, tmat);
@@ -4845,9 +4845,9 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
else UI_ThemeColor(TH_WIRE);
wmGetMatrix(tmat);
- Mat4Invert(imat, tmat);
- Normalize(imat[0]);
- Normalize(imat[1]);
+ invert_m4_m4(imat, tmat);
+ normalize_v3(imat[0]);
+ normalize_v3(imat[1]);
while(ml) {
@@ -4904,14 +4904,14 @@ static void draw_forcefield(Scene *scene, Object *ob)
/* calculus here, is reused in PFIELD_FORCE */
wmGetMatrix(tmat);
- Mat4Invert(imat, tmat);
-// Normalize(imat[0]); // we don't do this because field doesnt scale either... apart from wind!
-// Normalize(imat[1]);
+ invert_m4_m4(imat, tmat);
+// normalize_v3(imat[0]); // we don't do this because field doesnt scale either... apart from wind!
+// normalize_v3(imat[1]);
if (pd->forcefield == PFIELD_WIND) {
float force_val;
- Mat4One(tmat);
+ unit_m4(tmat);
UI_ThemeColorBlend(curcol, TH_BACK, 0.5);
//if (has_ipo_code(ob->ipo, OB_PD_FSTR))
@@ -4947,7 +4947,7 @@ static void draw_forcefield(Scene *scene, Object *ob)
else if (pd->forcefield == PFIELD_VORTEX) {
float ffall_val, force_val;
- Mat4One(tmat);
+ unit_m4(tmat);
//if (has_ipo_code(ob->ipo, OB_PD_FFALL))
// ffall_val = IPO_GetFloatValue(ob->ipo, OB_PD_FFALL, scene->r.cfra);
//else
@@ -5008,7 +5008,7 @@ static void draw_forcefield(Scene *scene, Object *ob)
else if(pd->falloff==PFIELD_FALL_TUBE){
float radius,distance;
- Mat4One(tmat);
+ unit_m4(tmat);
vec[0]=vec[1]=0.0f;
radius=(pd->flag&PFIELD_USEMAXR)?pd->maxrad:1.0f;
@@ -5030,7 +5030,7 @@ static void draw_forcefield(Scene *scene, Object *ob)
else if(pd->falloff==PFIELD_FALL_CONE){
float radius,distance;
- Mat4One(tmat);
+ unit_m4(tmat);
radius=(pd->flag&PFIELD_USEMAXR)?pd->maxrad:1.0f;
radius*=(float)M_PI/180.0f;
@@ -5278,7 +5278,7 @@ static void draw_hooks(Object *ob)
if (md->type==eModifierType_Hook) {
HookModifierData *hmd = (HookModifierData*) md;
- VecMat4MulVecfl(vec, ob->obmat, hmd->cent);
+ mul_v3_m4v3(vec, ob->obmat, hmd->cent);
if(hmd->object) {
setlinestyle(3);
@@ -5310,7 +5310,7 @@ void drawRBpivot(bRigidBodyJointConstraint *data)
if(G.f & G_RENDER_SHADOW)
return;
- EulToMat4(eu,mat);
+ eul_to_mat4(mat,eu);
glLineWidth (4.0f);
setlinestyle(2);
for (axis=0; axis<3; axis++) {
@@ -5319,7 +5319,7 @@ void drawRBpivot(bRigidBodyJointConstraint *data)
dir[axis] = 1.f;
glBegin(GL_LINES);
- Mat4MulVecfl(mat,dir);
+ mul_m4_v3(mat,dir);
v[0] += dir[0];
v[1] += dir[1];
v[2] += dir[2];
@@ -5895,7 +5895,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
vec[0]= vec[1]= vec[2]= 0.0;
wmGetMatrix(tmat);
- Mat4Invert(imat, tmat);
+ invert_m4_m4(imat, tmat);
setlinestyle(2);
drawcircball(GL_LINE_LOOP, vec, ob->inertia, imat);
@@ -5982,7 +5982,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if (cti->get_target_matrix)
cti->get_target_matrix(curcon, cob, ct, bsystem_time(scene, ob, (float)(scene->r.cfra), give_timeoffset(ob)));
else
- Mat4One(ct->matrix);
+ unit_m4(ct->matrix);
setlinestyle(3);
glBegin(GL_LINES);
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 3c80441b9e6..168e1f8592d 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -66,7 +66,7 @@
#include "DNA_world_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_edgehash.h"
#include "BLI_rand.h"
@@ -191,7 +191,7 @@ static int convex(float *p0, float *up, float *a, float *b)
float va[3], vb[3], tmp[3];
VECSUB(va, a, p0);
VECSUB(vb, b, p0);
- Crossf(tmp, va, vb);
+ cross_v3_v3v3(tmp, va, vb);
return INPR(up, tmp) >= 0;
}
@@ -363,7 +363,7 @@ void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture
// get view vector
VECCOPY(viewnormal, rv3d->viewinv[2]);
- Normalize(viewnormal);
+ normalize_v3(viewnormal);
// find cube vertex that is closest to the viewer
for (i=0; i<8; i++) {
@@ -433,7 +433,7 @@ void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture
break;
VECCOPY(tmp_point, viewnormal);
- VecMulf(tmp_point, -dd*((ds/dd)-(float)n));
+ mul_v3_fl(tmp_point, -dd*((ds/dd)-(float)n));
VECADD(tmp_point2, cv[good_index], tmp_point);
d = INPR(tmp_point2, viewnormal);
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 453f16239fe..d470774f76a 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -40,7 +40,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_action.h"
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 608a22ea529..d3a922af67e 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -52,7 +52,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
@@ -176,7 +176,7 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
if(eve->f & SELECT) {
evedef= eve;
tot++;
- VecAddf(median, median, eve->co);
+ add_v3_v3v3(median, median, eve->co);
}
eve= eve->next;
}
@@ -232,18 +232,18 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
a= nu->pntsu;
while(a--) {
if(bezt->f2 & SELECT) {
- VecAddf(median, median, bezt->vec[1]);
+ add_v3_v3v3(median, median, bezt->vec[1]);
tot++;
median[4]+= bezt->weight;
totweight++;
}
else {
if(bezt->f1 & SELECT) {
- VecAddf(median, median, bezt->vec[0]);
+ add_v3_v3v3(median, median, bezt->vec[0]);
tot++;
}
if(bezt->f3 & SELECT) {
- VecAddf(median, median, bezt->vec[2]);
+ add_v3_v3v3(median, median, bezt->vec[2]);
tot++;
}
}
@@ -255,7 +255,7 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
a= nu->pntsu*nu->pntsv;
while(a--) {
if(bp->f1 & SELECT) {
- VecAddf(median, median, bp->vec);
+ add_v3_v3v3(median, median, bp->vec);
median[3]+= bp->vec[3];
totw++;
tot++;
@@ -277,7 +277,7 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
bp= lt->editlatt->def;
while(a--) {
if(bp->f1 & SELECT) {
- VecAddf(median, median, bp->vec);
+ add_v3_v3v3(median, median, bp->vec);
tot++;
median[4]+= bp->weight;
totweight++;
@@ -296,7 +296,7 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
if(totweight) median[4] /= (float)totweight;
if(v3d->flag & V3D_GLOBAL_STATS)
- Mat4MulVecfl(ob->obmat, median);
+ mul_m4_v3(ob->obmat, median);
if(block) { // buttons
int but_y;
@@ -371,11 +371,11 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
memcpy(ve_median, tfp->ve_median, sizeof(tfp->ve_median));
if(v3d->flag & V3D_GLOBAL_STATS) {
- Mat4Invert(ob->imat, ob->obmat);
- Mat4MulVecfl(ob->imat, median);
- Mat4MulVecfl(ob->imat, ve_median);
+ invert_m4_m4(ob->imat, ob->obmat);
+ mul_m4_v3(ob->imat, median);
+ mul_m4_v3(ob->imat, ve_median);
}
- VecSubf(median, ve_median, median);
+ sub_v3_v3v3(median, ve_median, median);
median[3]= ve_median[3]-median[3];
median[4]= ve_median[4]-median[4];
@@ -388,7 +388,7 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
eve= em->verts.first;
while(eve) {
if(eve->f & SELECT) {
- VecAddf(eve->co, eve->co, median);
+ add_v3_v3v3(eve->co, eve->co, median);
}
eve= eve->next;
}
@@ -423,17 +423,17 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
a= nu->pntsu;
while(a--) {
if(bezt->f2 & SELECT) {
- VecAddf(bezt->vec[0], bezt->vec[0], median);
- VecAddf(bezt->vec[1], bezt->vec[1], median);
- VecAddf(bezt->vec[2], bezt->vec[2], median);
+ add_v3_v3v3(bezt->vec[0], bezt->vec[0], median);
+ add_v3_v3v3(bezt->vec[1], bezt->vec[1], median);
+ add_v3_v3v3(bezt->vec[2], bezt->vec[2], median);
bezt->weight+= median[4];
}
else {
if(bezt->f1 & SELECT) {
- VecAddf(bezt->vec[0], bezt->vec[0], median);
+ add_v3_v3v3(bezt->vec[0], bezt->vec[0], median);
}
if(bezt->f3 & SELECT) {
- VecAddf(bezt->vec[2], bezt->vec[2], median);
+ add_v3_v3v3(bezt->vec[2], bezt->vec[2], median);
}
}
bezt++;
@@ -444,7 +444,7 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
a= nu->pntsu*nu->pntsv;
while(a--) {
if(bp->f1 & SELECT) {
- VecAddf(bp->vec, bp->vec, median);
+ add_v3_v3v3(bp->vec, bp->vec, median);
bp->vec[3]+= median[3];
bp->weight+= median[4];
}
@@ -466,7 +466,7 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
bp= lt->editlatt->def;
while(a--) {
if(bp->f1 & SELECT) {
- VecAddf(bp->vec, bp->vec, median);
+ add_v3_v3v3(bp->vec, bp->vec, median);
bp->weight+= median[4];
}
bp++;
@@ -606,13 +606,13 @@ static void v3d_posearmature_buts(uiLayout *layout, View3D *v3d, Object *ob, flo
if (pchan->rotmode == ROT_MODE_AXISANGLE) {
float quat[4];
/* convert to euler, passing through quats... */
- AxisAngleToQuat(quat, pchan->rotAxis, pchan->rotAngle);
- QuatToEul(quat, tfp->ob_eul);
+ axis_angle_to_quat(quat, pchan->rotAxis, pchan->rotAngle);
+ quat_to_eul( tfp->ob_eul,quat);
}
else if (pchan->rotmode == ROT_MODE_QUAT)
- QuatToEul(pchan->quat, tfp->ob_eul);
+ quat_to_eul( tfp->ob_eul,pchan->quat);
else
- VecCopyf(tfp->ob_eul, pchan->eul);
+ copy_v3_v3(tfp->ob_eul, pchan->eul);
tfp->ob_eul[0]*= 180.0/M_PI;
tfp->ob_eul[1]*= 180.0/M_PI;
tfp->ob_eul[2]*= 180.0/M_PI;
@@ -823,13 +823,13 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event)
if (pchan->rotmode == ROT_MODE_AXISANGLE) {
float quat[4];
/* convert to axis-angle, passing through quats */
- EulToQuat(eul, quat);
- QuatToAxisAngle(quat, pchan->rotAxis, &pchan->rotAngle);
+ eul_to_quat( quat,eul);
+ quat_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,quat);
}
else if (pchan->rotmode == ROT_MODE_QUAT)
- EulToQuat(eul, pchan->quat);
+ eul_to_quat( pchan->quat,eul);
else
- VecCopyf(pchan->eul, eul);
+ copy_v3_v3(pchan->eul, eul);
}
/* no break, pass on */
case B_ARMATUREPANEL2:
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 2879dc3ed22..ee0830e85da 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -48,7 +48,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_anim.h"
@@ -251,7 +251,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, char **grid_u
vec4[0]=vec4[1]=vec4[2]=0.0;
vec4[3]= 1.0;
- Mat4MulVec4fl(rv3d->persmat, vec4);
+ mul_m4_v4(rv3d->persmat, vec4);
fx= vec4[0];
fy= vec4[1];
fw= vec4[3];
@@ -266,7 +266,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, char **grid_u
vec4[2]= 0.0;
vec4[3]= 1.0;
- Mat4MulVec4fl(rv3d->persmat, vec4);
+ mul_m4_v4(rv3d->persmat, vec4);
fx= vec4[0];
fy= vec4[1];
fw= vec4[3];
@@ -596,7 +596,7 @@ static void draw_view_axis(RegionView3D *rv3d)
/* X */
vec[0] = vec[3] = 1;
vec[1] = vec[2] = 0;
- QuatMulVecf(rv3d->viewquat, vec);
+ mul_qt_v3(rv3d->viewquat, vec);
UI_make_axis_color((char *)gridcol, (char *)col, 'x');
rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
@@ -616,7 +616,7 @@ static void draw_view_axis(RegionView3D *rv3d)
/* Y */
vec[1] = vec[3] = 1;
vec[0] = vec[2] = 0;
- QuatMulVecf(rv3d->viewquat, vec);
+ mul_qt_v3(rv3d->viewquat, vec);
UI_make_axis_color((char *)gridcol, (char *)col, 'y');
rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
@@ -636,7 +636,7 @@ static void draw_view_axis(RegionView3D *rv3d)
/* Z */
vec[2] = vec[3] = 1;
vec[1] = vec[0] = 0;
- QuatMulVecf(rv3d->viewquat, vec);
+ mul_qt_v3(rv3d->viewquat, vec);
UI_make_axis_color((char *)gridcol, (char *)col, 'z');
rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
@@ -1558,7 +1558,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
/* need this for next part of code */
bb= object_get_boundbox(dob->ob);
- Mat4One(dob->ob->obmat); /* obmat gets restored */
+ unit_m4(dob->ob->obmat); /* obmat gets restored */
displist= glGenLists(1);
glNewList(displist, GL_COMPILE);
@@ -1576,7 +1576,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
wmLoadMatrix(rv3d->viewmat);
}
else {
- Mat4CpyMat4(dob->ob->obmat, dob->mat);
+ copy_m4_m4(dob->ob->obmat, dob->mat);
draw_object(scene, ar, v3d, &tbase, DRAW_CONSTCOLOR);
}
@@ -1689,9 +1689,9 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
setwinmatrixview3d(ar, v3d, NULL); /* 0= no pick rect */
setviewmatrixview3d(scene, v3d, rv3d); /* note: calls where_is_object for camera... */
- Mat4MulMat4(rv3d->persmat, rv3d->viewmat, rv3d->winmat);
- Mat4Invert(rv3d->persinv, rv3d->persmat);
- Mat4Invert(rv3d->viewinv, rv3d->viewmat);
+ mul_m4_m4m4(rv3d->persmat, rv3d->viewmat, rv3d->winmat);
+ invert_m4_m4(rv3d->persinv, rv3d->persmat);
+ invert_m4_m4(rv3d->viewinv, rv3d->viewmat);
glClear(GL_DEPTH_BUFFER_BIT);
@@ -1899,29 +1899,29 @@ static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar,
/* setup window matrices */
if(winmat)
- Mat4CpyMat4(rv3d->winmat, winmat);
+ copy_m4_m4(rv3d->winmat, winmat);
else
setwinmatrixview3d(ar, v3d, NULL); /* NULL= no pickrect */
/* setup view matrix */
if(viewmat)
- Mat4CpyMat4(rv3d->viewmat, viewmat);
+ copy_m4_m4(rv3d->viewmat, viewmat);
else
setviewmatrixview3d(scene, v3d, rv3d); /* note: calls where_is_object for camera... */
/* update utilitity matrices */
- Mat4MulMat4(rv3d->persmat, rv3d->viewmat, rv3d->winmat);
- Mat4Invert(rv3d->persinv, rv3d->persmat);
- Mat4Invert(rv3d->viewinv, rv3d->viewmat);
+ mul_m4_m4m4(rv3d->persmat, rv3d->viewmat, rv3d->winmat);
+ invert_m4_m4(rv3d->persinv, rv3d->persmat);
+ invert_m4_m4(rv3d->viewinv, rv3d->viewmat);
/* calculate pixelsize factor once, is used for lamps and obcenters */
{
float len1, len2, vec[3];
VECCOPY(vec, rv3d->persinv[0]);
- len1= Normalize(vec);
+ len1= normalize_v3(vec);
VECCOPY(vec, rv3d->persinv[1]);
- len2= Normalize(vec);
+ len2= normalize_v3(vec);
rv3d->pixsize= 2.0f*(len1>len2?len1:len2);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 49f2ece0bc4..6ef08a1c217 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -46,7 +46,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BKE_action.h"
@@ -141,12 +141,12 @@ static void view3d_boxview_clip(ScrArea *sa)
}
/* normals for plane equations */
- CalcNormFloat(bb->vec[0], bb->vec[1], bb->vec[4], clip[0]);
- CalcNormFloat(bb->vec[1], bb->vec[2], bb->vec[5], clip[1]);
- CalcNormFloat(bb->vec[2], bb->vec[3], bb->vec[6], clip[2]);
- CalcNormFloat(bb->vec[3], bb->vec[0], bb->vec[7], clip[3]);
- CalcNormFloat(bb->vec[4], bb->vec[5], bb->vec[6], clip[4]);
- CalcNormFloat(bb->vec[0], bb->vec[2], bb->vec[1], clip[5]);
+ normal_tri_v3( clip[0],bb->vec[0], bb->vec[1], bb->vec[4]);
+ normal_tri_v3( clip[1],bb->vec[1], bb->vec[2], bb->vec[5]);
+ normal_tri_v3( clip[2],bb->vec[2], bb->vec[3], bb->vec[6]);
+ normal_tri_v3( clip[3],bb->vec[3], bb->vec[0], bb->vec[7]);
+ normal_tri_v3( clip[4],bb->vec[4], bb->vec[5], bb->vec[6]);
+ normal_tri_v3( clip[5],bb->vec[0], bb->vec[2], bb->vec[1]);
/* then plane equations */
for(val=0; val<5; val++) {
@@ -299,7 +299,7 @@ static void viewops_data(bContext *C, wmOperator *op, wmEvent *event)
/* If there's no selection, lastofs is unmodified and last value since static */
calculateTransformCenter(C, event, V3D_CENTROID, lastofs);
VECCOPY(vod->obofs, lastofs);
- VecMulf(vod->obofs, -1.0f);
+ mul_v3_fl(vod->obofs, -1.0f);
}
/* lookup, we dont pass on v3d to prevent confusement */
@@ -422,13 +422,13 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
calctrackballvec(&vod->ar->winrct, x, y, newvec);
- VecSubf(dvec, newvec, vod->trackvec);
+ sub_v3_v3v3(dvec, newvec, vod->trackvec);
si= sqrt(dvec[0]*dvec[0]+ dvec[1]*dvec[1]+ dvec[2]*dvec[2]);
si/= (2.0*TRACKBALLSIZE);
- Crossf(q1+1, vod->trackvec, newvec);
- Normalize(q1+1);
+ cross_v3_v3v3(q1+1, vod->trackvec, newvec);
+ normalize_v3(q1+1);
/* Allow for rotation beyond the interval
* [-pi, pi] */
@@ -447,19 +447,19 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
q1[1]*= si;
q1[2]*= si;
q1[3]*= si;
- QuatMul(rv3d->viewquat, q1, vod->oldquat);
+ mul_qt_qtqt(rv3d->viewquat, q1, vod->oldquat);
if (use_sel) {
/* compute the post multiplication quat, to rotate the offset correctly */
QUATCOPY(q1, vod->oldquat);
- QuatConj(q1);
- QuatMul(q1, q1, rv3d->viewquat);
+ conjugate_qt(q1);
+ mul_qt_qtqt(q1, q1, rv3d->viewquat);
- QuatConj(q1); /* conj == inv for unit quat */
+ conjugate_qt(q1); /* conj == inv for unit quat */
VECCOPY(rv3d->ofs, vod->ofs);
- VecSubf(rv3d->ofs, rv3d->ofs, vod->obofs);
- QuatMulVecf(q1, rv3d->ofs);
- VecAddf(rv3d->ofs, rv3d->ofs, vod->obofs);
+ sub_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->obofs);
+ mul_qt_v3(q1, rv3d->ofs);
+ add_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->obofs);
}
}
else {
@@ -475,12 +475,12 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
const float sensitivity = 0.0035;
/* Get the 3x3 matrix and its inverse from the quaternion */
- QuatToMat3(rv3d->viewquat, m);
- Mat3Inv(m_inv,m);
+ quat_to_mat3( m,rv3d->viewquat);
+ invert_m3_m3(m_inv,m);
/* Determine the direction of the x vector (for rotating up and down) */
/* This can likely be compuated directly from the quaternion. */
- Mat3MulVecfl(m_inv,xvec);
+ mul_m3_v3(m_inv,xvec);
/* Perform the up/down rotation */
phi = sensitivity * -(y - vod->oldy);
@@ -489,13 +489,13 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
q1[1] = si * xvec[0];
q1[2] = si * xvec[1];
q1[3] = si * xvec[2];
- QuatMul(rv3d->viewquat, rv3d->viewquat, q1);
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, q1);
if (use_sel) {
- QuatConj(q1); /* conj == inv for unit quat */
- VecSubf(rv3d->ofs, rv3d->ofs, vod->obofs);
- QuatMulVecf(q1, rv3d->ofs);
- VecAddf(rv3d->ofs, rv3d->ofs, vod->obofs);
+ conjugate_qt(q1); /* conj == inv for unit quat */
+ sub_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->obofs);
+ mul_qt_v3(q1, rv3d->ofs);
+ add_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->obofs);
}
/* Perform the orbital rotation */
@@ -503,13 +503,13 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
q1[0] = cos(phi);
q1[1] = q1[2] = 0.0;
q1[3] = sin(phi);
- QuatMul(rv3d->viewquat, rv3d->viewquat, q1);
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, q1);
if (use_sel) {
- QuatConj(q1);
- VecSubf(rv3d->ofs, rv3d->ofs, vod->obofs);
- QuatMulVecf(q1, rv3d->ofs);
- VecAddf(rv3d->ofs, rv3d->ofs, vod->obofs);
+ conjugate_qt(q1);
+ sub_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->obofs);
+ mul_qt_v3(q1, rv3d->ofs);
+ add_v3_v3v3(rv3d->ofs, rv3d->ofs, vod->obofs);
}
}
@@ -519,17 +519,17 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
float viewmat[3][3];
- QuatToMat3(rv3d->viewquat, viewmat);
+ quat_to_mat3( viewmat,rv3d->viewquat);
for (i = 0 ; i < 39; i++){
float snapmat[3][3];
float view = (int)snapquats[i][4];
- QuatToMat3(snapquats[i], snapmat);
+ quat_to_mat3( snapmat,snapquats[i]);
- if ((Inpf(snapmat[0], viewmat[0]) > thres) &&
- (Inpf(snapmat[1], viewmat[1]) > thres) &&
- (Inpf(snapmat[2], viewmat[2]) > thres)){
+ if ((dot_v3v3(snapmat[0], viewmat[0]) > thres) &&
+ (dot_v3v3(snapmat[1], viewmat[1]) > thres) &&
+ (dot_v3v3(snapmat[2], viewmat[2]) > thres)){
QUATCOPY(rv3d->viewquat, snapquats[i]);
@@ -678,7 +678,7 @@ static void viewmove_apply(ViewOpsData *vod, int x, int y)
float dvec[3];
window_to_3d_delta(vod->ar, dvec, x-vod->oldx, y-vod->oldy);
- VecAddf(vod->rv3d->ofs, vod->rv3d->ofs, dvec);
+ add_v3_v3v3(vod->rv3d->ofs, vod->rv3d->ofs, dvec);
if(vod->rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(vod->sa, vod->ar);
@@ -868,9 +868,9 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y)
upvec[0] = upvec[1] = 0.0f;
upvec[2] = (vod->dist0 - vod->rv3d->dist) * vod->grid;
vod->rv3d->dist = vod->dist0;
- Mat3CpyMat4(mat, vod->rv3d->viewinv);
- Mat3MulVecfl(mat, upvec);
- VecAddf(vod->rv3d->ofs, vod->rv3d->ofs, upvec);
+ copy_m3_m4(mat, vod->rv3d->viewinv);
+ mul_m3_v3(mat, upvec);
+ add_v3_v3v3(vod->rv3d->ofs, vod->rv3d->ofs, upvec);
} else {
/* these limits were in old code too */
if(vod->rv3d->dist<0.001*vod->grid) vod->rv3d->dist= 0.001*vod->grid;
@@ -1142,10 +1142,10 @@ static int viewcenter_exec(bContext *C, wmOperator *op) /* like a localview with
if(pchan->bone->layer & arm->layer) {
ok= 1;
VECCOPY(vec, pchan->pose_head);
- Mat4MulVecfl(ob->obmat, vec);
+ mul_m4_v3(ob->obmat, vec);
DO_MINMAX(vec, min, max);
VECCOPY(vec, pchan->pose_tail);
- Mat4MulVecfl(ob->obmat, vec);
+ mul_m4_v3(ob->obmat, vec);
DO_MINMAX(vec, min, max);
}
}
@@ -1401,7 +1401,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
dvec[1] = p[1]-p_corner[1];
dvec[2] = p[2]-p_corner[2];
- new_dist = VecLength(dvec);
+ new_dist = len_v3(dvec);
if(new_dist <= v3d->near*1.5) new_dist= v3d->near*1.5;
new_ofs[0] = -p[0];
@@ -1430,7 +1430,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
window_to_3d_delta(ar, dvec, (rect.xmin+rect.xmax-vb[0])/2, (rect.ymin+rect.ymax-vb[1])/2);
/* center the view to the center of the rectangle */
- VecSubf(new_ofs, new_ofs, dvec);
+ sub_v3_v3v3(new_ofs, new_ofs, dvec);
}
/* work out the ratios, so that everything selected fits when we zoom */
@@ -1524,9 +1524,9 @@ static void axis_set_view(bContext *C, float q1, float q2, float q3, float q4, s
/* same as transform manipulator when normal is set */
ED_getTransformOrientationMatrix(C, twmat, TRUE);
- Mat3ToQuat(twmat, obact_quat);
- QuatInv(obact_quat);
- QuatMul(new_quat, new_quat, obact_quat);
+ mat3_to_quat( obact_quat,twmat);
+ invert_qt(obact_quat);
+ mul_qt_qtqt(new_quat, new_quat, obact_quat);
rv3d->view= view= 0;
}
@@ -1704,14 +1704,14 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
q1[0]= (float)cos(phi);
q1[1]= q1[2]= 0.0;
q1[3]= si;
- QuatMul(rv3d->viewquat, rv3d->viewquat, q1);
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, q1);
rv3d->view= 0;
}
if(orbitdir == V3D_VIEW_STEPDOWN || orbitdir == V3D_VIEW_STEPUP) {
/* horizontal axis */
VECCOPY(q1+1, rv3d->viewinv[0]);
- Normalize(q1+1);
+ normalize_v3(q1+1);
phi= (float)(M_PI/360.0)*U.pad_rot_angle;
if(orbitdir == V3D_VIEW_STEPDOWN) phi= -phi;
si= (float)sin(phi);
@@ -1719,7 +1719,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
q1[1]*= si;
q1[2]*= si;
q1[3]*= si;
- QuatMul(rv3d->viewquat, rv3d->viewquat, q1);
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, q1);
rv3d->view= 0;
}
ED_region_tag_redraw(ar);
@@ -1881,7 +1881,7 @@ static int view3d_clipping_exec(bContext *C, wmOperator *op)
/* then plane equations */
for(val=0; val<4; val++) {
- CalcNormFloat(rv3d->clipbb->vec[val], rv3d->clipbb->vec[val==3?0:val+1], rv3d->clipbb->vec[val+4], rv3d->clip[val]);
+ normal_tri_v3( rv3d->clip[val],rv3d->clipbb->vec[val], rv3d->clipbb->vec[val==3?0:val+1], rv3d->clipbb->vec[val+4]);
rv3d->clip[val][3]= - rv3d->clip[val][0]*rv3d->clipbb->vec[val][0]
- rv3d->clip[val][1]*rv3d->clipbb->vec[val][1]
@@ -1960,7 +1960,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
if(mval[0]!=IS_CLIPPED) {
window_to_3d_delta(ar, dvec, mval[0]-mx, mval[1]-my);
- VecSubf(fp, fp, dvec);
+ sub_v3_v3v3(fp, fp, dvec);
}
else {
@@ -2247,9 +2247,9 @@ void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int mode)
m_dist = rv3d->dist;
upvec[0] = upvec[1] = 0;
upvec[2] = rv3d->dist;
- Mat3CpyMat4(mat, rv3d->viewinv);
- Mat3MulVecfl(mat, upvec);
- VecSubf(rv3d->ofs, rv3d->ofs, upvec);
+ copy_m3_m4(mat, rv3d->viewinv);
+ mul_m3_v3(mat, upvec);
+ sub_v3_v3v3(rv3d->ofs, rv3d->ofs, upvec);
rv3d->dist = 0.0;
}
@@ -2263,16 +2263,16 @@ void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int mode)
// rotate device x and y by view z
- Mat3CpyMat4(mat, rv3d->viewinv);
+ copy_m3_m4(mat, rv3d->viewinv);
mat[2][2] = 0.0f;
- Mat3MulVecfl(mat, rvec);
+ mul_m3_v3(mat, rvec);
// rotate the view
- phi = Normalize(rvec);
+ phi = normalize_v3(rvec);
if(phi != 0) {
- VecRotToQuat(rvec,phi,q1);
- QuatMul(rv3d->viewquat, rv3d->viewquat, q1);
+ axis_angle_to_quat(q1,rvec,phi);
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, q1);
}
@@ -2285,13 +2285,13 @@ void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int mode)
// the next three lines rotate the x and y translation coordinates
// by the current z axis angle
- Mat3CpyMat4(mat, rv3d->viewinv);
+ copy_m3_m4(mat, rv3d->viewinv);
mat[2][2] = 0.0f;
- Mat3MulVecfl(mat, tvec);
+ mul_m3_v3(mat, tvec);
// translate the view
- VecSubf(rv3d->ofs, rv3d->ofs, tvec);
+ sub_v3_v3v3(rv3d->ofs, rv3d->ofs, tvec);
/*----------------------------------------------------
@@ -2350,9 +2350,9 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode)
rv3d->dist = m_dist;
upvec[0] = upvec[1] = 0;
upvec[2] = rv3d->dist;
- Mat3CpyMat4(mat, rv3d->viewinv);
- Mat3MulVecfl(mat, upvec);
- VecAddf(rv3d->ofs, rv3d->ofs, upvec);
+ copy_m3_m4(mat, rv3d->viewinv);
+ mul_m3_v3(mat, upvec);
+ add_v3_v3v3(rv3d->ofs, rv3d->ofs, upvec);
}
/*----------------------------------------------------
@@ -2414,8 +2414,8 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode)
d = 1.0f;
/* if (ob) {
- VecSubf(diff, obofs, rv3d->ofs);
- d = VecLength(diff);
+ sub_v3_v3v3(diff, obofs, rv3d->ofs);
+ d = len_v3(diff);
}
*/
@@ -2430,7 +2430,7 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode)
dvec[0] = curareaX * rv3d->persinv[0][0] + curareaY * rv3d->persinv[1][0];
dvec[1] = curareaX * rv3d->persinv[0][1] + curareaY * rv3d->persinv[1][1];
dvec[2] = curareaX * rv3d->persinv[0][2] + curareaY * rv3d->persinv[1][2];
- VecAddf(rv3d->ofs, rv3d->ofs, dvec);
+ add_v3_v3v3(rv3d->ofs, rv3d->ofs, dvec);
/*----------------------------------------------------
* ndof device dolly
@@ -2455,14 +2455,14 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode)
*/
/* Get the 3x3 matrix and its inverse from the quaternion */
- QuatToMat3(rv3d->viewquat, m);
- Mat3Inv(m_inv,m);
+ quat_to_mat3( m,rv3d->viewquat);
+ invert_m3_m3(m_inv,m);
/* Determine the direction of the x vector (for rotating up and down) */
/* This can likely be compuated directly from the quaternion. */
- Mat3MulVecfl(m_inv,xvec);
- Mat3MulVecfl(m_inv,yvec);
- Mat3MulVecfl(m_inv,zvec);
+ mul_m3_v3(m_inv,xvec);
+ mul_m3_v3(m_inv,yvec);
+ mul_m3_v3(m_inv,zvec);
/* Perform the up/down rotation */
phi = sbadjust * rsens * /*0.5f * */ fval[3]; /* spin vertically half as fast as horizontally */
@@ -2471,13 +2471,13 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode)
q1[1] = si * xvec[0];
q1[2] = si * xvec[1];
q1[3] = si * xvec[2];
- QuatMul(rv3d->viewquat, rv3d->viewquat, q1);
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, q1);
if (use_sel) {
- QuatConj(q1); /* conj == inv for unit quat */
- VecSubf(rv3d->ofs, rv3d->ofs, obofs);
- QuatMulVecf(q1, rv3d->ofs);
- VecAddf(rv3d->ofs, rv3d->ofs, obofs);
+ conjugate_qt(q1); /* conj == inv for unit quat */
+ sub_v3_v3v3(rv3d->ofs, rv3d->ofs, obofs);
+ mul_qt_v3(q1, rv3d->ofs);
+ add_v3_v3v3(rv3d->ofs, rv3d->ofs, obofs);
}
/* Perform the orbital rotation */
@@ -2496,13 +2496,13 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode)
q1[0] = cos(phi);
q1[1] = q1[2] = 0.0;
q1[3] = sin(phi);
- QuatMul(rv3d->viewquat, rv3d->viewquat, q1);
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, q1);
if (use_sel) {
- QuatConj(q1);
- VecSubf(rv3d->ofs, rv3d->ofs, obofs);
- QuatMulVecf(q1, rv3d->ofs);
- VecAddf(rv3d->ofs, rv3d->ofs, obofs);
+ conjugate_qt(q1);
+ sub_v3_v3v3(rv3d->ofs, rv3d->ofs, obofs);
+ mul_qt_v3(q1, rv3d->ofs);
+ add_v3_v3v3(rv3d->ofs, rv3d->ofs, obofs);
}
/*----------------------------------------------------
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index d37c81904cf..7e2f41b369b 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -85,7 +85,7 @@
#include "BIF_gl.h"
#include "BIF_glutil.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
@@ -635,7 +635,7 @@ void do_view3d_transform_moveaxismenu(bContext *C, void *arg, int event)
#if 0
float mat[3][3];
- Mat3One(mat);
+ unit_m3(mat);
switch(event)
{
@@ -702,7 +702,7 @@ void do_view3d_transform_rotateaxismenu(bContext *C, void *arg, int event)
#if 0
float mat[3][3];
- Mat3One(mat);
+ unit_m3(mat);
switch(event)
{
@@ -769,7 +769,7 @@ void do_view3d_transform_scaleaxismenu(bContext *C, void *arg, int event)
#if 0
float mat[3][3];
- Mat3One(mat);
+ unit_m3(mat);
switch(event)
{
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index adda08202c0..b8945c849ae 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -39,7 +39,7 @@
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 2505110d766..4b35cd186e6 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -49,7 +49,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
@@ -120,7 +120,7 @@ void view3d_get_view_aligned_coordinate(ViewContext *vc, float *fp, short mval[2
if(mval[0]!=IS_CLIPPED) {
window_to_3d_delta(vc->ar, dvec, mval[0]-mx, mval[1]-my);
- VecSubf(fp, fp, dvec);
+ sub_v3_v3v3(fp, fp, dvec);
}
}
@@ -129,7 +129,7 @@ void view3d_get_transformation(ViewContext *vc, Object *ob, bglMats *mats)
float cpy[4][4];
int i, j;
- Mat4MulMat4(cpy, ob->obmat, vc->rv3d->viewmat);
+ mul_m4_m4m4(cpy, ob->obmat, vc->rv3d->viewmat);
for(i = 0; i < 4; ++i) {
for(j = 0; j < 4; ++j) {
@@ -326,9 +326,9 @@ int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, in
/* no points in lasso, so we have to intersect with lasso edge */
- if( IsectLL2Ds(mcords[0], mcords[moves-1], v1, v2) > 0) return 1;
+ if( isect_line_line_v2_short(mcords[0], mcords[moves-1], v1, v2) > 0) return 1;
for(a=0; a<moves-1; a++) {
- if( IsectLL2Ds(mcords[a], mcords[a+1], v1, v2) > 0) return 1;
+ if( isect_line_line_v2_short(mcords[a], mcords[a+1], v1, v2) > 0) return 1;
}
return 0;
@@ -349,10 +349,10 @@ static void do_lasso_select_pose(ViewContext *vc, short mcords[][2], short moves
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
VECCOPY(vec, pchan->pose_head);
- Mat4MulVecfl(ob->obmat, vec);
+ mul_m4_v3(ob->obmat, vec);
project_short(vc->ar, vec, sco1);
VECCOPY(vec, pchan->pose_tail);
- Mat4MulVecfl(ob->obmat, vec);
+ mul_m4_v3(ob->obmat, vec);
project_short(vc->ar, vec, sco2);
if(lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
@@ -625,10 +625,10 @@ static void do_lasso_select_armature(ViewContext *vc, short mcords[][2], short m
for (ebone= arm->edbo->first; ebone; ebone=ebone->next) {
VECCOPY(vec, ebone->head);
- Mat4MulVecfl(vc->obedit->obmat, vec);
+ mul_m4_v3(vc->obedit->obmat, vec);
project_short(vc->ar, vec, sco1);
VECCOPY(vec, ebone->tail);
- Mat4MulVecfl(vc->obedit->obmat, vec);
+ mul_m4_v3(vc->obedit->obmat, vec);
project_short(vc->ar, vec, sco2);
didpoint= 0;
@@ -1227,7 +1227,7 @@ int edge_inside_circle(short centx, short centy, short rad, short x1, short y1,
v2[0]= x2;
v2[1]= y2;
- if( PdistVL2Dfl(v3, v1, v2) < (float)rad ) return 1;
+ if( dist_to_line_segment_v2(v3, v1, v2) < (float)rad ) return 1;
return 0;
}
@@ -1859,12 +1859,12 @@ static void armature_circle_select(ViewContext *vc, int selecting, short *mval,
/* project head location to screenspace */
VECCOPY(vec, ebone->head);
- Mat4MulVecfl(vc->obedit->obmat, vec);
+ mul_m4_v3(vc->obedit->obmat, vec);
project_short(vc->ar, vec, sco1);
/* project tail location to screenspace */
VECCOPY(vec, ebone->tail);
- Mat4MulVecfl(vc->obedit->obmat, vec);
+ mul_m4_v3(vc->obedit->obmat, vec);
project_short(vc->ar, vec, sco2);
/* check if the head and/or tail is in the circle
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 205d3e6df8c..933b12ae679 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -48,7 +48,7 @@
#include "DNA_view3d_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_linklist.h"
@@ -135,8 +135,8 @@ static void special_transvert_update(Scene *scene, Object *obedit)
if (tv) {
float diffvec[3];
- VecSubf(diffvec, tv->loc, tv->oldloc);
- VecAddf(ebo->tail, ebo->tail, diffvec);
+ sub_v3_v3v3(diffvec, tv->loc, tv->oldloc);
+ add_v3_v3v3(ebo->tail, ebo->tail, diffvec);
a++;
if (a<tottrans) tv++;
@@ -454,21 +454,21 @@ static int snap_sel_to_grid(bContext *C, wmOperator *op)
make_trans_verts(obedit, bmat[0], bmat[1], 0);
if(tottrans==0) return OPERATOR_CANCELLED;
- Mat3CpyMat4(bmat, obedit->obmat);
- Mat3Inv(imat, bmat);
+ copy_m3_m4(bmat, obedit->obmat);
+ invert_m3_m3(imat, bmat);
tv= transvmain;
for(a=0; a<tottrans; a++, tv++) {
VECCOPY(vec, tv->loc);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, obedit->obmat[3]);
+ mul_m3_v3(bmat, vec);
+ add_v3_v3v3(vec, vec, obedit->obmat[3]);
vec[0]= v3d->gridview*floor(.5+ vec[0]/gridf);
vec[1]= v3d->gridview*floor(.5+ vec[1]/gridf);
vec[2]= v3d->gridview*floor(.5+ vec[2]/gridf);
- VecSubf(vec, vec, obedit->obmat[3]);
+ sub_v3_v3v3(vec, vec, obedit->obmat[3]);
- Mat3MulVecfl(imat, vec);
+ mul_m3_v3(imat, vec);
VECCOPY(tv->loc, vec);
}
@@ -525,8 +525,8 @@ static int snap_sel_to_grid(bContext *C, wmOperator *op)
if(ob->parent) {
where_is_object(scene, ob);
- Mat3Inv(imat, originmat);
- Mat3MulVecfl(imat, vec);
+ invert_m3_m3(imat, originmat);
+ mul_m3_v3(imat, vec);
ob->loc[0]+= vec[0];
ob->loc[1]+= vec[1];
ob->loc[2]+= vec[2];
@@ -586,8 +586,8 @@ static int snap_sel_to_curs(bContext *C, wmOperator *op)
make_trans_verts(obedit, bmat[0], bmat[1], 0);
if(tottrans==0) return OPERATOR_CANCELLED;
- Mat3CpyMat4(bmat, obedit->obmat);
- Mat3Inv(imat, bmat);
+ copy_m3_m4(bmat, obedit->obmat);
+ invert_m3_m3(imat, bmat);
tv= transvmain;
for(a=0; a<tottrans; a++, tv++) {
@@ -595,7 +595,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *op)
vec[1]= curs[1]-obedit->obmat[3][1];
vec[2]= curs[2]-obedit->obmat[3][2];
- Mat3MulVecfl(imat, vec);
+ mul_m3_v3(imat, vec);
VECCOPY(tv->loc, vec);
}
@@ -612,9 +612,9 @@ static int snap_sel_to_curs(bContext *C, wmOperator *op)
bArmature *arm= ob->data;
float cursp[3];
- Mat4Invert(ob->imat, ob->obmat);
+ invert_m4_m4(ob->imat, ob->obmat);
VECCOPY(cursp, curs);
- Mat4MulVecfl(ob->imat, cursp);
+ mul_m4_v3(ob->imat, cursp);
for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
if(pchan->bone->flag & BONE_SELECTED) {
@@ -650,8 +650,8 @@ static int snap_sel_to_curs(bContext *C, wmOperator *op)
if(ob->parent) {
where_is_object(scene, ob);
- Mat3Inv(imat, originmat);
- Mat3MulVecfl(imat, vec);
+ invert_m3_m3(imat, originmat);
+ mul_m3_v3(imat, vec);
ob->loc[0]+= vec[0];
ob->loc[1]+= vec[1];
ob->loc[2]+= vec[2];
@@ -749,19 +749,19 @@ static int snap_curs_to_sel(bContext *C, wmOperator *op)
make_trans_verts(obedit, bmat[0], bmat[1], 2);
if(tottrans==0) return OPERATOR_CANCELLED;
- Mat3CpyMat4(bmat, obedit->obmat);
+ copy_m3_m4(bmat, obedit->obmat);
tv= transvmain;
for(a=0; a<tottrans; a++, tv++) {
VECCOPY(vec, tv->loc);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, obedit->obmat[3]);
- VecAddf(centroid, centroid, vec);
+ mul_m3_v3(bmat, vec);
+ add_v3_v3v3(vec, vec, obedit->obmat[3]);
+ add_v3_v3v3(centroid, centroid, vec);
DO_MINMAX(vec, min, max);
}
if(v3d->around==V3D_CENTROID) {
- VecMulf(centroid, 1.0/(float)tottrans);
+ mul_v3_fl(centroid, 1.0/(float)tottrans);
VECCOPY(curs, centroid);
}
else {
@@ -782,8 +782,8 @@ static int snap_curs_to_sel(bContext *C, wmOperator *op)
if(arm->layer & pchan->bone->layer) {
if(pchan->bone->flag & BONE_SELECTED) {
VECCOPY(vec, pchan->pose_head);
- Mat4MulVecfl(ob->obmat, vec);
- VecAddf(centroid, centroid, vec);
+ mul_m4_v3(ob->obmat, vec);
+ add_v3_v3v3(centroid, centroid, vec);
DO_MINMAX(vec, min, max);
count++;
}
@@ -793,7 +793,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *op)
else {
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
VECCOPY(vec, ob->obmat[3]);
- VecAddf(centroid, centroid, vec);
+ add_v3_v3v3(centroid, centroid, vec);
DO_MINMAX(vec, min, max);
count++;
}
@@ -801,7 +801,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *op)
}
if(count) {
if(v3d->around==V3D_CENTROID) {
- VecMulf(centroid, 1.0/(float)count);
+ mul_v3_fl(centroid, 1.0/(float)count);
VECCOPY(curs, centroid);
}
else {
@@ -854,7 +854,7 @@ static int snap_curs_to_active(bContext *C, wmOperator *op)
EM_editselection_center(curs, &ese);
}
- Mat4MulVecfl(obedit->obmat, curs);
+ mul_m4_v3(obedit->obmat, curs);
}
}
else {
@@ -908,20 +908,20 @@ static int snap_selected_to_center(bContext *C, wmOperator *op)
make_trans_verts(obedit, bmat[0], bmat[1], 0);
if(tottrans==0) return OPERATOR_CANCELLED;
- Mat3CpyMat4(bmat, obedit->obmat);
- Mat3Inv(imat, bmat);
+ copy_m3_m4(bmat, obedit->obmat);
+ invert_m3_m3(imat, bmat);
tv= transvmain;
for(a=0; a<tottrans; a++, tv++) {
VECCOPY(vec, tv->loc);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, obedit->obmat[3]);
- VecAddf(centroid, centroid, vec);
+ mul_m3_v3(bmat, vec);
+ add_v3_v3v3(vec, vec, obedit->obmat[3]);
+ add_v3_v3v3(centroid, centroid, vec);
DO_MINMAX(vec, min, max);
}
if(v3d->around==V3D_CENTROID) {
- VecMulf(centroid, 1.0/(float)tottrans);
+ mul_v3_fl(centroid, 1.0/(float)tottrans);
VECCOPY(snaploc, centroid);
}
else {
@@ -944,7 +944,7 @@ static int snap_selected_to_center(bContext *C, wmOperator *op)
if(pchan->bone->flag & BONE_SELECTED) {
if(pchan->bone->layer & arm->layer) {
VECCOPY(vec, pchan->pose_mat[3]);
- VecAddf(centroid, centroid, vec);
+ add_v3_v3v3(centroid, centroid, vec);
DO_MINMAX(vec, min, max);
count++;
}
@@ -954,7 +954,7 @@ static int snap_selected_to_center(bContext *C, wmOperator *op)
else {
/* not armature bones (i.e. objects) */
VECCOPY(vec, ob->obmat[3]);
- VecAddf(centroid, centroid, vec);
+ add_v3_v3v3(centroid, centroid, vec);
DO_MINMAX(vec, min, max);
count++;
}
@@ -963,7 +963,7 @@ static int snap_selected_to_center(bContext *C, wmOperator *op)
if(count) {
if(v3d->around==V3D_CENTROID) {
- VecMulf(centroid, 1.0/(float)count);
+ mul_v3_fl(centroid, 1.0/(float)count);
VECCOPY(snaploc, centroid);
}
else {
@@ -982,8 +982,8 @@ static int snap_selected_to_center(bContext *C, wmOperator *op)
make_trans_verts(obedit, bmat[0], bmat[1], 0);
if(tottrans==0) return OPERATOR_CANCELLED;
- Mat3CpyMat4(bmat, obedit->obmat);
- Mat3Inv(imat, bmat);
+ copy_m3_m4(bmat, obedit->obmat);
+ invert_m3_m3(imat, bmat);
tv= transvmain;
for(a=0; a<tottrans; a++, tv++) {
@@ -991,7 +991,7 @@ static int snap_selected_to_center(bContext *C, wmOperator *op)
vec[1]= snaploc[1]-obedit->obmat[3][1];
vec[2]= snaploc[2]-obedit->obmat[3][2];
- Mat3MulVecfl(imat, vec);
+ mul_m3_v3(imat, vec);
VECCOPY(tv->loc, vec);
}
@@ -1040,8 +1040,8 @@ static int snap_selected_to_center(bContext *C, wmOperator *op)
if(ob->parent) {
where_is_object(scene, ob);
- Mat3Inv(imat, originmat);
- Mat3MulVecfl(imat, vec);
+ invert_m3_m3(imat, originmat);
+ mul_m3_v3(imat, vec);
ob->loc[0]+= vec[0];
ob->loc[1]+= vec[1];
ob->loc[2]+= vec[2];
@@ -1093,14 +1093,14 @@ int minmax_verts(Object *obedit, float *min, float *max)
if(tottrans==0) return 0;
- Mat3CpyMat4(bmat, obedit->obmat);
+ copy_m3_m4(bmat, obedit->obmat);
tv= transvmain;
for(a=0; a<tottrans; a++, tv++) {
VECCOPY(vec, tv->loc);
- Mat3MulVecfl(bmat, vec);
- VecAddf(vec, vec, obedit->obmat[3]);
- VecAddf(centroid, centroid, vec);
+ mul_m3_v3(bmat, vec);
+ add_v3_v3v3(vec, vec, obedit->obmat[3]);
+ add_v3_v3v3(centroid, centroid, vec);
DO_MINMAX(vec, min, max);
}
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index e1c6f70bde0..3249f26aff6 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -51,7 +51,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 9fbc916c02d..96a16e733d0 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -45,7 +45,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
@@ -161,26 +161,26 @@ static void view_settings_from_ob(Object *ob, float *ofs, float *quat, float *di
/* Offset */
if (ofs) {
VECCOPY(ofs, ob->obmat[3]);
- VecMulf(ofs, -1.0f); /*flip the vector*/
+ mul_v3_fl(ofs, -1.0f); /*flip the vector*/
}
/* Quat */
if (quat) {
- Mat4CpyMat4(bmat, ob->obmat);
- Mat4Ortho(bmat);
- Mat4Invert(imat, bmat);
- Mat3CpyMat4(tmat, imat);
- Mat3ToQuat(tmat, quat);
+ copy_m4_m4(bmat, ob->obmat);
+ normalize_m4(bmat);
+ invert_m4_m4(imat, bmat);
+ copy_m3_m4(tmat, imat);
+ mat3_to_quat( quat,tmat);
}
if (dist) {
float vec[3];
- Mat3CpyMat4(tmat, ob->obmat);
+ copy_m3_m4(tmat, ob->obmat);
vec[0]= vec[1] = 0.0;
vec[2]= -(*dist);
- Mat3MulVecfl(tmat, vec);
- VecSubf(ofs, ofs, vec);
+ mul_m3_v3(tmat, vec);
+ sub_v3_v3v3(ofs, ofs, vec);
}
/* Lens */
@@ -263,10 +263,10 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
VECCOPY(vec1, sms.new_quat);
VECCOPY(vec2, sms.orig_quat);
- Normalize(vec1);
- Normalize(vec2);
+ normalize_v3(vec1);
+ normalize_v3(vec2);
/* scale the time allowed by the rotation */
- sms.time_allowed *= NormalizedVecAngle2(vec1, vec2)/(M_PI/2);
+ sms.time_allowed *= angle_normalized_v3v3(vec1, vec2)/(M_PI/2);
}
/* original values */
@@ -361,7 +361,7 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *op, wmEvent *event)
for (i=0; i<3; i++)
rv3d->ofs[i] = sms->new_ofs[i]*step + sms->orig_ofs[i]*step_inv;
- QuatInterpol(rv3d->viewquat, sms->orig_quat, sms->new_quat, step);
+ interp_qt_qtqt(rv3d->viewquat, sms->orig_quat, sms->new_quat, step);
rv3d->dist = sms->new_dist*step + sms->orig_dist*step_inv;
v3d->lens = sms->new_lens*step + sms->orig_lens*step_inv;
@@ -395,10 +395,10 @@ static void setcameratoview3d(View3D *v3d, RegionView3D *rv3d, Object *ob)
dvec[2]= rv3d->dist*rv3d->viewinv[2][2];
VECCOPY(ob->loc, dvec);
- VecSubf(ob->loc, ob->loc, rv3d->ofs);
+ sub_v3_v3v3(ob->loc, ob->loc, rv3d->ofs);
rv3d->viewquat[0]= -rv3d->viewquat[0];
- QuatToEul(rv3d->viewquat, ob->rot);
+ quat_to_eul( ob->rot,rv3d->viewquat);
rv3d->viewquat[0]= -rv3d->viewquat[0];
ob->recalc= OB_RECALC_OB;
@@ -493,12 +493,12 @@ void viewline(ARegion *ar, View3D *v3d, float mval[2], float ray_start[3], float
vec[2]= -1.0f;
vec[3]= 1.0f;
- Mat4MulVec4fl(rv3d->persinv, vec);
- VecMulf(vec, 1.0f / vec[3]);
+ mul_m4_v4(rv3d->persinv, vec);
+ mul_v3_fl(vec, 1.0f / vec[3]);
VECCOPY(ray_start, rv3d->viewinv[3]);
VECSUB(vec, vec, ray_start);
- Normalize(vec);
+ normalize_v3(vec);
VECADDFAC(ray_start, rv3d->viewinv[3], vec, v3d->near);
VECADDFAC(ray_end, rv3d->viewinv[3], vec, v3d->far);
@@ -509,7 +509,7 @@ void viewline(ARegion *ar, View3D *v3d, float mval[2], float ray_start[3], float
vec[2] = 0.0f;
vec[3] = 1.0f;
- Mat4MulVec4fl(rv3d->persinv, vec);
+ mul_m4_v4(rv3d->persinv, vec);
VECADDFAC(ray_start, vec, rv3d->viewinv[2], 1000.0f);
VECADDFAC(ray_end, vec, rv3d->viewinv[2], -1000.0f);
@@ -522,8 +522,8 @@ void viewray(ARegion *ar, View3D *v3d, float mval[2], float ray_start[3], float
float ray_end[3];
viewline(ar, v3d, mval, ray_start, ray_end);
- VecSubf(ray_normal, ray_end, ray_start);
- Normalize(ray_normal);
+ sub_v3_v3v3(ray_normal, ray_end, ray_start);
+ normalize_v3(ray_normal);
}
@@ -601,8 +601,8 @@ void view3d_get_object_project_mat(RegionView3D *rv3d, Object *ob, float pmat[4]
{
float vmat[4][4];
- Mat4MulMat4(vmat, ob->obmat, rv3d->viewmat);
- Mat4MulMat4(pmat, vmat, rv3d->winmat);
+ mul_m4_m4m4(vmat, ob->obmat, rv3d->viewmat);
+ mul_m4_m4m4(pmat, vmat, rv3d->winmat);
}
/* Uses window coordinates (x,y) and depth component z to find a point in
@@ -627,7 +627,7 @@ void view3d_project_float(ARegion *ar, float *vec, float *adr, float mat[4][4])
VECCOPY(vec4, vec);
vec4[3]= 1.0;
- Mat4MulVec4fl(mat, vec4);
+ mul_m4_v4(mat, vec4);
if( vec4[3]>FLT_EPSILON ) {
adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3];
@@ -648,12 +648,12 @@ int boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb)
if(bb==NULL) return 1;
if(bb->flag & OB_BB_DISABLED) return 1;
- Mat4MulMat4(mat, obmat, rv3d->persmat);
+ mul_m4_m4m4(mat, obmat, rv3d->persmat);
for(a=0; a<8; a++) {
VECCOPY(vec, bb->vec[a]);
vec[3]= 1.0;
- Mat4MulVec4fl(mat, vec);
+ mul_m4_v4(mat, vec);
max= vec[3];
min= -vec[3];
@@ -686,7 +686,7 @@ void project_short(ARegion *ar, float *vec, short *adr) /* clips */
VECCOPY(vec4, vec);
vec4[3]= 1.0;
- Mat4MulVec4fl(rv3d->persmat, vec4);
+ mul_m4_v4(rv3d->persmat, vec4);
if( vec4[3]>BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
@@ -712,7 +712,7 @@ void project_int(ARegion *ar, float *vec, int *adr)
VECCOPY(vec4, vec);
vec4[3]= 1.0;
- Mat4MulVec4fl(rv3d->persmat, vec4);
+ mul_m4_v4(rv3d->persmat, vec4);
if( vec4[3]>BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
@@ -736,7 +736,7 @@ void project_int_noclip(ARegion *ar, float *vec, int *adr)
VECCOPY(vec4, vec);
vec4[3]= 1.0;
- Mat4MulVec4fl(rv3d->persmat, vec4);
+ mul_m4_v4(rv3d->persmat, vec4);
if( fabs(vec4[3]) > BL_NEAR_CLIP ) {
fx = (ar->winx/2)*(1 + vec4[0]/vec4[3]);
@@ -761,7 +761,7 @@ void project_short_noclip(ARegion *ar, float *vec, short *adr)
VECCOPY(vec4, vec);
vec4[3]= 1.0;
- Mat4MulVec4fl(rv3d->persmat, vec4);
+ mul_m4_v4(rv3d->persmat, vec4);
if( vec4[3]>BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
@@ -787,7 +787,7 @@ void project_float(ARegion *ar, float *vec, float *adr)
VECCOPY(vec4, vec);
vec4[3]= 1.0;
- Mat4MulVec4fl(rv3d->persmat, vec4);
+ mul_m4_v4(rv3d->persmat, vec4);
if( vec4[3]>BL_NEAR_CLIP ) {
adr[0] = (float)(ar->winx/2.0)+(ar->winx/2.0)*vec4[0]/vec4[3];
@@ -803,7 +803,7 @@ void project_float_noclip(ARegion *ar, float *vec, float *adr)
VECCOPY(vec4, vec);
vec4[3]= 1.0;
- Mat4MulVec4fl(rv3d->persmat, vec4);
+ mul_m4_v4(rv3d->persmat, vec4);
if( fabs(vec4[3]) > BL_NEAR_CLIP ) {
adr[0] = (float)(ar->winx/2.0)+(ar->winx/2.0)*vec4[0]/vec4[3];
@@ -1001,12 +1001,12 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short
rv3d->view= 0; /* dont show the grid */
- Mat4CpyMat4(bmat, ob->obmat);
- Mat4Ortho(bmat);
- Mat4Invert(rv3d->viewmat, bmat);
+ copy_m4_m4(bmat, ob->obmat);
+ normalize_m4(bmat);
+ invert_m4_m4(rv3d->viewmat, bmat);
/* view quat calculation, needed for add object */
- Mat3CpyMat4(tmat, rv3d->viewmat);
+ copy_m3_m4(tmat, rv3d->viewmat);
if (smooth) {
float new_quat[4];
if (rv3d->persp==RV3D_CAMOB && v3d->camera) {
@@ -1018,7 +1018,7 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short
VECCOPY(orig_ofs, rv3d->ofs);
/* Switch from camera view */
- Mat3ToQuat(tmat, new_quat);
+ mat3_to_quat( new_quat,tmat);
rv3d->persp=RV3D_PERSP;
rv3d->dist= 0.0;
@@ -1029,11 +1029,11 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short
rv3d->persp=RV3D_CAMOB; /* just to be polite, not needed */
} else {
- Mat3ToQuat(tmat, new_quat);
+ mat3_to_quat( new_quat,tmat);
smooth_view(NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
}
} else {
- Mat3ToQuat(tmat, rv3d->viewquat);
+ mat3_to_quat( rv3d->viewquat,tmat);
}
}
@@ -1077,7 +1077,7 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d)
obmat_to_viewmat(v3d, rv3d, v3d->camera, 0);
}
else {
- QuatToMat4(rv3d->viewquat, rv3d->viewmat);
+ quat_to_mat4( rv3d->viewmat,rv3d->viewquat);
rv3d->viewmat[3][2]-= rv3d->dist;
}
}
@@ -1086,7 +1086,7 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d)
if(rv3d->viewlock)
view3d_viewlock(rv3d);
- QuatToMat4(rv3d->viewquat, rv3d->viewmat);
+ quat_to_mat4( rv3d->viewmat,rv3d->viewquat);
if(rv3d->persp==RV3D_PERSP) rv3d->viewmat[3][2]-= rv3d->dist;
if(v3d->ob_centre) {
Object *ob= v3d->ob_centre;
@@ -1097,12 +1097,12 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d)
bPoseChannel *pchan= get_pose_channel(ob->pose, v3d->ob_centre_bone);
if(pchan) {
VECCOPY(vec, pchan->pose_mat[3]);
- Mat4MulVecfl(ob->obmat, vec);
+ mul_m4_v3(ob->obmat, vec);
}
}
- i_translate(-vec[0], -vec[1], -vec[2], rv3d->viewmat);
+ translate_m4( rv3d->viewmat,-vec[0], -vec[1], -vec[2]);
}
- else i_translate(rv3d->ofs[0], rv3d->ofs[1], rv3d->ofs[2], rv3d->viewmat);
+ else translate_m4( rv3d->viewmat,rv3d->ofs[0], rv3d->ofs[1], rv3d->ofs[2]);
}
}
@@ -1136,7 +1136,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
}
setwinmatrixview3d(ar, v3d, &rect);
- Mat4MulMat4(vc->rv3d->persmat, vc->rv3d->viewmat, vc->rv3d->winmat);
+ mul_m4_m4m4(vc->rv3d->persmat, vc->rv3d->viewmat, vc->rv3d->winmat);
if(v3d->drawtype > OB_WIRE) {
v3d->zbuf= TRUE;
@@ -1186,11 +1186,11 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
for(dob= lb->first; dob; dob= dob->next) {
tbase.object= dob->ob;
- Mat4CpyMat4(dob->ob->obmat, dob->mat);
+ copy_m4_m4(dob->ob->obmat, dob->mat);
draw_object(scene, ar, v3d, &tbase, DRAW_PICKING|DRAW_CONSTCOLOR);
- Mat4CpyMat4(dob->ob->obmat, dob->omat);
+ copy_m4_m4(dob->ob->obmat, dob->omat);
}
free_object_duplilist(lb);
}
@@ -1206,7 +1206,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
G.f &= ~G_PICKSEL;
setwinmatrixview3d(ar, v3d, NULL);
- Mat4MulMat4(vc->rv3d->persmat, vc->rv3d->viewmat, vc->rv3d->winmat);
+ mul_m4_m4m4(vc->rv3d->persmat, vc->rv3d->viewmat, vc->rv3d->winmat);
if(v3d->drawtype > OB_WIRE) {
v3d->zbuf= 0;
@@ -1851,8 +1851,8 @@ int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event)
/* detect weather to start with Z locking */
upvec[0]=1.0f; upvec[1]=0.0f; upvec[2]=0.0f;
- Mat3CpyMat4(mat, fly->rv3d->viewinv);
- Mat3MulVecfl(mat, upvec);
+ copy_m3_m4(mat, fly->rv3d->viewinv);
+ mul_m3_v3(mat, upvec);
if (fabs(upvec[2]) < 0.1)
fly->zlock = 1;
upvec[0]=0; upvec[1]=0; upvec[2]=0;
@@ -1866,7 +1866,7 @@ int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event)
where_is_object(fly->scene, fly->v3d->camera);
VECCOPY(fly->rv3d->ofs, fly->v3d->camera->obmat[3]);
- VecMulf(fly->rv3d->ofs, -1.0f); /*flip the vector*/
+ mul_v3_fl(fly->rv3d->ofs, -1.0f); /*flip the vector*/
fly->rv3d->dist=0.0;
fly->rv3d->viewbut=0;
@@ -1884,8 +1884,8 @@ int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event)
fly->rv3d->dist= 0.0;
upvec[2]= fly->dist_backup; /*x and y are 0*/
- Mat3MulVecfl(mat, upvec);
- VecSubf(fly->rv3d->ofs, fly->rv3d->ofs, upvec);
+ mul_m3_v3(mat, upvec);
+ sub_v3_v3v3(fly->rv3d->ofs, fly->rv3d->ofs, upvec);
/*Done with correcting for the dist*/
}
@@ -1922,8 +1922,8 @@ static int flyEnd(bContext *C, FlyInfo *fly)
}
else if (fly->persp_backup==RV3D_CAMOB) { /* camera */
float mat3[3][3];
- Mat3CpyMat4(mat3, v3d->camera->obmat);
- Mat3ToCompatibleEul(mat3, v3d->camera->rot, fly->rot_backup);
+ copy_m3_m4(mat3, v3d->camera->obmat);
+ mat3_to_compatible_eul( v3d->camera->rot, fly->rot_backup,mat3);
DAG_id_flush_update(&v3d->camera->id, OB_RECALC_OB);
#if 0 //XXX2.5
@@ -1941,9 +1941,9 @@ static int flyEnd(bContext *C, FlyInfo *fly)
float mat[3][3];
upvec[0]= upvec[1]= 0;
upvec[2]= fly->dist_backup; /*x and y are 0*/
- Mat3CpyMat4(mat, rv3d->viewinv);
- Mat3MulVecfl(mat, upvec);
- VecAddf(rv3d->ofs, rv3d->ofs, upvec);
+ copy_m3_m4(mat, rv3d->viewinv);
+ mul_m3_v3(mat, upvec);
+ add_v3_v3v3(rv3d->ofs, rv3d->ofs, upvec);
/*Done with correcting for the dist */
}
@@ -2176,7 +2176,7 @@ int flyApply(FlyInfo *fly)
if (fly->use_precision)
fly->speed= fly->speed * (1.0f-time_redraw_clamped);
- Mat3CpyMat4(mat, rv3d->viewinv);
+ copy_m3_m4(mat, rv3d->viewinv);
if (fly->pan_view==TRUE) {
/* pan only */
@@ -2189,8 +2189,8 @@ int flyApply(FlyInfo *fly)
dvec_tmp[1] *= 0.1;
}
- Mat3MulVecfl(mat, dvec_tmp);
- VecMulf(dvec_tmp, time_redraw*200.0 * fly->grid);
+ mul_m3_v3(mat, dvec_tmp);
+ mul_v3_fl(dvec_tmp, time_redraw*200.0 * fly->grid);
} else {
float roll; /* similar to the angle between the camera's up and the Z-up, but its very rough so just roll*/
@@ -2200,9 +2200,9 @@ int flyApply(FlyInfo *fly)
upvec[0]=1;
upvec[1]=0;
upvec[2]=0;
- Mat3MulVecfl(mat, upvec);
- VecRotToQuat( upvec, (float)moffset[1]*-time_redraw*20, tmp_quat); /* Rotate about the relative up vec */
- QuatMul(rv3d->viewquat, rv3d->viewquat, tmp_quat);
+ mul_m3_v3(mat, upvec);
+ axis_angle_to_quat( tmp_quat, upvec, (float)moffset[1]*-time_redraw*20); /* Rotate about the relative up vec */
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
if (fly->xlock) fly->xlock = 2; /*check for rotation*/
if (fly->zlock) fly->zlock = 2;
@@ -2216,7 +2216,7 @@ int flyApply(FlyInfo *fly)
upvec[0]=0;
upvec[1]=1;
upvec[2]=0;
- Mat3MulVecfl(mat, upvec);
+ mul_m3_v3(mat, upvec);
if(upvec[2] < 0.0f)
moffset[0]= -moffset[0];
@@ -2230,11 +2230,11 @@ int flyApply(FlyInfo *fly)
upvec[0]=0;
upvec[1]=1;
upvec[2]=0;
- Mat3MulVecfl(mat, upvec);
+ mul_m3_v3(mat, upvec);
}
- VecRotToQuat( upvec, (float)moffset[0]*time_redraw*20, tmp_quat); /* Rotate about the relative up vec */
- QuatMul(rv3d->viewquat, rv3d->viewquat, tmp_quat);
+ axis_angle_to_quat( tmp_quat, upvec, (float)moffset[0]*time_redraw*20); /* Rotate about the relative up vec */
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
if (fly->xlock) fly->xlock = 2;/*check for rotation*/
if (fly->zlock) fly->zlock = 2;
@@ -2244,7 +2244,7 @@ int flyApply(FlyInfo *fly)
upvec[0]=1;
upvec[1]=0;
upvec[2]=0;
- Mat3MulVecfl(mat, upvec);
+ mul_m3_v3(mat, upvec);
/*make sure we have some z rolling*/
if (fabs(upvec[2]) > 0.00001f) {
@@ -2253,9 +2253,9 @@ int flyApply(FlyInfo *fly)
upvec[1]=0;
upvec[2]=1;
- Mat3MulVecfl(mat, upvec);
- VecRotToQuat( upvec, roll*time_redraw_clamped*fly->zlock_momentum*0.1, tmp_quat); /* Rotate about the relative up vec */
- QuatMul(rv3d->viewquat, rv3d->viewquat, tmp_quat);
+ mul_m3_v3(mat, upvec);
+ axis_angle_to_quat( tmp_quat, upvec, roll*time_redraw_clamped*fly->zlock_momentum*0.1); /* Rotate about the relative up vec */
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
fly->zlock_momentum += 0.05f;
} else {
@@ -2268,7 +2268,7 @@ int flyApply(FlyInfo *fly)
upvec[0]=0;
upvec[1]=0;
upvec[2]=1;
- Mat3MulVecfl(mat, upvec);
+ mul_m3_v3(mat, upvec);
/*make sure we have some z rolling*/
if (fabs(upvec[2]) > 0.00001) {
roll= upvec[2] * -5;
@@ -2277,10 +2277,10 @@ int flyApply(FlyInfo *fly)
upvec[1]= 0.0f;
upvec[2]= 0.0f;
- Mat3MulVecfl(mat, upvec);
+ mul_m3_v3(mat, upvec);
- VecRotToQuat( upvec, roll*time_redraw_clamped*fly->xlock_momentum*0.1f, tmp_quat); /* Rotate about the relative up vec */
- QuatMul(rv3d->viewquat, rv3d->viewquat, tmp_quat);
+ axis_angle_to_quat( tmp_quat, upvec, roll*time_redraw_clamped*fly->xlock_momentum*0.1f); /* Rotate about the relative up vec */
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
fly->xlock_momentum += 0.05f;
} else {
@@ -2297,14 +2297,14 @@ int flyApply(FlyInfo *fly)
/* move along the current axis */
dvec_tmp[fly->axis]= 1.0f;
- Mat3MulVecfl(mat, dvec_tmp);
+ mul_m3_v3(mat, dvec_tmp);
- VecMulf(dvec_tmp, fly->speed * time_redraw * 0.25f);
+ mul_v3_fl(dvec_tmp, fly->speed * time_redraw * 0.25f);
}
}
/* impose a directional lag */
- VecLerpf(dvec, dvec_tmp, fly->dvec_prev, (1.0f/(1.0f+(time_redraw*5.0f))));
+ interp_v3_v3v3(dvec, dvec_tmp, fly->dvec_prev, (1.0f/(1.0f+(time_redraw*5.0f))));
if (rv3d->persp==RV3D_CAMOB) {
if (v3d->camera->protectflag & OB_LOCK_LOCX)
@@ -2315,7 +2315,7 @@ int flyApply(FlyInfo *fly)
dvec[2] = 0.0;
}
- VecAddf(rv3d->ofs, rv3d->ofs, dvec);
+ add_v3_v3v3(rv3d->ofs, rv3d->ofs, dvec);
#if 0 //XXX2.5
if (fly->zlock && fly->xlock)
headerprint("FlyKeys Speed:(+/- | Wheel), Upright Axis:X on/Z on, Slow:Shift, Direction:WASDRF, Ok:LMB, Pan:MMB, Cancel:RMB");
@@ -2338,7 +2338,7 @@ int flyApply(FlyInfo *fly)
{ //XXX - some reason setcameratoview3d doesnt copy, shouldnt not be needed!
VECCOPY(v3d->camera->loc, rv3d->ofs);
- VecNegf(v3d->camera->loc);
+ negate_v3(v3d->camera->loc);
}
rv3d->persp= RV3D_CAMOB;
@@ -2466,11 +2466,11 @@ void view3d_align_axis_to_vector(View3D *v3d, RegionView3D *rv3d, int axisidx, f
else alignaxis[-axisidx-1]= -1.0;
VECCOPY(norm, vec);
- Normalize(norm);
+ normalize_v3(norm);
- angle= (float)acos(Inpf(alignaxis, norm));
- Crossf(axis, alignaxis, norm);
- VecRotToQuat(axis, -angle, new_quat);
+ angle= (float)acos(dot_v3v3(alignaxis, norm));
+ cross_v3_v3v3(axis, alignaxis, norm);
+ axis_angle_to_quat( new_quat,axis, -angle);
rv3d->view= 0;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 7467f7880af..c8c2a000450 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -106,7 +106,7 @@
#include "WM_types.h"
#include "WM_api.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_ghash.h"
@@ -129,17 +129,17 @@ void setTransformViewMatrices(TransInfo *t)
if(t->spacetype==SPACE_VIEW3D && t->ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d = t->ar->regiondata;
- Mat4CpyMat4(t->viewmat, rv3d->viewmat);
- Mat4CpyMat4(t->viewinv, rv3d->viewinv);
- Mat4CpyMat4(t->persmat, rv3d->persmat);
- Mat4CpyMat4(t->persinv, rv3d->persinv);
+ copy_m4_m4(t->viewmat, rv3d->viewmat);
+ copy_m4_m4(t->viewinv, rv3d->viewinv);
+ copy_m4_m4(t->persmat, rv3d->persmat);
+ copy_m4_m4(t->persinv, rv3d->persinv);
t->persp = rv3d->persp;
}
else {
- Mat4One(t->viewmat);
- Mat4One(t->viewinv);
- Mat4One(t->persmat);
- Mat4One(t->persinv);
+ unit_m4(t->viewmat);
+ unit_m4(t->viewinv);
+ unit_m4(t->persmat);
+ unit_m4(t->persinv);
t->persp = RV3D_ORTHO;
}
@@ -661,7 +661,7 @@ void transformEvent(TransInfo *t, wmEvent *event)
getmouseco_sc(mval);
BIF_selectOrientation();
calc_manipulator_stats(curarea);
- Mat3CpyMat4(t->spacemtx, G.vd->twmat);
+ copy_m3_m4(t->spacemtx, G.vd->twmat);
warp_pointer(mval[0], mval[1]);
#endif
}
@@ -1112,11 +1112,11 @@ void drawHelpline(const struct bContext *C, TransInfo *t)
VECCOPY(vecrot, t->center);
if(t->flag & T_EDIT) {
Object *ob= t->obedit;
- if(ob) Mat4MulVecfl(ob->obmat, vecrot);
+ if(ob) mul_m4_v3(ob->obmat, vecrot);
}
else if(t->flag & T_POSE) {
Object *ob=t->poseobj;
- if(ob) Mat4MulVecfl(ob->obmat, vecrot);
+ if(ob) mul_m4_v3(ob->obmat, vecrot);
}
projectFloatView(t, vecrot, cent); // no overflow in extreme cases
@@ -1368,12 +1368,12 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
}
else if(t->spacetype == SPACE_IMAGE) {
- Mat3One(t->spacemtx);
+ unit_m3(t->spacemtx);
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
}
else
- Mat3One(t->spacemtx);
+ unit_m3(t->spacemtx);
createTransData(C, t); // make TransData structs from selection
@@ -1652,8 +1652,8 @@ static void protectedAxisAngleBits(short protectflag, float axis[3], float *angl
/* axis-angle get limited with euler... */
float eul[3], oldeul[3];
- AxisAngleToEulO(axis, *angle, eul, EULER_ORDER_DEFAULT);
- AxisAngleToEulO(oldAxis, oldAngle, oldeul, EULER_ORDER_DEFAULT);
+ axis_angle_to_eulO( eul, EULER_ORDER_DEFAULT,axis, *angle);
+ axis_angle_to_eulO( oldeul, EULER_ORDER_DEFAULT,oldAxis, oldAngle);
if (protectflag & OB_LOCK_ROTX)
eul[0]= oldeul[0];
@@ -1662,7 +1662,7 @@ static void protectedAxisAngleBits(short protectflag, float axis[3], float *angl
if (protectflag & OB_LOCK_ROTZ)
eul[2]= oldeul[2];
- EulOToAxisAngle(eul, EULER_ORDER_DEFAULT, axis, angle);
+ eulO_to_axis_angle( axis, angle,eul, EULER_ORDER_DEFAULT);
/* when converting to axis-angle, we need a special exception for the case when there is no axis */
if (IS_EQ(axis[0], axis[1]) && IS_EQ(axis[1], axis[2])) {
@@ -1695,8 +1695,8 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu
float eul[3], oldeul[3], quat1[4];
QUATCOPY(quat1, quat);
- QuatToEul(quat, eul);
- QuatToEul(oldquat, oldeul);
+ quat_to_eul( eul,quat);
+ quat_to_eul( oldeul,oldquat);
if (protectflag & OB_LOCK_ROTX)
eul[0]= oldeul[0];
@@ -1705,11 +1705,11 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu
if (protectflag & OB_LOCK_ROTZ)
eul[2]= oldeul[2];
- EulToQuat(eul, quat);
+ eul_to_quat( quat,eul);
/* quaternions flip w sign to accumulate rotations correctly */
if ( (quat1[0]<0.0f && quat[0]>0.0f) || (quat1[0]>0.0f && quat[0]<0.0f) ) {
- QuatMulf(quat, -1.0f);
+ mul_qt_fl(quat, -1.0f);
}
}
}
@@ -1728,7 +1728,7 @@ static void constraintTransLim(TransInfo *t, TransData *td)
* - current space should be local
*/
memset(&cob, 0, sizeof(bConstraintOb));
- Mat4One(cob.matrix);
+ unit_m4(cob.matrix);
VECCOPY(cob.matrix[3], td->loc);
/* Evaluate valid constraints */
@@ -1749,8 +1749,8 @@ static void constraintTransLim(TransInfo *t, TransData *td)
/* do space conversions */
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
/* just multiply by td->mtx (this should be ok) */
- Mat4CpyMat4(tmat, cob.matrix);
- Mat4MulMat34(cob.matrix, td->mtx, tmat);
+ copy_m4_m4(tmat, cob.matrix);
+ mul_m4_m3m4(cob.matrix, td->mtx, tmat);
}
else if (con->ownspace != CONSTRAINT_SPACE_LOCAL) {
/* skip... incompatable spacetype */
@@ -1763,8 +1763,8 @@ static void constraintTransLim(TransInfo *t, TransData *td)
/* convert spaces again */
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
/* just multiply by td->mtx (this should be ok) */
- Mat4CpyMat4(tmat, cob.matrix);
- Mat4MulMat34(cob.matrix, td->smtx, tmat);
+ copy_m4_m4(tmat, cob.matrix);
+ mul_m4_m3m4(cob.matrix, td->smtx, tmat);
}
}
}
@@ -1789,21 +1789,21 @@ static void constraintRotLim(TransInfo *t, TransData *td)
if (td->rotOrder == ROT_MODE_QUAT) {
/* quats */
if (td->ext)
- QuatToMat4(td->ext->quat, cob.matrix);
+ quat_to_mat4( cob.matrix,td->ext->quat);
else
return;
}
else if (td->rotOrder == ROT_MODE_AXISANGLE) {
/* axis angle */
if (td->ext)
- AxisAngleToMat4(&td->ext->quat[1], td->ext->quat[0], cob.matrix);
+ axis_angle_to_mat4( cob.matrix,&td->ext->quat[1], td->ext->quat[0]);
else
return;
}
else {
/* eulers */
if (td->ext)
- EulOToMat4(td->ext->rot, td->rotOrder, cob.matrix);
+ eulO_to_mat4( cob.matrix,td->ext->rot, td->rotOrder);
else
return;
}
@@ -1826,8 +1826,8 @@ static void constraintRotLim(TransInfo *t, TransData *td)
/* do space conversions */
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
/* just multiply by td->mtx (this should be ok) */
- Mat4CpyMat4(tmat, cob.matrix);
- Mat4MulMat34(cob.matrix, td->mtx, tmat);
+ copy_m4_m4(tmat, cob.matrix);
+ mul_m4_m3m4(cob.matrix, td->mtx, tmat);
}
else if (con->ownspace != CONSTRAINT_SPACE_LOCAL) {
/* skip... incompatable spacetype */
@@ -1840,8 +1840,8 @@ static void constraintRotLim(TransInfo *t, TransData *td)
/* convert spaces again */
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
/* just multiply by td->mtx (this should be ok) */
- Mat4CpyMat4(tmat, cob.matrix);
- Mat4MulMat34(cob.matrix, td->smtx, tmat);
+ copy_m4_m4(tmat, cob.matrix);
+ mul_m4_m3m4(cob.matrix, td->smtx, tmat);
}
}
}
@@ -1849,15 +1849,15 @@ static void constraintRotLim(TransInfo *t, TransData *td)
/* copy results from cob->matrix */
if (td->rotOrder == ROT_MODE_QUAT) {
/* quats */
- Mat4ToQuat(cob.matrix, td->ext->quat);
+ mat4_to_quat( td->ext->quat,cob.matrix);
}
else if (td->rotOrder == ROT_MODE_AXISANGLE) {
/* axis angle */
- Mat4ToAxisAngle(cob.matrix, &td->ext->quat[1], &td->ext->quat[0]);
+ mat4_to_axis_angle( &td->ext->quat[1], &td->ext->quat[0],cob.matrix);
}
else {
/* eulers */
- Mat4ToEulO(cob.matrix, td->ext->rot, td->rotOrder);
+ mat4_to_eulO( td->ext->rot, td->rotOrder,cob.matrix);
}
}
}
@@ -1883,7 +1883,7 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
if (td->flag & TD_SINGLESIZE)
return;
- SizeToMat4(td->ext->size, cob.matrix);
+ size_to_mat4( cob.matrix,td->ext->size);
}
/* Evaluate valid constraints */
@@ -1904,8 +1904,8 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
/* do space conversions */
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
/* just multiply by td->mtx (this should be ok) */
- Mat4CpyMat4(tmat, cob.matrix);
- Mat4MulMat34(cob.matrix, td->mtx, tmat);
+ copy_m4_m4(tmat, cob.matrix);
+ mul_m4_m3m4(cob.matrix, td->mtx, tmat);
}
else if (con->ownspace != CONSTRAINT_SPACE_LOCAL) {
/* skip... incompatable spacetype */
@@ -1918,8 +1918,8 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
/* convert spaces again */
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
/* just multiply by td->mtx (this should be ok) */
- Mat4CpyMat4(tmat, cob.matrix);
- Mat4MulMat34(cob.matrix, td->smtx, tmat);
+ copy_m4_m4(tmat, cob.matrix);
+ mul_m4_m3m4(cob.matrix, td->smtx, tmat);
}
}
}
@@ -1934,7 +1934,7 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
if (td->flag & TD_SINGLESIZE)
return;
- Mat4ToSize(cob.matrix, td->ext->size);
+ mat4_to_size( td->ext->size,cob.matrix);
}
}
}
@@ -1964,11 +1964,11 @@ void initWarp(TransInfo *t)
for(i = 0; i < t->total; i++) {
float center[3];
VECCOPY(center, t->data[i].center);
- Mat3MulVecfl(t->data[i].mtx, center);
- Mat4MulVecfl(t->viewmat, center);
- VecSubf(center, center, t->viewmat[3]);
+ mul_m3_v3(t->data[i].mtx, center);
+ mul_m4_v3(t->viewmat, center);
+ sub_v3_v3v3(center, center, t->viewmat[3]);
if (i)
- MinMax3(min, max, center);
+ minmax_v3_v3v3(min, max, center);
else {
VECCOPY(max, center);
VECCOPY(min, center);
@@ -2022,12 +2022,12 @@ int Warp(TransInfo *t, short mval[2])
VECCOPY(cursor, curs);
VECCOPY(gcursor, cursor);
if (t->flag & T_EDIT) {
- VecSubf(cursor, cursor, t->obedit->obmat[3]);
- VecSubf(gcursor, gcursor, t->obedit->obmat[3]);
- Mat3MulVecfl(t->data->smtx, gcursor);
+ sub_v3_v3v3(cursor, cursor, t->obedit->obmat[3]);
+ sub_v3_v3v3(gcursor, gcursor, t->obedit->obmat[3]);
+ mul_m3_v3(t->data->smtx, gcursor);
}
- Mat4MulVecfl(t->viewmat, cursor);
- VecSubf(cursor, cursor, t->viewmat[3]);
+ mul_m4_v3(t->viewmat, cursor);
+ sub_v3_v3v3(cursor, cursor, t->viewmat[3]);
/* amount of degrees for warp */
circumfac = 360.0f * t->values[0];
@@ -2065,9 +2065,9 @@ int Warp(TransInfo *t, short mval[2])
/* translate point to center, rotate in such a way that outline==distance */
VECCOPY(vec, td->iloc);
- Mat3MulVecfl(td->mtx, vec);
- Mat4MulVecfl(t->viewmat, vec);
- VecSubf(vec, vec, t->viewmat[3]);
+ mul_m3_v3(td->mtx, vec);
+ mul_m4_v3(t->viewmat, vec);
+ sub_v3_v3v3(vec, vec, t->viewmat[3]);
dist= vec[0]-cursor[0];
@@ -2082,13 +2082,13 @@ int Warp(TransInfo *t, short mval[2])
loc[1]= co*vec[1]+cursor[1];
loc[2]= vec[2];
- Mat4MulVecfl(t->viewinv, loc);
- VecSubf(loc, loc, t->viewinv[3]);
- Mat3MulVecfl(td->smtx, loc);
+ mul_m4_v3(t->viewinv, loc);
+ sub_v3_v3v3(loc, loc, t->viewinv[3]);
+ mul_m3_v3(td->smtx, loc);
- VecSubf(loc, loc, td->iloc);
- VecMulf(loc, td->factor);
- VecAddf(td->loc, td->iloc, loc);
+ sub_v3_v3v3(loc, loc, td->iloc);
+ mul_v3_fl(loc, td->factor);
+ add_v3_v3v3(td->loc, td->iloc, loc);
}
recalcData(t);
@@ -2151,8 +2151,8 @@ int Shear(TransInfo *t, short mval[2])
int i;
char str[50];
- Mat3CpyMat4(persmat, t->viewmat);
- Mat3Inv(persinv, persmat);
+ copy_m3_m4(persmat, t->viewmat);
+ invert_m3_m3(persinv, persmat);
value = 0.05f * t->values[0];
@@ -2173,7 +2173,7 @@ int Shear(TransInfo *t, short mval[2])
sprintf(str, "Shear: %.3f %s", value, t->proptext);
}
- Mat3One(smat);
+ unit_m3(smat);
// Custom data signals shear direction
if (t->customData == 0)
@@ -2181,8 +2181,8 @@ int Shear(TransInfo *t, short mval[2])
else
smat[0][1] = value;
- Mat3MulMat3(tmat, smat, persmat);
- Mat3MulMat3(totmat, persinv, tmat);
+ mul_m3_m3m3(tmat, smat, persmat);
+ mul_m3_m3m3(totmat, persinv, tmat);
for(i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
@@ -2193,22 +2193,22 @@ int Shear(TransInfo *t, short mval[2])
if (t->obedit) {
float mat3[3][3];
- Mat3MulMat3(mat3, totmat, td->mtx);
- Mat3MulMat3(tmat, td->smtx, mat3);
+ mul_m3_m3m3(mat3, totmat, td->mtx);
+ mul_m3_m3m3(tmat, td->smtx, mat3);
}
else {
- Mat3CpyMat3(tmat, totmat);
+ copy_m3_m3(tmat, totmat);
}
- VecSubf(vec, td->center, t->center);
+ sub_v3_v3v3(vec, td->center, t->center);
- Mat3MulVecfl(tmat, vec);
+ mul_m3_v3(tmat, vec);
- VecAddf(vec, vec, t->center);
- VecSubf(vec, vec, td->center);
+ add_v3_v3v3(vec, vec, t->center);
+ sub_v3_v3v3(vec, vec, td->center);
- VecMulf(vec, td->factor);
+ mul_v3_fl(vec, td->factor);
- VecAddf(td->loc, td->iloc, vec);
+ add_v3_v3v3(td->loc, td->iloc, vec);
}
recalcData(t);
@@ -2281,12 +2281,12 @@ static void TransMat3ToSize( float mat[][3], float smat[][3], float *size)
{
float vec[3];
- VecCopyf(vec, mat[0]);
- size[0]= Normalize(vec);
- VecCopyf(vec, mat[1]);
- size[1]= Normalize(vec);
- VecCopyf(vec, mat[2]);
- size[2]= Normalize(vec);
+ copy_v3_v3(vec, mat[0]);
+ size[0]= normalize_v3(vec);
+ copy_v3_v3(vec, mat[1]);
+ size[1]= normalize_v3(vec);
+ copy_v3_v3(vec, mat[2]);
+ size[2]= normalize_v3(vec);
/* first tried with dotproduct... but the sign flip is crucial */
if( VECSIGNFLIP(mat[0], smat[0]) ) size[0]= -size[0];
@@ -2300,11 +2300,11 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) {
float vec[3];
if (t->flag & T_EDIT) {
- Mat3MulMat3(smat, mat, td->mtx);
- Mat3MulMat3(tmat, td->smtx, smat);
+ mul_m3_m3m3(smat, mat, td->mtx);
+ mul_m3_m3m3(tmat, td->smtx, smat);
}
else {
- Mat3CpyMat3(tmat, mat);
+ copy_m3_m3(tmat, mat);
}
if (t->con.applySize) {
@@ -2339,13 +2339,13 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) {
if (t->flag & (T_OBJECT|T_TEXTURE|T_POSE)) {
float obsizemat[3][3];
// Reorient the size mat to fit the oriented object.
- Mat3MulMat3(obsizemat, tmat, td->axismtx);
- //printmatrix3("obsizemat", obsizemat);
+ mul_m3_m3m3(obsizemat, tmat, td->axismtx);
+ //print_m3("obsizemat", obsizemat);
TransMat3ToSize(obsizemat, td->axismtx, fsize);
- //printvecf("fsize", fsize);
+ //print_v3("fsize", fsize);
}
else {
- Mat3ToSize(tmat, fsize);
+ mat3_to_size( fsize,tmat);
}
protectedSizeBits(td->protectflag, fsize);
@@ -2375,26 +2375,26 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) {
/* For individual element center, Editmode need to use iloc */
if (t->flag & T_POINTS)
- VecSubf(vec, td->iloc, center);
+ sub_v3_v3v3(vec, td->iloc, center);
else
- VecSubf(vec, td->center, center);
+ sub_v3_v3v3(vec, td->center, center);
- Mat3MulVecfl(tmat, vec);
+ mul_m3_v3(tmat, vec);
- VecAddf(vec, vec, center);
+ add_v3_v3v3(vec, vec, center);
if (t->flag & T_POINTS)
- VecSubf(vec, vec, td->iloc);
+ sub_v3_v3v3(vec, vec, td->iloc);
else
- VecSubf(vec, vec, td->center);
+ sub_v3_v3v3(vec, vec, td->center);
- VecMulf(vec, td->factor);
+ mul_v3_fl(vec, td->factor);
if (t->flag & (T_OBJECT|T_POSE)) {
- Mat3MulVecfl(td->smtx, vec);
+ mul_m3_v3(td->smtx, vec);
}
protectedTransBits(td->protectflag, vec);
- VecAddf(td->loc, td->iloc, vec);
+ add_v3_v3v3(td->loc, td->iloc, vec);
constraintTransLim(t, td);
}
@@ -2435,13 +2435,13 @@ int Resize(TransInfo *t, short mval[2])
VECCOPY(t->values, size);
- SizeToMat3(size, mat);
+ size_to_mat3( mat,size);
if (t->con.applySize) {
t->con.applySize(t, NULL, mat);
}
- Mat3CpyMat3(t->mat, mat); // used in manipulator
+ copy_m3_m3(t->mat, mat); // used in manipulator
headerResize(t, size, str);
@@ -2457,7 +2457,7 @@ int Resize(TransInfo *t, short mval[2])
/* evil hack - redo resize if cliping needed */
if (t->flag & T_CLIP_UV && clipUVTransform(t, size, 1)) {
- SizeToMat3(size, mat);
+ size_to_mat3( mat,size);
if (t->con.applySize)
t->con.applySize(t, NULL, mat);
@@ -2496,7 +2496,7 @@ void initToSphere(TransInfo *t)
// Calculate average radius
for(i = 0 ; i < t->total; i++, td++) {
- t->val += VecLenf(t->center, td->iloc);
+ t->val += len_v3v3(t->center, td->iloc);
}
t->val /= (float)t->total;
@@ -2543,15 +2543,15 @@ int ToSphere(TransInfo *t, short mval[2])
if (td->flag & TD_SKIP)
continue;
- VecSubf(vec, td->iloc, t->center);
+ sub_v3_v3v3(vec, td->iloc, t->center);
- radius = Normalize(vec);
+ radius = normalize_v3(vec);
tratio = ratio * td->factor;
- VecMulf(vec, radius * (1.0f - tratio) + t->val * tratio);
+ mul_v3_fl(vec, radius * (1.0f - tratio) + t->val * tratio);
- VecAddf(td->loc, t->center, vec);
+ add_v3_v3v3(td->loc, t->center, vec);
}
@@ -2604,25 +2604,25 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
}
if (t->flag & T_POINTS) {
- Mat3MulMat3(totmat, mat, td->mtx);
- Mat3MulMat3(smat, td->smtx, totmat);
+ mul_m3_m3m3(totmat, mat, td->mtx);
+ mul_m3_m3m3(smat, td->smtx, totmat);
- VecSubf(vec, td->iloc, center);
- Mat3MulVecfl(smat, vec);
+ sub_v3_v3v3(vec, td->iloc, center);
+ mul_m3_v3(smat, vec);
- VecAddf(td->loc, vec, center);
+ add_v3_v3v3(td->loc, vec, center);
- VecSubf(vec,td->loc,td->iloc);
+ sub_v3_v3v3(vec,td->loc,td->iloc);
protectedTransBits(td->protectflag, vec);
- VecAddf(td->loc, td->iloc, vec);
+ add_v3_v3v3(td->loc, td->iloc, vec);
if(td->flag & TD_USEQUAT) {
- Mat3MulSerie(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
- Mat3ToQuat(fmat, quat); // Actual transform
+ mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
+ mat3_to_quat( quat,fmat); // Actual transform
if(td->ext->quat){
- QuatMul(td->ext->quat, quat, td->ext->iquat);
+ mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
/* is there a reason not to have this here? -jahka */
protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
@@ -2645,28 +2645,28 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
float pmtx[3][3], imtx[3][3];
// Extract and invert armature object matrix
- Mat3CpyMat4(pmtx, t->poseobj->obmat);
- Mat3Inv(imtx, pmtx);
+ copy_m3_m4(pmtx, t->poseobj->obmat);
+ invert_m3_m3(imtx, pmtx);
if ((td->flag & TD_NO_LOC) == 0)
{
- VecSubf(vec, td->center, center);
+ sub_v3_v3v3(vec, td->center, center);
- Mat3MulVecfl(pmtx, vec); // To Global space
- Mat3MulVecfl(mat, vec); // Applying rotation
- Mat3MulVecfl(imtx, vec); // To Local space
+ mul_m3_v3(pmtx, vec); // To Global space
+ mul_m3_v3(mat, vec); // Applying rotation
+ mul_m3_v3(imtx, vec); // To Local space
- VecAddf(vec, vec, center);
+ add_v3_v3v3(vec, vec, center);
/* vec now is the location where the object has to be */
- VecSubf(vec, vec, td->center); // Translation needed from the initial location
+ sub_v3_v3v3(vec, vec, td->center); // Translation needed from the initial location
- Mat3MulVecfl(pmtx, vec); // To Global space
- Mat3MulVecfl(td->smtx, vec);// To Pose space
+ mul_m3_v3(pmtx, vec); // To Global space
+ mul_m3_v3(td->smtx, vec);// To Pose space
protectedTransBits(td->protectflag, vec);
- VecAddf(td->loc, td->iloc, vec);
+ add_v3_v3v3(td->loc, td->iloc, vec);
constraintTransLim(t, td);
}
@@ -2675,11 +2675,11 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself
/* euler or quaternion/axis-angle? */
if (td->rotOrder == ROT_MODE_QUAT) {
- Mat3MulSerie(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
+ mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
- Mat3ToQuat(fmat, quat); // Actual transform
+ mat3_to_quat( quat,fmat); // Actual transform
- QuatMul(td->ext->quat, quat, td->ext->iquat);
+ mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
/* this function works on end result */
protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
@@ -2688,13 +2688,13 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* calculate effect based on quats */
float iquat[4], tquat[4];
- AxisAngleToQuat(iquat, td->ext->irotAxis, td->ext->irotAngle);
+ axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
- Mat3MulSerie(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
- Mat3ToQuat(fmat, quat); // Actual transform
- QuatMul(tquat, quat, iquat);
+ mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
+ mat3_to_quat( quat,fmat); // Actual transform
+ mul_qt_qtqt(tquat, quat, iquat);
- QuatToAxisAngle(tquat, td->ext->rotAxis, td->ext->rotAngle);
+ quat_to_axis_angle( td->ext->rotAxis, td->ext->rotAngle,tquat);
/* this function works on end result */
protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle);
@@ -2702,17 +2702,17 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
else {
float eulmat[3][3];
- Mat3MulMat3(totmat, mat, td->mtx);
- Mat3MulMat3(smat, td->smtx, totmat);
+ mul_m3_m3m3(totmat, mat, td->mtx);
+ mul_m3_m3m3(smat, td->smtx, totmat);
/* calculate the total rotatation in eulers */
VECCOPY(eul, td->ext->irot);
- EulOToMat3(eul, td->rotOrder, eulmat);
+ eulO_to_mat3( eulmat,eul, td->rotOrder);
/* mat = transform, obmat = bone rotation */
- Mat3MulMat3(fmat, smat, eulmat);
+ mul_m3_m3m3(fmat, smat, eulmat);
- Mat3ToCompatibleEulO(fmat, eul, td->ext->rot, td->rotOrder);
+ mat3_to_compatible_eulO( eul, td->ext->rot, td->rotOrder,fmat);
/* and apply (to end result only) */
protectedRotateBits(td->protectflag, eul, td->ext->irot);
@@ -2726,16 +2726,16 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
if ((td->flag & TD_NO_LOC) == 0)
{
/* translation */
- VecSubf(vec, td->center, center);
- Mat3MulVecfl(mat, vec);
- VecAddf(vec, vec, center);
+ sub_v3_v3v3(vec, td->center, center);
+ mul_m3_v3(mat, vec);
+ add_v3_v3v3(vec, vec, center);
/* vec now is the location where the object has to be */
- VecSubf(vec, vec, td->center);
- Mat3MulVecfl(td->smtx, vec);
+ sub_v3_v3v3(vec, vec, td->center);
+ mul_m3_v3(td->smtx, vec);
protectedTransBits(td->protectflag, vec);
- VecAddf(td->loc, td->iloc, vec);
+ add_v3_v3v3(td->loc, td->iloc, vec);
}
@@ -2745,10 +2745,10 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself
/* euler or quaternion? */
if ((td->rotOrder == ROT_MODE_QUAT) || (td->flag & TD_USEQUAT)) {
- Mat3MulSerie(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
- Mat3ToQuat(fmat, quat); // Actual transform
+ mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
+ mat3_to_quat( quat,fmat); // Actual transform
- QuatMul(td->ext->quat, quat, td->ext->iquat);
+ mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
/* this function works on end result */
protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
}
@@ -2756,13 +2756,13 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* calculate effect based on quats */
float iquat[4], tquat[4];
- AxisAngleToQuat(iquat, td->ext->irotAxis, td->ext->irotAngle);
+ axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
- Mat3MulSerie(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
- Mat3ToQuat(fmat, quat); // Actual transform
- QuatMul(tquat, quat, iquat);
+ mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
+ mat3_to_quat( quat,fmat); // Actual transform
+ mul_qt_qtqt(tquat, quat, iquat);
- QuatToAxisAngle(quat, td->ext->rotAxis, td->ext->rotAngle);
+ quat_to_axis_angle( td->ext->rotAxis, td->ext->rotAngle,quat);
/* this function works on end result */
protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle);
@@ -2770,19 +2770,19 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
else {
float obmat[3][3];
- Mat3MulMat3(totmat, mat, td->mtx);
- Mat3MulMat3(smat, td->smtx, totmat);
+ mul_m3_m3m3(totmat, mat, td->mtx);
+ mul_m3_m3m3(smat, td->smtx, totmat);
/* calculate the total rotatation in eulers */
- VecAddf(eul, td->ext->irot, td->ext->drot); /* we have to correct for delta rot */
- EulOToMat3(eul, td->rotOrder, obmat);
+ add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* we have to correct for delta rot */
+ eulO_to_mat3( obmat,eul, td->rotOrder);
/* mat = transform, obmat = object rotation */
- Mat3MulMat3(fmat, smat, obmat);
+ mul_m3_m3m3(fmat, smat, obmat);
- Mat3ToCompatibleEulO(fmat, eul, td->ext->rot, td->rotOrder);
+ mat3_to_compatible_eulO( eul, td->ext->rot, td->rotOrder,fmat);
/* correct back for delta rot */
- VecSubf(eul, eul, td->ext->drot);
+ sub_v3_v3v3(eul, eul, td->ext->drot);
/* and apply */
protectedRotateBits(td->protectflag, eul, td->ext->irot);
@@ -2800,7 +2800,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3])
float mat[3][3];
int i;
- VecRotToMat3(axis, angle, mat);
+ vec_rot_to_mat3( mat,axis, angle);
for(i = 0 ; i < t->total; i++, td++) {
@@ -2812,10 +2812,10 @@ static void applyRotation(TransInfo *t, float angle, float axis[3])
if (t->con.applyRot) {
t->con.applyRot(t, td, axis, NULL);
- VecRotToMat3(axis, angle * td->factor, mat);
+ vec_rot_to_mat3( mat,axis, angle * td->factor);
}
else if (t->flag & T_PROP_EDIT) {
- VecRotToMat3(axis, angle * td->factor, mat);
+ vec_rot_to_mat3( mat,axis, angle * td->factor);
}
ElementRotation(t, td, mat, t->around);
@@ -2832,8 +2832,8 @@ int Rotation(TransInfo *t, short mval[2])
float mat[3][3];
VECCOPY(axis, t->viewinv[2]);
- VecMulf(axis, -1.0f);
- Normalize(axis);
+ mul_v3_fl(axis, -1.0f);
+ normalize_v3(axis);
final = t->values[0];
@@ -2869,11 +2869,11 @@ int Rotation(TransInfo *t, short mval[2])
sprintf(str, "Rot: %.2f%s %s", 180.0*final/M_PI, t->con.text, t->proptext);
}
- VecRotToMat3(axis, final, mat);
+ vec_rot_to_mat3( mat,axis, final);
// TRANSFORM_FIX_ME
// t->values[0] = final; // used in manipulator
-// Mat3CpyMat3(t->mat, mat); // used in manipulator
+// copy_m3_m3(t->mat, mat); // used in manipulator
applyRotation(t, final, axis);
@@ -2914,10 +2914,10 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a
float mat[3][3], smat[3][3], totmat[3][3];
int i;
- VecRotToMat3(axis1, angles[0], smat);
- VecRotToMat3(axis2, angles[1], totmat);
+ vec_rot_to_mat3( smat,axis1, angles[0]);
+ vec_rot_to_mat3( totmat,axis2, angles[1]);
- Mat3MulMat3(mat, smat, totmat);
+ mul_m3_m3m3(mat, smat, totmat);
for(i = 0 ; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
@@ -2927,10 +2927,10 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a
continue;
if (t->flag & T_PROP_EDIT) {
- VecRotToMat3(axis1, td->factor * angles[0], smat);
- VecRotToMat3(axis2, td->factor * angles[1], totmat);
+ vec_rot_to_mat3( smat,axis1, td->factor * angles[0]);
+ vec_rot_to_mat3( totmat,axis2, td->factor * angles[1]);
- Mat3MulMat3(mat, smat, totmat);
+ mul_m3_m3m3(mat, smat, totmat);
}
ElementRotation(t, td, mat, t->around);
@@ -2946,8 +2946,8 @@ int Trackball(TransInfo *t, short mval[2])
VECCOPY(axis1, t->persinv[0]);
VECCOPY(axis2, t->persinv[1]);
- Normalize(axis1);
- Normalize(axis2);
+ normalize_v3(axis1);
+ normalize_v3(axis2);
phi[0] = t->values[0];
phi[1] = t->values[1];
@@ -2972,13 +2972,13 @@ int Trackball(TransInfo *t, short mval[2])
sprintf(str, "Trackball: %.2f %.2f %s", 180.0*phi[0]/M_PI, 180.0*phi[1]/M_PI, t->proptext);
}
- VecRotToMat3(axis1, phi[0], smat);
- VecRotToMat3(axis2, phi[1], totmat);
+ vec_rot_to_mat3( smat,axis1, phi[0]);
+ vec_rot_to_mat3( totmat,axis2, phi[1]);
- Mat3MulMat3(mat, smat, totmat);
+ mul_m3_m3m3(mat, smat, totmat);
// TRANSFORM_FIX_ME
- //Mat3CpyMat3(t->mat, mat); // used in manipulator
+ //copy_m3_m3(t->mat, mat); // used in manipulator
applyTrackball(t, axis1, axis2, phi);
@@ -3030,7 +3030,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
if (hasNumInput(&t->num)) {
outputNumInput(&(t->num), tvec);
- dist = VecLength(t->num.val);
+ dist = len_v3(t->num.val);
}
else {
float dvec[3];
@@ -3038,7 +3038,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
VECCOPY(dvec, vec);
applyAspectRatio(t, dvec);
- dist = VecLength(vec);
+ dist = len_v3(vec);
if(t->scene->unit.system) {
int i, do_split= t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1:0;
@@ -3113,12 +3113,12 @@ static void applyTranslation(TransInfo *t, float vec[3]) {
float mat[3][3];
float angle;
- Crossf(axis, original_normal, t->tsnap.snapNormal);
- angle = saacos(Inpf(original_normal, t->tsnap.snapNormal));
+ cross_v3_v3v3(axis, original_normal, t->tsnap.snapNormal);
+ angle = saacos(dot_v3v3(original_normal, t->tsnap.snapNormal));
- AxisAngleToQuat(quat, axis, angle);
+ axis_angle_to_quat(quat, axis, angle);
- QuatToMat3(quat, mat);
+ quat_to_mat3( mat,quat);
ElementRotation(t, td, mat, V3D_LOCAL);
}
@@ -3126,7 +3126,7 @@ static void applyTranslation(TransInfo *t, float vec[3]) {
{
float mat[3][3];
- Mat3One(mat);
+ unit_m3(mat);
ElementRotation(t, td, mat, V3D_LOCAL);
}
@@ -3140,12 +3140,12 @@ static void applyTranslation(TransInfo *t, float vec[3]) {
VECCOPY(tvec, vec);
}
- Mat3MulVecfl(td->smtx, tvec);
- VecMulf(tvec, td->factor);
+ mul_m3_v3(td->smtx, tvec);
+ mul_v3_fl(tvec, td->factor);
protectedTransBits(td->protectflag, tvec);
- VecAddf(td->loc, td->iloc, tvec);
+ add_v3_v3v3(td->loc, td->iloc, tvec);
constraintTransLim(t, td);
}
@@ -3252,10 +3252,10 @@ int ShrinkFatten(TransInfo *t, short mval[2])
continue;
VECCOPY(vec, td->axismtx[2]);
- VecMulf(vec, distance);
- VecMulf(vec, td->factor);
+ mul_v3_fl(vec, distance);
+ mul_v3_fl(vec, td->factor);
- VecAddf(td->loc, td->iloc, vec);
+ add_v3_v3v3(td->loc, td->iloc, vec);
}
recalcData(t);
@@ -3462,23 +3462,23 @@ int PushPull(TransInfo *t, short mval[2])
if (td->flag & TD_SKIP)
continue;
- VecSubf(vec, t->center, td->center);
+ sub_v3_v3v3(vec, t->center, td->center);
if (t->con.applyRot && t->con.mode & CON_APPLY) {
t->con.applyRot(t, td, axis, NULL);
if (isLockConstraint(t)) {
float dvec[3];
- Projf(dvec, vec, axis);
- VecSubf(vec, vec, dvec);
+ project_v3_v3v3(dvec, vec, axis);
+ sub_v3_v3v3(vec, vec, dvec);
}
else {
- Projf(vec, vec, axis);
+ project_v3_v3v3(vec, vec, axis);
}
}
- Normalize(vec);
- VecMulf(vec, distance);
- VecMulf(vec, td->factor);
+ normalize_v3(vec);
+ mul_v3_fl(vec, distance);
+ mul_v3_fl(vec, td->factor);
- VecAddf(td->loc, td->iloc, vec);
+ add_v3_v3v3(td->loc, td->iloc, vec);
}
recalcData(t);
@@ -3791,8 +3791,8 @@ static void ElementBoneSize(TransInfo *t, TransData *td, float mat[3][3])
float tmat[3][3], smat[3][3], oldy;
float sizemat[3][3];
- Mat3MulMat3(smat, mat, td->mtx);
- Mat3MulMat3(tmat, td->smtx, smat);
+ mul_m3_m3m3(smat, mat, td->mtx);
+ mul_m3_m3m3(tmat, td->smtx, smat);
if (t->con.applySize) {
t->con.applySize(t, td, tmat);
@@ -3800,9 +3800,9 @@ static void ElementBoneSize(TransInfo *t, TransData *td, float mat[3][3])
/* we've tucked the scale in loc */
oldy= td->iloc[1];
- SizeToMat3(td->iloc, sizemat);
- Mat3MulMat3(tmat, tmat, sizemat);
- Mat3ToSize(tmat, td->loc);
+ size_to_mat3( sizemat,td->iloc);
+ mul_m3_m3m3(tmat, tmat, sizemat);
+ mat3_to_size( td->loc,tmat);
td->loc[1]= oldy;
}
@@ -3834,13 +3834,13 @@ int BoneSize(TransInfo *t, short mval[2])
constraintNumInput(t, size);
}
- SizeToMat3(size, mat);
+ size_to_mat3( mat,size);
if (t->con.applySize) {
t->con.applySize(t, NULL, mat);
}
- Mat3CpyMat3(t->mat, mat); // used in manipulator
+ copy_m3_m3(t->mat, mat); // used in manipulator
headerBoneSize(t, size, str);
@@ -3955,7 +3955,7 @@ static int createSlideVerts(TransInfo *t)
if (!v3d) {
/*ok, let's try to survive this*/
- Mat4One(projectMat);
+ unit_m4(projectMat);
} else {
view3d_get_object_project_mat(v3d, t->obedit, projectMat);
}
@@ -4248,12 +4248,12 @@ static int createSlideVerts(TransInfo *t)
}
if (ev == tempsv->up->v1) {
- VecSubf(vec, co, co2);
+ sub_v3_v3v3(vec, co, co2);
} else {
- VecSubf(vec, co2, co);
+ sub_v3_v3v3(vec, co2, co);
}
- VecAddf(start, start, vec);
+ add_v3_v3v3(start, start, vec);
if (v3d) {
view3d_project_float(t->ar, tempsv->down->v1->co, co, projectMat);
@@ -4261,12 +4261,12 @@ static int createSlideVerts(TransInfo *t)
}
if (ev == tempsv->down->v1) {
- VecSubf(vec, co2, co);
+ sub_v3_v3v3(vec, co2, co);
} else {
- VecSubf(vec, co, co2);
+ sub_v3_v3v3(vec, co, co2);
}
- VecAddf(end, end, vec);
+ add_v3_v3v3(end, end, vec);
totvec += 1.0f;
nearest = (EditVert*)look->link;
@@ -4278,12 +4278,12 @@ static int createSlideVerts(TransInfo *t)
look = look->next;
}
- VecAddf(start, start, end);
- VecMulf(start, 0.5*(1.0/totvec));
+ add_v3_v3v3(start, start, end);
+ mul_v3_fl(start, 0.5*(1.0/totvec));
VECCOPY(vec, start);
start[0] = t->mval[0];
start[1] = t->mval[1];
- VecAddf(end, start, vec);
+ add_v3_v3v3(end, start, vec);
sld->start[0] = (short) start[0];
sld->start[1] = (short) start[1];
@@ -4484,7 +4484,7 @@ int doEdgeSlide(TransInfo *t, float perc)
upVert = editedge_getOtherVert(tempsv->up, centerVert);
downVert = editedge_getOtherVert(tempsv->down, centerVert);
- len = MIN2(perc, VecLenf(upVert->co,downVert->co));
+ len = MIN2(perc, len_v3v3(upVert->co,downVert->co));
len = MAX2(len, 0);
//Adjust Edgeloop
@@ -4496,13 +4496,13 @@ int doEdgeSlide(TransInfo *t, float perc)
tempsv = BLI_ghash_lookup(vertgh,ev);
tempev = editedge_getOtherVert((perc>=0)?tempsv->up:tempsv->down, ev);
- VecLerpf(ev->co, tempsv->origvert.co, tempev->co, fabs(perc));
+ interp_v3_v3v3(ev->co, tempsv->origvert.co, tempev->co, fabs(perc));
if (uvlay_tot) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
- Vec2Lerpf(uv_tmp, suv->origuv, (perc>=0)?suv->uv_up:suv->uv_down, fabs(perc));
+ interp_v2_v2v2(uv_tmp, suv->origuv, (perc>=0)?suv->uv_up:suv->uv_down, fabs(perc));
fuv_link = suv->fuv_list;
while (fuv_link) {
VECCOPY2D(((float *)fuv_link->link), uv_tmp);
@@ -4522,17 +4522,17 @@ int doEdgeSlide(TransInfo *t, float perc)
float newlen;
ev = look->link;
tempsv = BLI_ghash_lookup(vertgh,ev);
- newlen = (len / VecLenf(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co));
+ newlen = (len / len_v3v3(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co));
if(newlen > 1.0) {newlen = 1.0;}
if(newlen < 0.0) {newlen = 0.0;}
if(flip == 0) {
- VecLerpf(ev->co, editedge_getOtherVert(tempsv->down,ev)->co, editedge_getOtherVert(tempsv->up,ev)->co, fabs(newlen));
+ interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->down,ev)->co, editedge_getOtherVert(tempsv->up,ev)->co, fabs(newlen));
if (uvlay_tot) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
/* dont do anything if no UVs */
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
- Vec2Lerpf(uv_tmp, suv->uv_down, suv->uv_up, fabs(newlen));
+ interp_v2_v2v2(uv_tmp, suv->uv_down, suv->uv_up, fabs(newlen));
fuv_link = suv->fuv_list;
while (fuv_link) {
VECCOPY2D(((float *)fuv_link->link), uv_tmp);
@@ -4542,14 +4542,14 @@ int doEdgeSlide(TransInfo *t, float perc)
}
}
} else{
- VecLerpf(ev->co, editedge_getOtherVert(tempsv->up,ev)->co, editedge_getOtherVert(tempsv->down,ev)->co, fabs(newlen));
+ interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->up,ev)->co, editedge_getOtherVert(tempsv->down,ev)->co, fabs(newlen));
if (uvlay_tot) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
/* dont do anything if no UVs */
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
- Vec2Lerpf(uv_tmp, suv->uv_up, suv->uv_down, fabs(newlen));
+ interp_v2_v2v2(uv_tmp, suv->uv_up, suv->uv_down, fabs(newlen));
fuv_link = suv->fuv_list;
while (fuv_link) {
VECCOPY2D(((float *)fuv_link->link), uv_tmp);
@@ -4775,7 +4775,7 @@ int Mirror(TransInfo *t, short mval[2])
if (t->con.mode & CON_APPLY) {
size[0] = size[1] = size[2] = -1;
- SizeToMat3(size, mat);
+ size_to_mat3( mat,size);
if (t->con.applySize) {
t->con.applySize(t, NULL, mat);
@@ -4801,7 +4801,7 @@ int Mirror(TransInfo *t, short mval[2])
{
size[0] = size[1] = size[2] = 1;
- SizeToMat3(size, mat);
+ size_to_mat3( mat,size);
for(i = 0, td=t->data; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
@@ -4864,9 +4864,9 @@ int Align(TransInfo *t, short mval[2])
}
}
- Mat3Inv(invmat, td->axismtx);
+ invert_m3_m3(invmat, td->axismtx);
- Mat3MulMat3(mat, t->spacemtx, invmat);
+ mul_m3_m3m3(mat, t->spacemtx, invmat);
ElementRotation(t, td, mat, t->around);
}
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 7a6244b72b8..da8f0c4d0e9 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -73,7 +73,7 @@
#include "ED_image.h"
#include "ED_view3d.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
//#include "blendef.h"
//
@@ -157,7 +157,7 @@ void constraintNumInput(TransInfo *t, float vec[3])
static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) {
int i = 0;
- Mat3MulVecfl(t->con.imtx, vec);
+ mul_m3_v3(t->con.imtx, vec);
snapGrid(t, vec);
@@ -194,7 +194,7 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) {
pvec[i++] = vec[2];
}
- Mat3MulVecfl(t->con.mtx, vec);
+ mul_m3_v3(t->con.mtx, vec);
}
static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3]) {
@@ -206,16 +206,16 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
/* For when view is parallel to constraint... will cause NaNs otherwise
So we take vertical motion in 3D space and apply it to the
constraint axis. Nice for camera grab + MMB */
- if(1.0f - fabs(Inpf(axis, t->viewinv[2])) < 0.000001f) {
- Projf(vec, in, t->viewinv[1]);
- factor = Inpf(t->viewinv[1], vec) * 2.0f;
+ if(1.0f - fabs(dot_v3v3(axis, t->viewinv[2])) < 0.000001f) {
+ project_v3_v3v3(vec, in, t->viewinv[1]);
+ factor = dot_v3v3(t->viewinv[1], vec) * 2.0f;
/* since camera distance is quite relative, use quadratic relationship. holding shift can compensate */
if(factor<0.0f) factor*= -factor;
else factor*= factor;
VECCOPY(out, axis);
- Normalize(out);
- VecMulf(out, -factor); /* -factor makes move down going backwards */
+ normalize_v3(out);
+ mul_v3_fl(out, -factor); /* -factor makes move down going backwards */
}
else {
float v[3], i1[3], i2[3];
@@ -224,32 +224,32 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
float plane[3];
getViewVector(t, t->con.center, norm_center);
- Crossf(plane, norm_center, axis);
+ cross_v3_v3v3(plane, norm_center, axis);
- Projf(vec, in, plane);
- VecSubf(vec, in, vec);
+ project_v3_v3v3(vec, in, plane);
+ sub_v3_v3v3(vec, in, vec);
- VecAddf(v, vec, t->con.center);
+ add_v3_v3v3(v, vec, t->con.center);
getViewVector(t, v, norm);
/* give arbitrary large value if projection is impossible */
- factor = Inpf(axis, norm);
+ factor = dot_v3v3(axis, norm);
if (1 - fabs(factor) < 0.0002f) {
VECCOPY(out, axis);
if (factor > 0) {
- VecMulf(out, 1000000000);
+ mul_v3_fl(out, 1000000000);
} else {
- VecMulf(out, -1000000000);
+ mul_v3_fl(out, -1000000000);
}
} else {
- VecAddf(v2, t->con.center, axis);
- VecAddf(v4, v, norm);
+ add_v3_v3v3(v2, t->con.center, axis);
+ add_v3_v3v3(v4, v, norm);
- LineIntersectLine(t->con.center, v2, v, v4, i1, i2);
+ isect_line_line_v3(t->con.center, v2, v, v4, i1, i2);
- VecSubf(v, i2, v);
+ sub_v3_v3v3(v, i2, v);
- VecSubf(out, i1, t->con.center);
+ sub_v3_v3v3(out, i1, t->con.center);
}
}
}
@@ -257,21 +257,21 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
static void planeProjection(TransInfo *t, float in[3], float out[3]) {
float vec[3], factor, norm[3];
- VecAddf(vec, in, t->con.center);
+ add_v3_v3v3(vec, in, t->con.center);
getViewVector(t, vec, norm);
- VecSubf(vec, out, in);
+ sub_v3_v3v3(vec, out, in);
- factor = Inpf(vec, norm);
+ factor = dot_v3v3(vec, norm);
if (fabs(factor) <= 0.001) {
return; /* prevent divide by zero */
}
- factor = Inpf(vec, vec) / factor;
+ factor = dot_v3v3(vec, vec) / factor;
VECCOPY(vec, norm);
- VecMulf(vec, factor);
+ mul_v3_fl(vec, factor);
- VecAddf(out, in, vec);
+ add_v3_v3v3(out, in, vec);
}
/*
@@ -287,7 +287,7 @@ static void applyAxisConstraintVec(TransInfo *t, TransData *td, float in[3], flo
{
VECCOPY(out, in);
if (!td && t->con.mode & CON_APPLY) {
- Mat3MulVecfl(t->con.pmtx, out);
+ mul_m3_v3(t->con.pmtx, out);
// With snap, a projection is alright, no need to correct for view alignment
if ((t->tsnap.status & SNAP_ON) == 0) {
@@ -331,7 +331,7 @@ static void applyObjectConstraintVec(TransInfo *t, TransData *td, float in[3], f
VECCOPY(out, in);
if (t->con.mode & CON_APPLY) {
if (!td) {
- Mat3MulVecfl(t->con.pmtx, out);
+ mul_m3_v3(t->con.pmtx, out);
if (getConstraintSpaceDimension(t) == 2) {
if (out[0] != 0.0f || out[1] != 0.0f || out[2] != 0.0f) {
planeProjection(t, in, out);
@@ -367,7 +367,7 @@ static void applyObjectConstraintVec(TransInfo *t, TransData *td, float in[3], f
if (t->con.mode & CON_AXIS2) {
out[2] = in[i++];
}
- Mat3MulVecfl(td->axismtx, out);
+ mul_m3_v3(td->axismtx, out);
}
}
}
@@ -393,8 +393,8 @@ static void applyAxisConstraintSize(TransInfo *t, TransData *td, float smat[3][3
smat[2][2] = 1.0f;
}
- Mat3MulMat3(tmat, smat, t->con.imtx);
- Mat3MulMat3(smat, t->con.mtx, tmat);
+ mul_m3_m3m3(tmat, smat, t->con.imtx);
+ mul_m3_m3m3(smat, t->con.mtx, tmat);
}
}
@@ -410,7 +410,7 @@ static void applyObjectConstraintSize(TransInfo *t, TransData *td, float smat[3]
float tmat[3][3];
float imat[3][3];
- Mat3Inv(imat, td->axismtx);
+ invert_m3_m3(imat, td->axismtx);
if (!(t->con.mode & CON_AXIS0)) {
smat[0][0] = 1.0f;
@@ -422,8 +422,8 @@ static void applyObjectConstraintSize(TransInfo *t, TransData *td, float smat[3]
smat[2][2] = 1.0f;
}
- Mat3MulMat3(tmat, smat, imat);
- Mat3MulMat3(smat, td->axismtx, tmat);
+ mul_m3_m3m3(tmat, smat, imat);
+ mul_m3_m3m3(smat, td->axismtx, tmat);
}
}
@@ -462,7 +462,7 @@ static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3], fl
}
/* don't flip axis if asked to or if num input */
if (angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) {
- if (Inpf(vec, t->viewinv[2]) > 0.0f) {
+ if (dot_v3v3(vec, t->viewinv[2]) > 0.0f) {
*angle = -(*angle);
}
}
@@ -508,7 +508,7 @@ static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3],
break;
}
if (angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) {
- if (Inpf(vec, t->viewinv[2]) > 0.0f) {
+ if (dot_v3v3(vec, t->viewinv[2]) > 0.0f) {
*angle = -(*angle);
}
}
@@ -519,7 +519,7 @@ static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3],
void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) {
strncpy(t->con.text + 1, text, 48);
- Mat3CpyMat3(t->con.mtx, space);
+ copy_m3_m3(t->con.mtx, space);
t->con.mode = mode;
getConstraintMatrix(t);
@@ -535,7 +535,7 @@ void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[])
void setLocalConstraint(TransInfo *t, int mode, const char text[]) {
if (t->flag & T_EDIT) {
float obmat[3][3];
- Mat3CpyMat4(obmat, t->scene->obedit->obmat);
+ copy_m3_m4(obmat, t->scene->obedit->obmat);
setConstraint(t, obmat, mode, text);
}
else {
@@ -544,7 +544,7 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[]) {
}
else {
strncpy(t->con.text + 1, text, 48);
- Mat3CpyMat3(t->con.mtx, t->data->axismtx);
+ copy_m3_m3(t->con.mtx, t->data->axismtx);
t->con.mode = mode;
getConstraintMatrix(t);
@@ -573,7 +573,7 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
{
float mtx[3][3];
sprintf(text, ftext, "global");
- Mat3One(mtx);
+ unit_m3(mtx);
setConstraint(t, mtx, mode, text);
}
break;
@@ -630,7 +630,7 @@ void drawConstraint(const struct bContext *C, TransInfo *t)
float vec[3];
char col2[3] = {255,255,255};
convertViewVec(t, vec, (short)(t->mval[0] - t->con.imval[0]), (short)(t->mval[1] - t->con.imval[1]));
- VecAddf(vec, vec, tc->center);
+ add_v3_v3v3(vec, vec, tc->center);
drawLine(t, tc->center, tc->mtx[0], 'x', 0);
drawLine(t, tc->center, tc->mtx[1], 'y', 0);
@@ -673,13 +673,13 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
if(t->spacetype == SPACE_VIEW3D && rv3d != NULL)
{
- Mat4CpyMat4(tmat, rv3d->viewmat);
- Mat4Invert(imat, tmat);
+ copy_m4_m4(tmat, rv3d->viewmat);
+ invert_m4_m4(imat, tmat);
}
else
{
- Mat4One(tmat);
- Mat4One(imat);
+ unit_m4(tmat);
+ unit_m4(imat);
}
glPushMatrix();
@@ -756,8 +756,8 @@ void stopConstraint(TransInfo *t) {
void getConstraintMatrix(TransInfo *t)
{
float mat[3][3];
- Mat3Inv(t->con.imtx, t->con.mtx);
- Mat3One(t->con.pmtx);
+ invert_m3_m3(t->con.imtx, t->con.mtx);
+ unit_m3(t->con.pmtx);
if (!(t->con.mode & CON_AXIS0)) {
t->con.pmtx[0][0] =
@@ -777,15 +777,15 @@ void getConstraintMatrix(TransInfo *t)
t->con.pmtx[2][2] = 0.0f;
}
- Mat3MulMat3(mat, t->con.pmtx, t->con.imtx);
- Mat3MulMat3(t->con.pmtx, t->con.mtx, mat);
+ mul_m3_m3m3(mat, t->con.pmtx, t->con.imtx);
+ mul_m3_m3m3(t->con.pmtx, t->con.mtx, mat);
}
/*------------------------- MMB Select -------------------------------*/
void initSelectConstraint(TransInfo *t, float mtx[3][3])
{
- Mat3CpyMat3(t->con.mtx, mtx);
+ copy_m3_m3(t->con.mtx, mtx);
t->con.mode |= CON_APPLY;
t->con.mode |= CON_SELECT;
@@ -852,24 +852,24 @@ static void setNearestAxis3d(TransInfo *t)
projecting them with window_to_3d_delta and then get the length of that vector.
*/
zfac= t->persmat[0][3]*t->center[0]+ t->persmat[1][3]*t->center[1]+ t->persmat[2][3]*t->center[2]+ t->persmat[3][3];
- zfac = VecLength(t->persinv[0]) * 2.0f/t->ar->winx * zfac * 30.0f;
+ zfac = len_v3(t->persinv[0]) * 2.0f/t->ar->winx * zfac * 30.0f;
for (i = 0; i<3; i++) {
VECCOPY(axis, t->con.mtx[i]);
- VecMulf(axis, zfac);
+ mul_v3_fl(axis, zfac);
/* now we can project to get window coordinate */
- VecAddf(axis, axis, t->con.center);
+ add_v3_v3v3(axis, axis, t->con.center);
projectIntView(t, axis, icoord);
axis[0] = (float)(icoord[0] - t->center2d[0]);
axis[1] = (float)(icoord[1] - t->center2d[1]);
axis[2] = 0.0f;
- if (Normalize(axis) != 0.0f) {
- Projf(proj, mvec, axis);
- VecSubf(axis, mvec, proj);
- len[i] = Normalize(axis);
+ if (normalize_v3(axis) != 0.0f) {
+ project_v3_v3v3(proj, mvec, axis);
+ sub_v3_v3v3(axis, mvec, proj);
+ len[i] = normalize_v3(axis);
}
else {
len[i] = 10000000000.0f;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 85ebf725467..808b3ffa4ff 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -135,7 +135,7 @@
//#include "BDR_editobject.h" // reset_slowparents()
//#include "BDR_gpencil.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
@@ -263,9 +263,9 @@ static void set_prop_dist(TransInfo *t, short with_dist)
for (i = 0, td= t->data; i < t->total; i++, td++) {
if(td->flag & TD_SELECTED) {
- VecSubf(vec, tob->center, td->center);
- Mat3MulVecfl(tob->mtx, vec);
- dist = Normalize(vec);
+ sub_v3_v3v3(vec, tob->center, td->center);
+ mul_m3_v3(tob->mtx, vec);
+ dist = normalize_v3(vec);
if (tob->rdist == -1.0f) {
tob->rdist = dist;
}
@@ -315,10 +315,10 @@ static void createTransTexspace(bContext *C, TransInfo *t)
VECCOPY(td->center, ob->obmat[3]);
td->ob = ob;
- Mat3CpyMat4(td->mtx, ob->obmat);
- Mat3CpyMat4(td->axismtx, ob->obmat);
- Mat3Ortho(td->axismtx);
- Mat3Inv(td->smtx, td->mtx);
+ copy_m3_m4(td->mtx, ob->obmat);
+ copy_m3_m4(td->axismtx, ob->obmat);
+ normalize_m3(td->axismtx);
+ invert_m3_m3(td->smtx, td->mtx);
if (give_obdata_texspace(ob, &texflag, &td->loc, &td->ext->size, &td->ext->rot)) {
*texflag &= ~AUTOSPACE;
@@ -358,14 +358,14 @@ static void createTransEdge(bContext *C, TransInfo *t) {
td= t->data= MEM_callocN(t->total * sizeof(TransData), "TransCrease");
- Mat3CpyMat4(mtx, t->obedit->obmat);
- Mat3Inv(smtx, mtx);
+ copy_m3_m4(mtx, t->obedit->obmat);
+ invert_m3_m3(smtx, mtx);
for(eed= em->edges.first; eed; eed= eed->next) {
if(eed->h==0 && (eed->f & SELECT || propmode)) {
/* need to set center for center calculations */
- VecAddf(td->center, eed->v1->co, eed->v2->co);
- VecMulf(td->center, 0.5f);
+ add_v3_v3v3(td->center, eed->v1->co, eed->v2->co);
+ mul_v3_fl(td->center, 0.5f);
td->loc= NULL;
if (eed->f & SELECT)
@@ -374,8 +374,8 @@ static void createTransEdge(bContext *C, TransInfo *t) {
td->flag= 0;
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
+ copy_m3_m3(td->smtx, smtx);
+ copy_m3_m3(td->mtx, mtx);
td->ext = NULL;
if (t->mode == TFM_BWEIGHT) {
@@ -460,7 +460,7 @@ static short apply_targetless_ik(Object *ob)
float offs_bone[4][4];
/* offs_bone = yoffs(b-1) + root(b) + bonemat(b) */
- Mat4CpyMat3(offs_bone, bone->bone_mat);
+ copy_m4_m3(offs_bone, bone->bone_mat);
/* The bone's root offset (is in the parent's coordinate system) */
VECCOPY(offs_bone[3], bone->head);
@@ -471,60 +471,60 @@ static short apply_targetless_ik(Object *ob)
/* pose_mat(b-1) * offs_bone */
if(parchan->bone->flag & BONE_HINGE) {
/* the rotation of the parent restposition */
- Mat4CpyMat4(rmat, parbone->arm_mat); /* rmat used as temp */
+ copy_m4_m4(rmat, parbone->arm_mat); /* rmat used as temp */
/* the location of actual parent transform */
VECCOPY(rmat[3], offs_bone[3]);
offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
- Mat4MulVecfl(parchan->parent->pose_mat, rmat[3]);
+ mul_m4_v3(parchan->parent->pose_mat, rmat[3]);
- Mat4MulMat4(tmat, offs_bone, rmat);
+ mul_m4_m4m4(tmat, offs_bone, rmat);
}
else if(parchan->bone->flag & BONE_NO_SCALE) {
- Mat4MulMat4(tmat, offs_bone, parchan->parent->pose_mat);
- Mat4Ortho(tmat);
+ mul_m4_m4m4(tmat, offs_bone, parchan->parent->pose_mat);
+ normalize_m4(tmat);
}
else
- Mat4MulMat4(tmat, offs_bone, parchan->parent->pose_mat);
+ mul_m4_m4m4(tmat, offs_bone, parchan->parent->pose_mat);
- Mat4Invert(imat, tmat);
+ invert_m4_m4(imat, tmat);
}
else {
- Mat4CpyMat3(tmat, bone->bone_mat);
+ copy_m4_m3(tmat, bone->bone_mat);
VECCOPY(tmat[3], bone->head);
- Mat4Invert(imat, tmat);
+ invert_m4_m4(imat, tmat);
}
/* result matrix */
- Mat4MulMat4(rmat, parchan->pose_mat, imat);
+ mul_m4_m4m4(rmat, parchan->pose_mat, imat);
/* apply and decompose, doesn't work for constraints or non-uniform scale well */
{
float rmat3[3][3], qrmat[3][3], imat[3][3], smat[3][3];
- Mat3CpyMat4(rmat3, rmat);
+ copy_m3_m4(rmat3, rmat);
/* rotation */
if (parchan->rotmode > 0)
- Mat3ToEulO(rmat3, parchan->eul, parchan->rotmode);
+ mat3_to_eulO( parchan->eul, parchan->rotmode,rmat3);
else if (parchan->rotmode == ROT_MODE_AXISANGLE)
- Mat3ToAxisAngle(rmat3, parchan->rotAxis, &pchan->rotAngle);
+ mat3_to_axis_angle( parchan->rotAxis, &pchan->rotAngle,rmat3);
else
- Mat3ToQuat(rmat3, parchan->quat);
+ mat3_to_quat( parchan->quat,rmat3);
/* for size, remove rotation */
/* causes problems with some constraints (so apply only if needed) */
if (data->flag & CONSTRAINT_IK_STRETCH) {
if (parchan->rotmode > 0)
- EulOToMat3(parchan->eul, parchan->rotmode, qrmat);
+ eulO_to_mat3( qrmat,parchan->eul, parchan->rotmode);
else if (parchan->rotmode == ROT_MODE_AXISANGLE)
- AxisAngleToMat3(parchan->rotAxis, parchan->rotAngle, qrmat);
+ axis_angle_to_mat3( qrmat,parchan->rotAxis, parchan->rotAngle);
else
- QuatToMat3(parchan->quat, qrmat);
+ quat_to_mat3( qrmat,parchan->quat);
- Mat3Inv(imat, qrmat);
- Mat3MulMat3(smat, rmat3, imat);
- Mat3ToSize(smat, parchan->size);
+ invert_m3_m3(imat, qrmat);
+ mul_m3_m3m3(smat, rmat3, imat);
+ mat3_to_size( parchan->size,smat);
}
/* causes problems with some constraints (e.g. childof), so disable this */
@@ -602,38 +602,38 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
/* proper way to get parent transform + own transform + constraints transform */
- Mat3CpyMat4(omat, ob->obmat);
+ copy_m3_m4(omat, ob->obmat);
if (pchan->parent) {
if(pchan->bone->flag & BONE_HINGE)
- Mat3CpyMat4(pmat, pchan->parent->bone->arm_mat);
+ copy_m3_m4(pmat, pchan->parent->bone->arm_mat);
else
- Mat3CpyMat4(pmat, pchan->parent->pose_mat);
+ copy_m3_m4(pmat, pchan->parent->pose_mat);
if (constraints_list_needinv(t, &pchan->constraints)) {
- Mat3CpyMat4(tmat, pchan->constinv);
- Mat3Inv(cmat, tmat);
- Mat3MulSerie(td->mtx, pchan->bone->bone_mat, pmat, omat, cmat, 0,0,0,0); // dang mulserie swaps args
+ copy_m3_m4(tmat, pchan->constinv);
+ invert_m3_m3(cmat, tmat);
+ mul_serie_m3(td->mtx, pchan->bone->bone_mat, pmat, omat, cmat, 0,0,0,0); // dang mulserie swaps args
}
else
- Mat3MulSerie(td->mtx, pchan->bone->bone_mat, pmat, omat, 0,0,0,0,0); // dang mulserie swaps args
+ mul_serie_m3(td->mtx, pchan->bone->bone_mat, pmat, omat, 0,0,0,0,0); // dang mulserie swaps args
}
else {
if (constraints_list_needinv(t, &pchan->constraints)) {
- Mat3CpyMat4(tmat, pchan->constinv);
- Mat3Inv(cmat, tmat);
- Mat3MulSerie(td->mtx, pchan->bone->bone_mat, omat, cmat, 0,0,0,0,0); // dang mulserie swaps args
+ copy_m3_m4(tmat, pchan->constinv);
+ invert_m3_m3(cmat, tmat);
+ mul_serie_m3(td->mtx, pchan->bone->bone_mat, omat, cmat, 0,0,0,0,0); // dang mulserie swaps args
}
else
- Mat3MulMat3(td->mtx, omat, pchan->bone->bone_mat); // Mat3MulMat3 has swapped args!
+ mul_m3_m3m3(td->mtx, omat, pchan->bone->bone_mat); // Mat3MulMat3 has swapped args!
}
- Mat3Inv(td->smtx, td->mtx);
+ invert_m3_m3(td->smtx, td->mtx);
/* for axismat we use bone's own transform */
- Mat3CpyMat4(pmat, pchan->pose_mat);
- Mat3MulMat3(td->axismtx, omat, pmat);
- Mat3Ortho(td->axismtx);
+ copy_m3_m4(pmat, pchan->pose_mat);
+ mul_m3_m3m3(td->axismtx, omat, pmat);
+ normalize_m3(td->axismtx);
if (t->mode==TFM_BONESIZE) {
bArmature *arm= t->poseobj->data;
@@ -666,8 +666,8 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
data->flag |= CONSTRAINT_IK_AUTO;
/* only object matrix correction */
- Mat3CpyMat3 (td->mtx, omat);
- Mat3Inv (td->smtx, td->mtx);
+ copy_m3_m3(td->mtx, omat);
+ invert_m3_m3(td->smtx, td->mtx);
}
}
@@ -1080,8 +1080,8 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
if (!t->total) return;
- Mat3CpyMat4(mtx, t->obedit->obmat);
- Mat3Inv(smtx, mtx);
+ copy_m3_m4(mtx, t->obedit->obmat);
+ invert_m3_m3(smtx, mtx);
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransEditBone");
@@ -1100,8 +1100,8 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
VECCOPY (td->center, ebo->head);
td->flag= TD_SELECTED;
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
+ copy_m3_m3(td->smtx, smtx);
+ copy_m3_m3(td->mtx, mtx);
td->loc = NULL;
td->ext = NULL;
@@ -1115,8 +1115,8 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
VECCOPY (td->center, ebo->tail);
td->flag= TD_SELECTED;
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
+ copy_m3_m3(td->smtx, smtx);
+ copy_m3_m3(td->mtx, mtx);
td->loc = NULL;
td->ext = NULL;
@@ -1145,13 +1145,13 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
td->flag= TD_SELECTED;
/* use local bone matrix */
- VecSubf(delta, ebo->tail, ebo->head);
+ sub_v3_v3v3(delta, ebo->tail, ebo->head);
vec_roll_to_mat3(delta, ebo->roll, bonemat);
- Mat3MulMat3(td->mtx, mtx, bonemat);
- Mat3Inv(td->smtx, td->mtx);
+ mul_m3_m3m3(td->mtx, mtx, bonemat);
+ invert_m3_m3(td->smtx, td->mtx);
- Mat3CpyMat3(td->axismtx, td->mtx);
- Mat3Ortho(td->axismtx);
+ copy_m3_m3(td->axismtx, td->mtx);
+ normalize_m3(td->axismtx);
td->ext = NULL;
@@ -1185,10 +1185,10 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
if (ebo->flag & BONE_EDITMODE_LOCKED)
td->protectflag = OB_LOCK_LOC|OB_LOCK_ROT|OB_LOCK_SCALE;
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
+ copy_m3_m3(td->smtx, smtx);
+ copy_m3_m3(td->mtx, mtx);
- VecSubf(delta, ebo->tail, ebo->head);
+ sub_v3_v3v3(delta, ebo->tail, ebo->head);
vec_roll_to_mat3(delta, ebo->roll, td->axismtx);
if ((ebo->flag & BONE_ROOTSEL) == 0)
@@ -1210,10 +1210,10 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
if (ebo->flag & BONE_EDITMODE_LOCKED)
td->protectflag = OB_LOCK_LOC|OB_LOCK_ROT|OB_LOCK_SCALE;
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
+ copy_m3_m3(td->smtx, smtx);
+ copy_m3_m3(td->mtx, mtx);
- VecSubf(delta, ebo->tail, ebo->head);
+ sub_v3_v3v3(delta, ebo->tail, ebo->head);
vec_roll_to_mat3(delta, ebo->roll, td->axismtx);
td->extra = ebo; /* to fix roll */
@@ -1255,8 +1255,8 @@ static void createTransMBallVerts(bContext *C, TransInfo *t)
td = t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(MBall EditMode)");
tx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "MetaElement_TransExtension");
- Mat3CpyMat4(mtx, t->obedit->obmat);
- Mat3Inv(smtx, mtx);
+ copy_m3_m4(mtx, t->obedit->obmat);
+ invert_m3_m3(smtx, mtx);
for(ml= mb->editelems->first; ml; ml= ml->next) {
if(propmode || (ml->flag & SELECT)) {
@@ -1267,8 +1267,8 @@ static void createTransMBallVerts(bContext *C, TransInfo *t)
if(ml->flag & SELECT) td->flag= TD_SELECTED | TD_USEQUAT | TD_SINGLESIZE;
else td->flag= TD_USEQUAT;
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
+ copy_m3_m3(td->smtx, smtx);
+ copy_m3_m3(td->mtx, mtx);
td->ext = tx;
@@ -1311,7 +1311,7 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) {
}
else if(td_near) {
float dist;
- dist = VecLenf(td_near->center, td->center);
+ dist = len_v3v3(td_near->center, td->center);
if (dist < (td-1)->dist) {
td->dist = (td-1)->dist;
}
@@ -1332,7 +1332,7 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) {
}
else if(td_near) {
float dist;
- dist = VecLenf(td_near->center, td->center);
+ dist = len_v3v3(td_near->center, td->center);
if (td->flag & TD_NOTCONNECTED || dist < td->dist || (td+1)->dist < td->dist) {
td->flag &= ~TD_NOTCONNECTED;
if (dist < (td+1)->dist) {
@@ -1408,8 +1408,8 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
else t->total = countsel;
t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Curve EditMode)");
- Mat3CpyMat4(mtx, t->obedit->obmat);
- Mat3Inv(smtx, mtx);
+ copy_m3_m4(mtx, t->obedit->obmat);
+ invert_m3_m3(smtx, mtx);
td = t->data;
for(nu= cu->editnurb->first; nu; nu= nu->next) {
@@ -1439,8 +1439,8 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
hdata = initTransDataCurveHandles(td, bezt);
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
+ copy_m3_m3(td->smtx, smtx);
+ copy_m3_m3(td->mtx, mtx);
td++;
count++;
@@ -1466,8 +1466,8 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
td->val = NULL;
}
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
+ copy_m3_m3(td->smtx, smtx);
+ copy_m3_m3(td->mtx, mtx);
if ((bezt->f1&SELECT)==0 && (bezt->f3&SELECT)==0)
/* If the middle is selected but the sides arnt, this is needed */
@@ -1500,8 +1500,8 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
hdata = initTransDataCurveHandles(td, bezt);
}
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
+ copy_m3_m3(td->smtx, smtx);
+ copy_m3_m3(td->mtx, mtx);
td++;
count++;
@@ -1542,8 +1542,8 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
td->ival = bp->alfa;
}
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
+ copy_m3_m3(td->smtx, smtx);
+ copy_m3_m3(td->mtx, mtx);
td++;
count++;
@@ -1590,8 +1590,8 @@ static void createTransLatticeVerts(bContext *C, TransInfo *t)
else t->total = countsel;
t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Lattice EditMode)");
- Mat3CpyMat4(mtx, t->obedit->obmat);
- Mat3Inv(smtx, mtx);
+ copy_m3_m4(mtx, t->obedit->obmat);
+ invert_m3_m3(smtx, mtx);
td = t->data;
bp = latt->def;
@@ -1604,8 +1604,8 @@ static void createTransLatticeVerts(bContext *C, TransInfo *t)
VECCOPY(td->center, td->loc);
if(bp->f1 & SELECT) td->flag= TD_SELECTED;
else td->flag= 0;
- Mat3CpyMat3(td->smtx, smtx);
- Mat3CpyMat3(td->mtx, mtx);
+ copy_m3_m3(td->smtx, smtx);
+ copy_m3_m3(td->mtx, mtx);
td->ext = NULL;
td->val = NULL;
@@ -1679,9 +1679,9 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
else
tx = t->ext = NULL;
- Mat4One(mat);
+ unit_m4(mat);
- Mat4Invert(ob->imat,ob->obmat);
+ invert_m4_m4(ob->imat,ob->obmat);
for(i=0, point=edit->points; i<edit->totpoint; i++, point++) {
TransData *head, *tail;
@@ -1695,7 +1695,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
for(k=0, key=point->keys; k<point->totkey; k++, key++) {
if(key->flag & PEK_USE_WCO) {
VECCOPY(key->world_co, key->co);
- Mat4MulVecfl(mat, key->world_co);
+ mul_m4_v3(mat, key->world_co);
td->loc = key->world_co;
}
else
@@ -1709,8 +1709,8 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
else if(!propmode)
td->flag |= TD_SKIP;
- Mat3One(td->mtx);
- Mat3One(td->smtx);
+ unit_m3(td->mtx);
+ unit_m3(td->smtx);
/* don't allow moving roots */
if(k==0 && pset->flag & PE_LOCK_FIRST && (!psys || !(psys->flag & PSYS_GLOBAL_HAIR)))
@@ -1764,15 +1764,15 @@ void flushTransParticles(TransInfo *t)
if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + i, mat);
- Mat4Invert(imat,mat);
+ invert_m4_m4(imat,mat);
for(k=0, key=point->keys; k<point->totkey; k++, key++) {
VECCOPY(co, key->world_co);
- Mat4MulVecfl(imat, co);
+ mul_m4_v3(imat, co);
/* optimization for proportional edit */
- if(!propmode || !FloatCompare(key->co, co, 0.0001f)) {
+ if(!propmode || !compare_v3v3(key->co, co, 0.0001f)) {
VECCOPY(key->co, co);
point->flag |= PEP_EDIT_RECALC;
}
@@ -1838,13 +1838,13 @@ static void editmesh_set_connectivity_distance(EditMesh *em, int total, float *v
if (v1->f2) {
if (v2->f2) {
float nvec[3];
- float len1 = VecLength(vec1);
- float len2 = VecLength(vec2);
+ float len1 = len_v3(vec1);
+ float len2 = len_v3(vec2);
float lenn;
/* for v2 if not selected */
if (v2->f2 != 2) {
- VecSubf(nvec, v2->co, E_NEAR(v1)->co);
- lenn = VecLength(nvec);
+ sub_v3_v3v3(nvec, v2->co, E_NEAR(v1)->co);
+ lenn = len_v3(nvec);
/* 1 < n < 2 */
if (lenn - len1 > THRESHOLD && len2 - lenn > THRESHOLD) {
VECCOPY(vec2, nvec);
@@ -1860,8 +1860,8 @@ static void editmesh_set_connectivity_distance(EditMesh *em, int total, float *v
}
/* for v1 if not selected */
if (v1->f2 != 2) {
- VecSubf(nvec, v1->co, E_NEAR(v2)->co);
- lenn = VecLength(nvec);
+ sub_v3_v3v3(nvec, v1->co, E_NEAR(v2)->co);
+ lenn = len_v3(nvec);
/* 2 < n < 1 */
if (lenn - len2 > THRESHOLD && len1 - lenn > THRESHOLD) {
VECCOPY(vec1, nvec);
@@ -1878,9 +1878,9 @@ static void editmesh_set_connectivity_distance(EditMesh *em, int total, float *v
}
else {
v2->f2 = 1;
- VecSubf(vec2, v2->co, E_NEAR(v1)->co);
+ sub_v3_v3v3(vec2, v2->co, E_NEAR(v1)->co);
/* 2 < 1 */
- if (VecLength(vec1) - VecLength(vec2) > THRESHOLD) {
+ if (len_v3(vec1) - len_v3(vec2) > THRESHOLD) {
VECCOPY(vec2, vec1);
}
E_NEAR(v2) = E_NEAR(v1);
@@ -1889,9 +1889,9 @@ static void editmesh_set_connectivity_distance(EditMesh *em, int total, float *v
}
else if (v2->f2) {
v1->f2 = 1;
- VecSubf(vec1, v1->co, E_NEAR(v2)->co);
+ sub_v3_v3v3(vec1, v1->co, E_NEAR(v2)->co);
/* 2 < 1 */
- if (VecLength(vec2) - VecLength(vec1) > THRESHOLD) {
+ if (len_v3(vec2) - len_v3(vec1) > THRESHOLD) {
VECCOPY(vec1, vec2);
}
E_NEAR(v1) = E_NEAR(v2);
@@ -2009,13 +2009,13 @@ static void set_crazy_vertex_quat(float *quat, float *v1, float *v2, float *v3,
TAN_MAKE_VEC(vecu, v1, v2);
TAN_MAKE_VEC(vecv, v1, v3);
- triatoquat(v1, vecu, vecv, q1);
+ tri_to_quat( q1,v1, vecu, vecv);
TAN_MAKE_VEC(vecu, def1, def2);
TAN_MAKE_VEC(vecv, def1, def3);
- triatoquat(def1, vecu, vecv, q2);
+ tri_to_quat( q2,def1, vecu, vecv);
- QuatSub(quat, q2, q1);
+ sub_qt_qtqt(quat, q2, q1);
}
#undef TAN_MAKE_VEC
@@ -2192,8 +2192,8 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
else t->total = countsel;
tob= t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Mesh EditMode)");
- Mat3CpyMat4(mtx, t->obedit->obmat);
- Mat3Inv(smtx, mtx);
+ copy_m3_m4(mtx, t->obedit->obmat);
+ invert_m3_m3(smtx, mtx);
if(propmode) editmesh_set_connectivity_distance(em, t->total, vectors, nears);
@@ -2251,8 +2251,8 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
if (eve->f2) {
float vec[3];
VECCOPY(vec, E_VEC(eve));
- Mat3MulVecfl(mtx, vec);
- tob->dist= VecLength(vec);
+ mul_m3_v3(mtx, vec);
+ tob->dist= len_v3(vec);
}
else {
tob->flag |= TD_NOTCONNECTED;
@@ -2266,25 +2266,25 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
/* use both or either quat and defmat correction */
if(quats && eve->tmp.f) {
- QuatToMat3(eve->tmp.p, qmat);
+ quat_to_mat3( qmat,eve->tmp.p);
if(defmats)
- Mat3MulSerie(mat, mtx, qmat, defmats[a],
+ mul_serie_m3(mat, mtx, qmat, defmats[a],
NULL, NULL, NULL, NULL, NULL);
else
- Mat3MulMat3(mat, mtx, qmat);
+ mul_m3_m3m3(mat, mtx, qmat);
}
else
- Mat3MulMat3(mat, mtx, defmats[a]);
+ mul_m3_m3m3(mat, mtx, defmats[a]);
- Mat3Inv(imat, mat);
+ invert_m3_m3(imat, mat);
- Mat3CpyMat3(tob->smtx, imat);
- Mat3CpyMat3(tob->mtx, mat);
+ copy_m3_m3(tob->smtx, imat);
+ copy_m3_m3(tob->mtx, mat);
}
else {
- Mat3CpyMat3(tob->smtx, smtx);
- Mat3CpyMat3(tob->mtx, mtx);
+ copy_m3_m3(tob->smtx, smtx);
+ copy_m3_m3(tob->mtx, mtx);
}
/* Mirror? */
@@ -2459,8 +2459,8 @@ static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, f
else {
td->dist= MAXFLOAT;
}
- Mat3One(td->mtx);
- Mat3One(td->smtx);
+ unit_m3(td->mtx);
+ unit_m3(td->smtx);
}
static void createTransUVs(bContext *C, TransInfo *t)
@@ -2755,8 +2755,8 @@ static void createTransNlaData(bContext *C, TransInfo *t)
td->flag |= TD_SELECTED;
td->dist= 0.0f;
- Mat3One(td->mtx);
- Mat3One(td->smtx);
+ unit_m3(td->mtx);
+ unit_m3(td->smtx);
}
else {
td->val= &tdn->h1[0];
@@ -2786,8 +2786,8 @@ static void createTransNlaData(bContext *C, TransInfo *t)
td->flag |= TD_SELECTED;
td->dist= 0.0f;
- Mat3One(td->mtx);
- Mat3One(td->smtx);
+ unit_m3(td->mtx);
+ unit_m3(td->smtx);
}
else {
td->val= &tdn->h2[0];
@@ -3351,8 +3351,8 @@ static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt,
if (intvals)
td->flag |= TD_INTVALUES;
- Mat3One(td->mtx);
- Mat3One(td->smtx);
+ unit_m3(td->mtx);
+ unit_m3(td->smtx);
}
static void createTransGraphEditData(bContext *C, TransInfo *t)
@@ -3986,8 +3986,8 @@ static TransData *SeqToTransData(TransInfo *t, TransData *td, TransData2D *td2d,
td->flag |= TD_SELECTED;
td->dist= 0.0;
- Mat3One(td->mtx);
- Mat3One(td->smtx);
+ unit_m3(td->mtx);
+ unit_m3(td->smtx);
/* Time Transform (extend) */
td->val= td2d->loc;
@@ -4200,8 +4200,8 @@ static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *
short skip_invert = 0;
/* axismtx has the real orientation */
- Mat3CpyMat4(td->axismtx, ob->obmat);
- Mat3Ortho(td->axismtx);
+ copy_m3_m4(td->axismtx, ob->obmat);
+ normalize_m3(td->axismtx);
td->con= ob->constraints.first;
@@ -4280,7 +4280,7 @@ static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *
VECCOPY(td->center, ob->obmat[3]);
- Mat4CpyMat4(td->ext->obmat, ob->obmat);
+ copy_m4_m4(td->ext->obmat, ob->obmat);
/* is there a need to set the global<->data space conversion matrices? */
if (ob->parent || constinv) {
@@ -4291,15 +4291,15 @@ static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *
* done, as it doesn't work well.
*/
object_to_mat3(ob, obmtx);
- Mat3CpyMat4(totmat, ob->obmat);
- Mat3Inv(obinv, totmat);
- Mat3MulMat3(td->smtx, obmtx, obinv);
- Mat3Inv(td->mtx, td->smtx);
+ copy_m3_m4(totmat, ob->obmat);
+ invert_m3_m3(obinv, totmat);
+ mul_m3_m3m3(td->smtx, obmtx, obinv);
+ invert_m3_m3(td->mtx, td->smtx);
}
else {
/* no conversion to/from dataspace */
- Mat3One(td->smtx);
- Mat3One(td->mtx);
+ unit_m3(td->smtx);
+ unit_m3(td->mtx);
}
/* set active flag */
@@ -5152,8 +5152,8 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node)
td->flag |= TD_SELECTED;
td->dist= 0.0;
- Mat3One(td->mtx);
- Mat3One(td->smtx);
+ unit_m3(td->mtx);
+ unit_m3(td->smtx);
}
void createTransNodeData(bContext *C, TransInfo *t)
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 2e7cfd63836..d3c0e91e57c 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -100,7 +100,7 @@
//#include "BDR_unwrapper.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
@@ -131,20 +131,20 @@ void getViewVector(TransInfo *t, float coord[3], float vec[3])
p1[3] = 1.0f;
VECCOPY(p2, p1);
p2[3] = 1.0f;
- Mat4MulVec4fl(t->viewmat, p2);
+ mul_m4_v4(t->viewmat, p2);
p2[0] = 2.0f * p2[0];
p2[1] = 2.0f * p2[1];
p2[2] = 2.0f * p2[2];
- Mat4MulVec4fl(t->viewinv, p2);
+ mul_m4_v4(t->viewinv, p2);
- VecSubf(vec, p1, p2);
+ sub_v3_v3v3(vec, p1, p2);
}
else {
VECCOPY(vec, t->viewinv[2]);
}
- Normalize(vec);
+ normalize_v3(vec);
}
/* ************************** GENERICS **************************** */
@@ -181,9 +181,9 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
if (mmd->mirror_ob) {
float obinv[4][4];
- Mat4Invert(obinv, mmd->mirror_ob->obmat);
- Mat4MulMat4(mtx, ob->obmat, obinv);
- Mat4Invert(imtx, mtx);
+ invert_m4_m4(obinv, mmd->mirror_ob->obmat);
+ mul_m4_m4m4(mtx, ob->obmat, obinv);
+ invert_m4_m4(imtx, mtx);
}
for(i = 0 ; i < t->total; i++, td++) {
@@ -198,12 +198,12 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
if (td->flag & TD_SKIP)
continue;
- VecCopyf(loc, td->loc);
- VecCopyf(iloc, td->iloc);
+ copy_v3_v3(loc, td->loc);
+ copy_v3_v3(iloc, td->iloc);
if (mmd->mirror_ob) {
- VecMat4MulVecfl(loc, mtx, loc);
- VecMat4MulVecfl(iloc, mtx, iloc);
+ mul_v3_m4v3(loc, mtx, loc);
+ mul_v3_m4v3(iloc, mtx, iloc);
}
clip = 0;
@@ -231,9 +231,9 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
}
if (clip) {
if (mmd->mirror_ob) {
- VecMat4MulVecfl(loc, imtx, loc);
+ mul_v3_m4v3(loc, imtx, loc);
}
- VecCopyf(td->loc, loc);
+ copy_v3_v3(td->loc, loc);
}
}
}
@@ -692,7 +692,7 @@ void recalcData(TransInfo *t)
}
/* on extrude bones, oldlength==0.0f, so we scale radius of points */
- ebo->length= VecLenf(ebo->head, ebo->tail);
+ ebo->length= len_v3v3(ebo->head, ebo->tail);
if(ebo->oldlength==0.0f) {
ebo->rad_head= 0.25f*ebo->length;
ebo->rad_tail= 0.10f*ebo->length;
@@ -727,14 +727,14 @@ void recalcData(TransInfo *t)
if (t->mode != TFM_ROTATION)
{
- VecSubf(vec, ebo->tail, ebo->head);
- Normalize(vec);
- RotationBetweenVectorsToQuat(qrot, td->axismtx[1], vec);
- QuatMulVecf(qrot, up_axis);
+ sub_v3_v3v3(vec, ebo->tail, ebo->head);
+ normalize_v3(vec);
+ rotation_between_vecs_to_quat(qrot, td->axismtx[1], vec);
+ mul_qt_v3(qrot, up_axis);
}
else
{
- Mat3MulVecfl(t->mat, up_axis);
+ mul_m3_v3(t->mat, up_axis);
}
ebo->roll = ED_rollBoneToVector(ebo, up_axis);
@@ -835,11 +835,11 @@ void drawLine(TransInfo *t, float *center, float *dir, char axis, short options)
//if(t->obedit) glLoadMatrixf(t->obedit->obmat); // sets opengl viewing
- VecCopyf(v3, dir);
- VecMulf(v3, v3d->far);
+ copy_v3_v3(v3, dir);
+ mul_v3_fl(v3, v3d->far);
- VecSubf(v2, center, v3);
- VecAddf(v1, center, v3);
+ sub_v3_v3v3(v2, center, v3);
+ add_v3_v3v3(v1, center, v3);
if (options & DRAWLIGHT) {
col[0] = col[1] = col[2] = 220;
@@ -928,7 +928,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
t->center[1] =
t->center[2] = 0.0f;
- Mat3One(t->mat);
+ unit_m3(t->mat);
t->spacetype = sa->spacetype;
if(t->spacetype == SPACE_VIEW3D)
@@ -1155,7 +1155,7 @@ void restoreTransObjects(TransInfo *t)
restoreElement(td);
}
- Mat3One(t->mat);
+ unit_m3(t->mat);
recalcData(t);
}
@@ -1167,7 +1167,7 @@ void calculateCenter2D(TransInfo *t)
float vec[3];
VECCOPY(vec, t->center);
- Mat4MulVecfl(ob->obmat, vec);
+ mul_m4_v3(ob->obmat, vec);
projectIntView(t, vec, t->center2d);
}
else {
@@ -1187,10 +1187,10 @@ void calculateCenterCursor(TransInfo *t)
Object *ob = t->obedit?t->obedit:t->poseobj;
float mat[3][3], imat[3][3];
- VecSubf(t->center, t->center, ob->obmat[3]);
- Mat3CpyMat4(mat, ob->obmat);
- Mat3Inv(imat, mat);
- Mat3MulVecfl(imat, t->center);
+ sub_v3_v3v3(t->center, t->center, ob->obmat[3]);
+ copy_m3_m4(mat, ob->obmat);
+ invert_m3_m3(imat, mat);
+ mul_m3_v3(imat, t->center);
}
calculateCenter2D(t);
@@ -1234,7 +1234,7 @@ void calculateCenterMedian(TransInfo *t)
if (t->data[i].flag & TD_SELECTED) {
if (!(t->data[i].flag & TD_NOCENTER))
{
- VecAddf(partial, partial, t->data[i].center);
+ add_v3_v3v3(partial, partial, t->data[i].center);
total++;
}
}
@@ -1247,7 +1247,7 @@ void calculateCenterMedian(TransInfo *t)
}
}
if(i)
- VecMulf(partial, 1.0f / total);
+ mul_v3_fl(partial, 1.0f / total);
VECCOPY(t->center, partial);
calculateCenter2D(t);
@@ -1262,7 +1262,7 @@ void calculateCenterBound(TransInfo *t)
if (i) {
if (t->data[i].flag & TD_SELECTED) {
if (!(t->data[i].flag & TD_NOCENTER))
- MinMax3(min, max, t->data[i].center);
+ minmax_v3_v3v3(min, max, t->data[i].center);
}
else {
/*
@@ -1277,8 +1277,8 @@ void calculateCenterBound(TransInfo *t)
VECCOPY(min, t->data[i].center);
}
}
- VecAddf(t->center, min, max);
- VecMulf(t->center, 0.5);
+ add_v3_v3v3(t->center, min, max);
+ mul_v3_fl(t->center, 0.5);
calculateCenter2D(t);
}
@@ -1341,7 +1341,7 @@ void calculateCenter(TransInfo *t)
if(t->flag & (T_EDIT|T_POSE))
{
Object *ob= t->obedit?t->obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, t->con.center);
+ mul_m4_v3(ob->obmat, t->con.center);
}
/* for panning from cameraview */
@@ -1358,7 +1358,7 @@ void calculateCenter(TransInfo *t)
float axis[3];
/* persinv is nasty, use viewinv instead, always right */
VECCOPY(axis, t->viewinv[2]);
- Normalize(axis);
+ normalize_v3(axis);
/* 6.0 = 6 grid units */
axis[0]= t->center[0]- 6.0f*axis[0];
@@ -1385,7 +1385,7 @@ void calculateCenter(TransInfo *t)
float vec[3];
VECCOPY(vec, t->center);
- Mat4MulVecfl(ob->obmat, vec);
+ mul_m4_v3(ob->obmat, vec);
initgrabz(t->ar->regiondata, vec[0], vec[1], vec[2]);
}
else {
@@ -1509,9 +1509,9 @@ float get_drawsize(ARegion *ar, float *co)
size= rv3d->persmat[0][3]*co[0]+ rv3d->persmat[1][3]*co[1]+ rv3d->persmat[2][3]*co[2]+ rv3d->persmat[3][3];
VECCOPY(vec, rv3d->persinv[0]);
- len1= Normalize(vec);
+ len1= normalize_v3(vec);
VECCOPY(vec, rv3d->persinv[1]);
- len2= Normalize(vec);
+ len2= normalize_v3(vec);
size*= 0.01f*(len1>len2?len1:len2);
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 83d4a314057..bccbfbc65f7 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -28,7 +28,7 @@
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "WM_types.h"
@@ -45,9 +45,9 @@ void InputVector(TransInfo *t, MouseInput *mi, short mval[2], float output[3])
{
/* calculate the main translation and the precise one separate */
convertViewVec(t, dvec, (short)(mval[0] - mi->precision_mval[0]), (short)(mval[1] - mi->precision_mval[1]));
- VecMulf(dvec, 0.1f);
+ mul_v3_fl(dvec, 0.1f);
convertViewVec(t, vec, (short)(mi->precision_mval[0] - t->imval[0]), (short)(mi->precision_mval[1] - t->imval[1]));
- VecAddf(output, vec, dvec);
+ add_v3_v3v3(output, vec, dvec);
}
else
{
@@ -133,9 +133,9 @@ void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, short mval[2], float
float vec[3];
InputVector(t, mi, mval, vec);
- Projf(vec, vec, t->viewinv[0]);
+ project_v3_v3v3(vec, vec, t->viewinv[0]);
- output[0] = Inpf(t->viewinv[0], vec) * 2.0f;
+ output[0] = dot_v3v3(t->viewinv[0], vec) * 2.0f;
}
void InputVerticalRatio(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) {
@@ -158,9 +158,9 @@ void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, short mval[2], float ou
float vec[3];
InputVector(t, mi, mval, vec);
- Projf(vec, vec, t->viewinv[1]);
+ project_v3_v3v3(vec, vec, t->viewinv[1]);
- output[0] = Inpf(t->viewinv[1], vec) * 2.0f;
+ output[0] = dot_v3v3(t->viewinv[1], vec) * 2.0f;
}
void setCustomPoints(TransInfo *t, MouseInput *mi, short start[2], short end[2])
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 86e83715da4..a4e093644c3 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -66,7 +66,7 @@
#include "BKE_pointcache.h"
#include "BKE_utildefines.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BIF_gl.h"
@@ -116,8 +116,8 @@ static int is_mat4_flipped(float mat[][4])
{
float vec[3];
- Crossf(vec, mat[0], mat[1]);
- if( Inpf(vec, mat[2]) < 0.0 ) return 1;
+ cross_v3_v3v3(vec, mat[0], mat[1]);
+ if( dot_v3v3(vec, mat[2]) < 0.0 ) return 1;
return 0;
}
@@ -129,7 +129,7 @@ static void calc_tw_center(Scene *scene, float *co)
float *max= scene->twmax;
DO_MINMAX(co, min, max);
- VecAddf(twcent, twcent, co);
+ add_v3_v3v3(twcent, twcent, co);
}
static void protectflag_to_drawflags(short protectflag, short *drawflags)
@@ -191,30 +191,30 @@ void gimbal_axis(Object *ob, float gmat[][3])
if(pchan && test_rotmode_euler(pchan->rotmode)) {
float mat[3][3], tmat[3][3], obmat[3][3];
- EulToGimbalAxis(mat, pchan->eul, pchan->rotmode);
+ eulO_to_gimbal_axis(mat, pchan->eul, pchan->rotmode);
/* apply bone transformation */
- Mat3MulMat3(tmat, pchan->bone->bone_mat, mat);
+ mul_m3_m3m3(tmat, pchan->bone->bone_mat, mat);
if (pchan->parent)
{
float parent_mat[3][3];
- Mat3CpyMat4(parent_mat, pchan->parent->pose_mat);
- Mat3MulMat3(mat, parent_mat, tmat);
+ copy_m3_m4(parent_mat, pchan->parent->pose_mat);
+ mul_m3_m3m3(mat, parent_mat, tmat);
/* needed if object transformation isn't identity */
- Mat3CpyMat4(obmat, ob->obmat);
- Mat3MulMat3(gmat, obmat, mat);
+ copy_m3_m4(obmat, ob->obmat);
+ mul_m3_m3m3(gmat, obmat, mat);
}
else
{
/* needed if object transformation isn't identity */
- Mat3CpyMat4(obmat, ob->obmat);
- Mat3MulMat3(gmat, obmat, tmat);
+ copy_m3_m4(obmat, ob->obmat);
+ mul_m3_m3m3(gmat, obmat, tmat);
}
- Mat3Ortho(gmat);
+ normalize_m3(gmat);
}
}
else {
@@ -225,14 +225,14 @@ void gimbal_axis(Object *ob, float gmat[][3])
{
float parent_mat[3][3], amat[3][3];
- EulToGimbalAxis(amat, ob->rot, ob->rotmode);
- Mat3CpyMat4(parent_mat, ob->parent->obmat);
- Mat3Ortho(parent_mat);
- Mat3MulMat3(gmat, parent_mat, amat);
+ eulO_to_gimbal_axis(amat, ob->rot, ob->rotmode);
+ copy_m3_m4(parent_mat, ob->parent->obmat);
+ normalize_m3(parent_mat);
+ mul_m3_m3m3(gmat, parent_mat, amat);
}
else
{
- EulToGimbalAxis(gmat, ob->rot, ob->rotmode);
+ eulO_to_gimbal_axis(gmat, ob->rot, ob->rotmode);
}
}
}
@@ -254,7 +254,7 @@ int calc_manipulator_stats(const bContext *C)
int a, totsel= 0;
/* transform widget matrix */
- Mat4One(rv3d->twmat);
+ unit_m4(rv3d->twmat);
v3d->twdrawflag= 0xFFFF;
@@ -395,10 +395,10 @@ int calc_manipulator_stats(const bContext *C)
/* selection center */
if(totsel) {
- VecMulf(scene->twcent, 1.0f/(float)totsel); // centroid!
- Mat4MulVecfl(obedit->obmat, scene->twcent);
- Mat4MulVecfl(obedit->obmat, scene->twmin);
- Mat4MulVecfl(obedit->obmat, scene->twmax);
+ mul_v3_fl(scene->twcent, 1.0f/(float)totsel); // centroid!
+ mul_m4_v3(obedit->obmat, scene->twcent);
+ mul_m4_v3(obedit->obmat, scene->twmin);
+ mul_m4_v3(obedit->obmat, scene->twmax);
}
}
else if(ob && (ob->mode & OB_MODE_POSE)) {
@@ -415,10 +415,10 @@ int calc_manipulator_stats(const bContext *C)
stats_pose(scene, v3d, pchan);
}
- VecMulf(scene->twcent, 1.0f/(float)totsel); // centroid!
- Mat4MulVecfl(ob->obmat, scene->twcent);
- Mat4MulVecfl(ob->obmat, scene->twmin);
- Mat4MulVecfl(ob->obmat, scene->twmax);
+ mul_v3_fl(scene->twcent, 1.0f/(float)totsel); // centroid!
+ mul_m4_v3(ob->obmat, scene->twcent);
+ mul_m4_v3(ob->obmat, scene->twmin);
+ mul_m4_v3(ob->obmat, scene->twmax);
}
}
else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) {
@@ -445,7 +445,7 @@ int calc_manipulator_stats(const bContext *C)
/* selection center */
if(totsel)
- VecMulf(scene->twcent, 1.0f/(float)totsel); // centroid!
+ mul_v3_fl(scene->twcent, 1.0f/(float)totsel); // centroid!
}
}
else {
@@ -466,7 +466,7 @@ int calc_manipulator_stats(const bContext *C)
/* selection center */
if(totsel) {
- VecMulf(scene->twcent, 1.0f/(float)totsel); // centroid!
+ mul_v3_fl(scene->twcent, 1.0f/(float)totsel); // centroid!
}
}
@@ -481,37 +481,37 @@ int calc_manipulator_stats(const bContext *C)
case V3D_MANIP_GIMBAL:
{
float mat[3][3];
- Mat3One(mat);
+ unit_m3(mat);
gimbal_axis(ob, mat);
- Mat4CpyMat3(rv3d->twmat, mat);
+ copy_m4_m3(rv3d->twmat, mat);
break;
}
case V3D_MANIP_NORMAL:
if(obedit || ob->mode & OB_MODE_POSE) {
float mat[3][3];
ED_getTransformOrientationMatrix(C, mat, (v3d->around == V3D_ACTIVE));
- Mat4CpyMat3(rv3d->twmat, mat);
+ copy_m4_m3(rv3d->twmat, mat);
break;
}
/* no break we define 'normal' as 'local' in Object mode */
case V3D_MANIP_LOCAL:
- Mat4CpyMat4(rv3d->twmat, ob->obmat);
- Mat4Ortho(rv3d->twmat);
+ copy_m4_m4(rv3d->twmat, ob->obmat);
+ normalize_m4(rv3d->twmat);
break;
case V3D_MANIP_VIEW:
{
float mat[3][3];
- Mat3CpyMat4(mat, rv3d->viewinv);
- Mat3Ortho(mat);
- Mat4CpyMat3(rv3d->twmat, mat);
+ copy_m3_m4(mat, rv3d->viewinv);
+ normalize_m3(mat);
+ copy_m4_m3(rv3d->twmat, mat);
}
break;
default: /* V3D_MANIP_CUSTOM */
{
float mat[3][3];
applyTransformOrientation(C, mat, NULL);
- Mat4CpyMat3(rv3d->twmat, mat);
+ copy_m4_m3(rv3d->twmat, mat);
break;
}
}
@@ -528,7 +528,7 @@ static float screen_aligned(RegionView3D *rv3d, float mat[][4])
float vec[3], size;
VECCOPY(vec, mat[0]);
- size= Normalize(vec);
+ size= normalize_v3(vec);
glTranslatef(mat[3][0], mat[3][1], mat[3][2]);
@@ -709,8 +709,8 @@ static void preOrtho(int ortho, float twmat[][4], int axis)
{
if (ortho == 0) {
float omat[4][4];
- Mat4CpyMat4(omat, twmat);
- Mat4Orthogonal(omat, axis);
+ copy_m4_m4(omat, twmat);
+ orthogonalize_m4(omat, axis);
glPushMatrix();
wmMultMatrix(omat);
}
@@ -720,8 +720,8 @@ static void preOrthoFront(int ortho, float twmat[][4], int axis)
{
if (ortho == 0) {
float omat[4][4];
- Mat4CpyMat4(omat, twmat);
- Mat4Orthogonal(omat, axis);
+ copy_m4_m4(omat, twmat);
+ orthogonalize_m4(omat, axis);
glPushMatrix();
wmMultMatrix(omat);
glFrontFace( is_mat4_flipped(omat)?GL_CW:GL_CCW);
@@ -753,8 +753,8 @@ static void draw_manipulator_rotate_ghost(View3D *v3d, RegionView3D *rv3d, int d
glEnable(GL_BLEND);
/* we need both [4][4] transforms, t->mat seems to be premul, not post for mat[][4] */
- Mat4CpyMat4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
-// XXX Mat4MulMat34(matt, t->mat, rv3d->twmat);
+ copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
+// XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat);
/* Screen aligned view rot circle */
if(drawflags & MAN_ROT_V) {
@@ -766,7 +766,7 @@ static void draw_manipulator_rotate_ghost(View3D *v3d, RegionView3D *rv3d, int d
vec[0]= 0; // XXX (float)(t->con.imval[0] - t->center2d[0]);
vec[1]= 0; // XXX (float)(t->con.imval[1] - t->center2d[1]);
vec[2]= 0.0f;
- Normalize(vec);
+ normalize_v3(vec);
startphi= saacos( vec[1] );
if(vec[0]<0.0) startphi= -startphi;
@@ -788,16 +788,16 @@ static void draw_manipulator_rotate_ghost(View3D *v3d, RegionView3D *rv3d, int d
svec[2]= 0.0f;
/* screen aligned vec transform back to manipulator space */
- Mat3CpyMat4(ivmat, rv3d->viewinv);
- Mat3CpyMat4(tmat, rv3d->twmat);
- Mat3Inv(imat, tmat);
- Mat3MulMat3(tmat, imat, ivmat);
+ copy_m3_m4(ivmat, rv3d->viewinv);
+ copy_m3_m4(tmat, rv3d->twmat);
+ invert_m3_m3(imat, tmat);
+ mul_m3_m3m3(tmat, imat, ivmat);
- Mat3MulVecfl(tmat, svec); // tmat is used further on
- Normalize(svec);
+ mul_m3_v3(tmat, svec); // tmat is used further on
+ normalize_v3(svec);
}
- ortho = IsMat4Orthogonal(rv3d->twmat);
+ ortho = is_orthogonal_m4(rv3d->twmat);
if (ortho) {
wmMultMatrix(rv3d->twmat); // aligns with original widget
@@ -812,19 +812,19 @@ static void draw_manipulator_rotate_ghost(View3D *v3d, RegionView3D *rv3d, int d
/* correct for squeezed arc */
svec[0]+= tmat[2][0];
svec[1]+= tmat[2][1];
- Normalize(svec);
+ normalize_v3(svec);
startphi= (float)atan2(svec[0], svec[1]);
}
else startphi= 0.5f*(float)M_PI;
VECCOPY(vec, rv3d->twmat[0]); // use x axis to detect rotation
- Normalize(vec);
- Normalize(matt[0]);
- phi= saacos( Inpf(vec, matt[0]) );
+ normalize_v3(vec);
+ normalize_v3(matt[0]);
+ phi= saacos( dot_v3v3(vec, matt[0]) );
if(phi!=0.0) {
- Crossf(cross, vec, matt[0]); // results in z vector
- if(Inpf(cross, rv3d->twmat[2]) > 0.0) phi= -phi;
+ cross_v3_v3v3(cross, vec, matt[0]); // results in z vector
+ if(dot_v3v3(cross, rv3d->twmat[2]) > 0.0) phi= -phi;
gluPartialDisk(qobj, 0.0, 1.0, 32, 1, 180.0*startphi/M_PI, 180.0*(phi)/M_PI);
}
@@ -838,19 +838,19 @@ static void draw_manipulator_rotate_ghost(View3D *v3d, RegionView3D *rv3d, int d
/* correct for squeezed arc */
svec[1]+= tmat[2][1];
svec[2]+= tmat[2][2];
- Normalize(svec);
+ normalize_v3(svec);
startphi= (float)(M_PI + atan2(svec[2], -svec[1]));
}
else startphi= 0.0f;
VECCOPY(vec, rv3d->twmat[1]); // use y axis to detect rotation
- Normalize(vec);
- Normalize(matt[1]);
- phi= saacos( Inpf(vec, matt[1]) );
+ normalize_v3(vec);
+ normalize_v3(matt[1]);
+ phi= saacos( dot_v3v3(vec, matt[1]) );
if(phi!=0.0) {
- Crossf(cross, vec, matt[1]); // results in x vector
- if(Inpf(cross, rv3d->twmat[0]) > 0.0) phi= -phi;
+ cross_v3_v3v3(cross, vec, matt[1]); // results in x vector
+ if(dot_v3v3(cross, rv3d->twmat[0]) > 0.0) phi= -phi;
glRotatef(90.0, 0.0, 1.0, 0.0);
gluPartialDisk(qobj, 0.0, 1.0, 32, 1, 180.0*startphi/M_PI, 180.0*phi/M_PI);
glRotatef(-90.0, 0.0, 1.0, 0.0);
@@ -866,19 +866,19 @@ static void draw_manipulator_rotate_ghost(View3D *v3d, RegionView3D *rv3d, int d
/* correct for squeezed arc */
svec[0]+= tmat[2][0];
svec[2]+= tmat[2][2];
- Normalize(svec);
+ normalize_v3(svec);
startphi= (float)(M_PI + atan2(-svec[0], svec[2]));
}
else startphi= (float)M_PI;
VECCOPY(vec, rv3d->twmat[2]); // use z axis to detect rotation
- Normalize(vec);
- Normalize(matt[2]);
- phi= saacos( Inpf(vec, matt[2]) );
+ normalize_v3(vec);
+ normalize_v3(matt[2]);
+ phi= saacos( dot_v3v3(vec, matt[2]) );
if(phi!=0.0) {
- Crossf(cross, vec, matt[2]); // results in y vector
- if(Inpf(cross, rv3d->twmat[1]) > 0.0) phi= -phi;
+ cross_v3_v3v3(cross, vec, matt[2]); // results in y vector
+ if(dot_v3v3(cross, rv3d->twmat[1]) > 0.0) phi= -phi;
glRotatef(-90.0, 1.0, 0.0, 0.0);
gluPartialDisk(qobj, 0.0, 1.0, 32, 1, 180.0*startphi/M_PI, 180.0*phi/M_PI);
glRotatef(90.0, 1.0, 0.0, 0.0);
@@ -911,14 +911,14 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
/* Init stuff */
glDisable(GL_DEPTH_TEST);
- Mat4One(unitmat);
+ unit_m4(unitmat);
qobj= gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_FILL);
/* prepare for screen aligned draw */
VECCOPY(vec, rv3d->twmat[0]);
- size= Normalize(vec);
+ size= normalize_v3(vec);
glPushMatrix();
glTranslatef(rv3d->twmat[3][0], rv3d->twmat[3][1], rv3d->twmat[3][2]);
@@ -958,8 +958,8 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
vec[0]= 0; // XXX (float)(t->imval[0] - t->center2d[0]);
vec[1]= 0; // XXX (float)(t->imval[1] - t->center2d[1]);
vec[2]= 0.0f;
- Normalize(vec);
- VecMulf(vec, 1.2f*size);
+ normalize_v3(vec);
+ mul_v3_fl(vec, 1.2f*size);
glBegin(GL_LINES);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3fv(vec);
@@ -969,12 +969,12 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
glPopMatrix();
- ortho = IsMat4Orthogonal(rv3d->twmat);
+ ortho = is_orthogonal_m4(rv3d->twmat);
/* apply the transform delta */
if(moving) {
- Mat4CpyMat4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
- // XXX Mat4MulMat34(matt, t->mat, rv3d->twmat);
+ copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
+ // XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat);
if (ortho) {
wmMultMatrix(matt);
glFrontFace( is_mat4_flipped(matt)?GL_CW:GL_CCW);
@@ -1229,7 +1229,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
manipulator_setcolor(v3d, 'c', colcode);
glPushMatrix();
size= screen_aligned(rv3d, rv3d->twmat);
- Mat4One(unitmat);
+ unit_m4(unitmat);
drawcircball(GL_LINE_LOOP, unitmat[3], 0.2f*size, unitmat);
glPopMatrix();
@@ -1240,8 +1240,8 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
if(moving) {
float matt[4][4];
- Mat4CpyMat4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
- // XXX Mat4MulMat34(matt, t->mat, rv3d->twmat);
+ copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
+ // XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat);
wmMultMatrix(matt);
glFrontFace( is_mat4_flipped(matt)?GL_CW:GL_CCW);
}
@@ -1347,7 +1347,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int movi
manipulator_setcolor(v3d, 'c', colcode);
glPushMatrix();
size= screen_aligned(rv3d, rv3d->twmat);
- Mat4One(unitmat);
+ unit_m4(unitmat);
drawcircball(GL_LINE_LOOP, unitmat[3], 0.2f*size, unitmat);
glPopMatrix();
@@ -1420,7 +1420,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
/* Screen aligned view rot circle */
if(drawflags & MAN_ROT_V) {
float unitmat[4][4];
- Mat4One(unitmat);
+ unit_m4(unitmat);
if(G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
UI_ThemeColor(TH_TRANSFORM);
@@ -1431,8 +1431,8 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
vec[0]= 0; // XXX (float)(t->imval[0] - t->center2d[0]);
vec[1]= 0; // XXX (float)(t->imval[1] - t->center2d[1]);
vec[2]= 0.0f;
- Normalize(vec);
- VecMulf(vec, 1.2f*size);
+ normalize_v3(vec);
+ mul_v3_fl(vec, 1.2f*size);
glBegin(GL_LINES);
glVertex3f(0.0, 0.0, 0.0);
glVertex3fv(vec);
@@ -1444,9 +1444,9 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
/* apply the transform delta */
if(moving) {
float matt[4][4];
- Mat4CpyMat4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
+ copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
// XXX if (t->flag & T_USES_MANIPULATOR) {
- // XXX Mat4MulMat34(matt, t->mat, rv3d->twmat);
+ // XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat);
// XXX }
wmMultMatrix(matt);
}
@@ -1563,7 +1563,7 @@ void BIF_draw_manipulator(const bContext *C)
break;
}
- Mat4MulFloat3((float *)rv3d->twmat, get_manipulator_drawsize(ar));
+ mul_mat3_m4_fl((float *)rv3d->twmat, get_manipulator_drawsize(ar));
}
if(v3d->twflag & V3D_DRAW_MANIPULATOR) {
@@ -1622,7 +1622,7 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, short *mval, float ho
rect.ymax= mval[1]+hotspot;
setwinmatrixview3d(ar, v3d, &rect);
- Mat4MulMat4(rv3d->persmat, rv3d->viewmat, rv3d->winmat);
+ mul_m4_m4m4(rv3d->persmat, rv3d->viewmat, rv3d->winmat);
glSelectBuffer( 64, buffer);
glRenderMode(GL_SELECT);
@@ -1644,7 +1644,7 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, short *mval, float ho
G.f &= ~G_PICKSEL;
setwinmatrixview3d(ar, v3d, NULL);
- Mat4MulMat4(rv3d->persmat, rv3d->viewmat, rv3d->winmat);
+ mul_m4_m4m4(rv3d->persmat, rv3d->viewmat, rv3d->winmat);
if(hits==1) return buffer[3];
else if(hits>1) {
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 207cf4b9aee..3cb6700d679 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -32,7 +32,7 @@
#include "RNA_define.h"
#include "RNA_enum_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BKE_utildefines.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 0cb2515828d..463af961682 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -46,7 +46,7 @@
#include "BKE_context.h"
#include "BKE_report.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
@@ -160,8 +160,8 @@ TransformOrientation *createObjectSpace(bContext *C, ReportList *reports, char *
ob = base->object;
- Mat3CpyMat4(mat, ob->obmat);
- Mat3Ortho(mat);
+ copy_m3_m4(mat, ob->obmat);
+ normalize_m3(mat);
/* use object name if no name is given */
if (name[0] == 0)
@@ -246,20 +246,20 @@ int createSpaceNormal(float mat[3][3], float normal[3])
float tangent[3] = {0.0f, 0.0f, 1.0f};
VECCOPY(mat[2], normal);
- if (Normalize(mat[2]) == 0.0f) {
+ if (normalize_v3(mat[2]) == 0.0f) {
return 0; /* error return */
}
- Crossf(mat[0], mat[2], tangent);
- if (Inpf(mat[0], mat[0]) == 0.0f) {
+ cross_v3_v3v3(mat[0], mat[2], tangent);
+ if (dot_v3v3(mat[0], mat[0]) == 0.0f) {
tangent[0] = 1.0f;
tangent[1] = tangent[2] = 0.0f;
- Crossf(mat[0], tangent, mat[2]);
+ cross_v3_v3v3(mat[0], tangent, mat[2]);
}
- Crossf(mat[1], mat[2], mat[0]);
+ cross_v3_v3v3(mat[1], mat[2], mat[0]);
- Mat3Ortho(mat);
+ normalize_m3(mat);
return 1;
}
@@ -267,7 +267,7 @@ int createSpaceNormal(float mat[3][3], float normal[3])
int createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3])
{
VECCOPY(mat[2], normal);
- if (Normalize(mat[2]) == 0.0f) {
+ if (normalize_v3(mat[2]) == 0.0f) {
return 0; /* error return */
}
@@ -277,14 +277,14 @@ int createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3])
tangent[2] = 1;
}
- Crossf(mat[0], mat[2], tangent);
- if (Normalize(mat[0]) == 0.0f) {
+ cross_v3_v3v3(mat[0], mat[2], tangent);
+ if (normalize_v3(mat[0]) == 0.0f) {
return 0; /* error return */
}
- Crossf(mat[1], mat[2], mat[0]);
+ cross_v3_v3v3(mat[1], mat[2], mat[0]);
- Mat3Ortho(mat);
+ normalize_m3(mat);
return 1;
}
@@ -311,7 +311,7 @@ TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[],
}
/* copy matrix into transform space */
- Mat3CpyMat3(ts->mat, mat);
+ copy_m3_m3(ts->mat, mat);
return ts;
}
@@ -479,7 +479,7 @@ void applyTransformOrientation(const bContext *C, float mat[3][3], char *name) {
if (name)
strcpy(name, ts->name);
- Mat3CpyMat3(mat, ts->mat);
+ copy_m3_m3(mat, ts->mat);
break;
}
}
@@ -522,7 +522,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
break;
case V3D_MANIP_GIMBAL:
- Mat3One(t->spacemtx);
+ unit_m3(t->spacemtx);
if(ob)
gimbal_axis(ob, t->spacemtx);
break;
@@ -537,10 +537,10 @@ void initTransformOrientation(bContext *C, TransInfo *t)
strcpy(t->spacename, "local");
if(ob) {
- Mat3CpyMat4(t->spacemtx, ob->obmat);
- Mat3Ortho(t->spacemtx);
+ copy_m3_m4(t->spacemtx, ob->obmat);
+ normalize_m3(t->spacemtx);
} else {
- Mat3One(t->spacemtx);
+ unit_m3(t->spacemtx);
}
break;
@@ -552,13 +552,13 @@ void initTransformOrientation(bContext *C, TransInfo *t)
float mat[3][3];
strcpy(t->spacename, "view");
- Mat3CpyMat4(mat, rv3d->viewinv);
- Mat3Ortho(mat);
- Mat3CpyMat3(t->spacemtx, mat);
+ copy_m3_m4(mat, rv3d->viewinv);
+ normalize_m3(mat);
+ copy_m3_m3(t->spacemtx, mat);
}
else
{
- Mat3One(t->spacemtx);
+ unit_m3(t->spacemtx);
}
break;
default: /* V3D_MANIP_CUSTOM */
@@ -584,10 +584,10 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
float imat[3][3], mat[3][3];
/* we need the transpose of the inverse for a normal... */
- Mat3CpyMat4(imat, ob->obmat);
+ copy_m3_m4(imat, ob->obmat);
- Mat3Inv(mat, imat);
- Mat3Transp(mat);
+ invert_m3_m3(mat, imat);
+ transpose_m3(mat);
ob= obedit;
@@ -629,7 +629,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
if(efa->f & SELECT)
{
VECADD(normal, normal, efa->n);
- VecSubf(vec, efa->v2->co, efa->v1->co);
+ sub_v3_v3v3(vec, efa->v2->co, efa->v1->co);
VECADD(plane, plane, vec);
}
}
@@ -653,9 +653,9 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
else {
v3 = eve;
- VecSubf(plane, v2->co, v1->co);
- VecSubf(cotangent, v3->co, v2->co);
- Crossf(normal, cotangent, plane);
+ sub_v3_v3v3(plane, v2->co, v1->co);
+ sub_v3_v3v3(cotangent, v3->co, v2->co);
+ cross_v3_v3v3(normal, cotangent, plane);
break;
}
}
@@ -668,7 +668,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
for(eed= em->edges.first; eed; eed= eed->next) {
if(eed->f & SELECT) {
- VecSubf(plane, eed->v2->co, eed->v1->co);
+ sub_v3_v3v3(plane, eed->v2->co, eed->v1->co);
break;
}
}
@@ -685,7 +685,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
/* use average vert normals as plane and edge vector as normal */
VECCOPY(plane, eed->v1->no);
VECADD(plane, plane, eed->v2->no);
- VecSubf(normal, eed->v2->co, eed->v1->co);
+ sub_v3_v3v3(normal, eed->v2->co, eed->v1->co);
break;
}
}
@@ -706,7 +706,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
VECCOPY(plane, v1->no);
VECADD(plane, plane, v2->no);
- VecSubf(normal, v2->co, v1->co);
+ sub_v3_v3v3(normal, v2->co, v1->co);
break;
}
}
@@ -731,10 +731,10 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
for (eve = em->verts.first; eve; eve = eve->next)
{
if ( eve->f & SELECT ) {
- VecAddf(normal, normal, eve->no);
+ add_v3_v3v3(normal, normal, eve->no);
}
}
- Normalize(normal);
+ normalize_v3(normal);
result = ORIENTATION_VERT;
}
}
@@ -758,21 +758,21 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
/* exception */
if ( (bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT )
{
- VecSubf(normal, bezt->vec[0], bezt->vec[2]);
+ sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[2]);
}
else
{
if(bezt->f1)
{
- VecSubf(normal, bezt->vec[0], bezt->vec[1]);
+ sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[1]);
}
if(bezt->f2)
{
- VecSubf(normal, bezt->vec[0], bezt->vec[2]);
+ sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[2]);
}
if(bezt->f3)
{
- VecSubf(normal, bezt->vec[1], bezt->vec[2]);
+ sub_v3_v3v3(normal, bezt->vec[1], bezt->vec[2]);
}
}
bezt++;
@@ -813,12 +813,12 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
float mat[4][4];
/* Rotation of MetaElem is stored in quat */
- QuatToMat4(ml_sel->quat, mat);
+ quat_to_mat4( mat,ml_sel->quat);
VECCOPY(normal, mat[2]);
VECCOPY(plane, mat[1]);
- VecMulf(plane, -1.0);
+ mul_v3_fl(plane, -1.0);
result = ORIENTATION_NORMAL;
}
@@ -837,18 +837,18 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
{
float mat[3][3];
float vec[3];
- VecSubf(vec, ebone->tail, ebone->head);
- Normalize(vec);
- VecAddf(normal, normal, vec);
+ sub_v3_v3v3(vec, ebone->tail, ebone->head);
+ normalize_v3(vec);
+ add_v3_v3v3(normal, normal, vec);
vec_roll_to_mat3(vec, ebone->roll, mat);
- VecAddf(plane, plane, mat[2]);
+ add_v3_v3v3(plane, plane, mat[2]);
}
}
}
- Normalize(normal);
- Normalize(plane);
+ normalize_v3(normal);
+ normalize_v3(plane);
if (plane[0] != 0 || plane[1] != 0 || plane[2] != 0)
{
@@ -860,13 +860,13 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
/* Vectors from edges don't need the special transpose inverse multiplication */
if (result == ORIENTATION_EDGE)
{
- Mat4Mul3Vecfl(ob->obmat, normal);
- Mat4Mul3Vecfl(ob->obmat, plane);
+ mul_mat3_m4_v3(ob->obmat, normal);
+ mul_mat3_m4_v3(ob->obmat, plane);
}
else
{
- Mat3MulVecfl(mat, normal);
- Mat3MulVecfl(mat, plane);
+ mul_m3_v3(mat, normal);
+ mul_m3_v3(mat, plane);
}
}
else if(ob && (ob->mode & OB_MODE_POSE))
@@ -882,19 +882,19 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
/* use channels to get stats */
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if (pchan->bone && pchan->bone->flag & BONE_TRANSFORM) {
- VecAddf(normal, normal, pchan->pose_mat[2]);
- VecAddf(plane, plane, pchan->pose_mat[1]);
+ add_v3_v3v3(normal, normal, pchan->pose_mat[2]);
+ add_v3_v3v3(plane, plane, pchan->pose_mat[1]);
}
}
- VecMulf(plane, -1.0);
+ mul_v3_fl(plane, -1.0);
/* we need the transpose of the inverse for a normal... */
- Mat3CpyMat4(imat, ob->obmat);
+ copy_m3_m4(imat, ob->obmat);
- Mat3Inv(mat, imat);
- Mat3Transp(mat);
- Mat3MulVecfl(mat, normal);
- Mat3MulVecfl(mat, plane);
+ invert_m3_m3(mat, imat);
+ transpose_m3(mat);
+ mul_m3_v3(mat, normal);
+ mul_m3_v3(mat, plane);
result = ORIENTATION_EDGE;
}
@@ -963,6 +963,6 @@ void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[]
if (type == ORIENTATION_NONE)
{
- Mat3One(orientation_mat);
+ unit_m3(orientation_mat);
}
}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 1d26649fea2..1cbfcc55911 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -47,7 +47,7 @@
#include "RNA_access.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_blenlib.h"
@@ -145,8 +145,8 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
size *= 0.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
- Mat4CpyMat4(tmat, rv3d->viewmat);
- Mat4Invert(imat, tmat);
+ copy_m4_m4(tmat, rv3d->viewmat);
+ invert_m4_m4(imat, tmat);
drawcircball(GL_LINE_LOOP, t->tsnap.snapPoint, size, imat);
@@ -229,7 +229,7 @@ void applyProject(TransInfo *t)
if(t->flag & (T_EDIT|T_POSE)) {
Object *ob = t->obedit?t->obedit:t->poseobj;
- Mat4Invert(imat, ob->obmat);
+ invert_m4_m4(imat, ob->obmat);
}
for(i = 0 ; i < t->total; i++, td++) {
@@ -247,7 +247,7 @@ void applyProject(TransInfo *t)
if (t->flag & (T_EDIT|T_POSE))
{
Object *ob = t->obedit?t->obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, iloc);
+ mul_m4_v3(ob->obmat, iloc);
}
else if (t->flag & T_OBJECT)
{
@@ -259,14 +259,14 @@ void applyProject(TransInfo *t)
if (snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.mode))
{
// if(t->flag & (T_EDIT|T_POSE)) {
-// Mat4MulVecfl(imat, loc);
+// mul_m4_v3(imat, loc);
// }
//
- VecSubf(tvec, loc, iloc);
+ sub_v3_v3v3(tvec, loc, iloc);
- Mat3MulVecfl(td->smtx, tvec);
+ mul_m3_v3(td->smtx, tvec);
- VecAddf(td->loc, td->loc, tvec);
+ add_v3_v3v3(td->loc, td->loc, tvec);
}
//XXX constraintTransLim(t, td);
@@ -331,7 +331,7 @@ int validSnappingNormal(TransInfo *t)
{
if ((t->tsnap.status & (POINT_INIT|TARGET_INIT)) == (POINT_INIT|TARGET_INIT))
{
- if (Inpf(t->tsnap.snapNormal, t->tsnap.snapNormal) > 0)
+ if (dot_v3v3(t->tsnap.snapNormal, t->tsnap.snapNormal) > 0)
{
return 1;
}
@@ -365,7 +365,7 @@ void initSnapping(TransInfo *t, wmOperator *op)
{
t->tsnap.align = RNA_boolean_get(op->ptr, "snap_align");
RNA_float_get_array(op->ptr, "snap_normal", t->tsnap.snapNormal);
- Normalize(t->tsnap.snapNormal);
+ normalize_v3(t->tsnap.snapNormal);
}
if (RNA_struct_find_property(op->ptr, "snap_project"))
@@ -500,7 +500,7 @@ void setSnappingCallback(TransInfo *t, short snap_target)
void ApplySnapTranslation(TransInfo *t, float vec[3])
{
- VecSubf(vec, t->tsnap.snapPoint, t->tsnap.snapTarget);
+ sub_v3_v3v3(vec, t->tsnap.snapPoint, t->tsnap.snapTarget);
}
void ApplySnapRotation(TransInfo *t, float *vec)
@@ -527,7 +527,7 @@ void ApplySnapResize(TransInfo *t, float vec[3])
float TranslationBetween(TransInfo *t, float p1[3], float p2[3])
{
- return VecLenf(p1, p2);
+ return len_v3v3(p1, p2);
}
float RotationBetween(TransInfo *t, float p1[3], float p2[3])
@@ -537,11 +537,11 @@ float RotationBetween(TransInfo *t, float p1[3], float p2[3])
VECCOPY(center, t->center);
if(t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, center);
+ mul_m4_v3(ob->obmat, center);
}
- VecSubf(start, p1, center);
- VecSubf(end, p2, center);
+ sub_v3_v3v3(start, p1, center);
+ sub_v3_v3v3(end, p2, center);
// Angle around a constraint axis (error prone, will need debug)
if (t->con.applyRot != NULL && (t->con.mode & CON_APPLY)) {
@@ -549,29 +549,29 @@ float RotationBetween(TransInfo *t, float p1[3], float p2[3])
t->con.applyRot(t, NULL, axis, NULL);
- Projf(tmp, end, axis);
- VecSubf(end, end, tmp);
+ project_v3_v3v3(tmp, end, axis);
+ sub_v3_v3v3(end, end, tmp);
- Projf(tmp, start, axis);
- VecSubf(start, start, tmp);
+ project_v3_v3v3(tmp, start, axis);
+ sub_v3_v3v3(start, start, tmp);
- Normalize(end);
- Normalize(start);
+ normalize_v3(end);
+ normalize_v3(start);
- Crossf(tmp, start, end);
+ cross_v3_v3v3(tmp, start, end);
- if (Inpf(tmp, axis) < 0.0)
- angle = -acos(Inpf(start, end));
+ if (dot_v3v3(tmp, axis) < 0.0)
+ angle = -acos(dot_v3v3(start, end));
else
- angle = acos(Inpf(start, end));
+ angle = acos(dot_v3v3(start, end));
}
else {
float mtx[3][3];
- Mat3CpyMat4(mtx, t->viewmat);
+ copy_m3_m4(mtx, t->viewmat);
- Mat3MulVecfl(mtx, end);
- Mat3MulVecfl(mtx, start);
+ mul_m3_v3(mtx, end);
+ mul_m3_v3(mtx, start);
angle = atan2(start[1],start[0]) - atan2(end[1],end[0]);
}
@@ -593,18 +593,18 @@ float ResizeBetween(TransInfo *t, float p1[3], float p2[3])
VECCOPY(center, t->center);
if(t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, center);
+ mul_m4_v3(ob->obmat, center);
}
- VecSubf(d1, p1, center);
- VecSubf(d2, p2, center);
+ sub_v3_v3v3(d1, p1, center);
+ sub_v3_v3v3(d2, p2, center);
if (t->con.applyRot != NULL && (t->con.mode & CON_APPLY)) {
- Mat3MulVecfl(t->con.pmtx, d1);
- Mat3MulVecfl(t->con.pmtx, d2);
+ mul_m3_v3(t->con.pmtx, d1);
+ mul_m3_v3(t->con.pmtx, d2);
}
- return VecLength(d2) / VecLength(d1);
+ return len_v3(d2) / len_v3(d1);
}
/********************** CALC **************************/
@@ -685,8 +685,8 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
{
p2->flag = 1;
- VecAddf(vec, p1->p, p2->p);
- VecMulf(vec, 0.5f);
+ add_v3_v3v3(vec, p1->p, p2->p);
+ mul_v3_fl(vec, 0.5f);
}
else
{
@@ -700,7 +700,7 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
break;
}
- new_dist = VecLenf(last_p, vec);
+ new_dist = len_v3v3(last_p, vec);
if (new_dist < dist)
{
@@ -727,10 +727,10 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
{
float tangent[3];
- VecSubf(tangent, loc, t->tsnap.snapPoint);
+ sub_v3_v3v3(tangent, loc, t->tsnap.snapPoint);
tangent[2] = 0;
- if (Inpf(tangent, tangent) > 0)
+ if (dot_v3v3(tangent, tangent) > 0)
{
VECCOPY(t->tsnap.snapTangent, tangent);
}
@@ -759,7 +759,7 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
t->tsnap.snapPoint[0] *= aspx;
t->tsnap.snapPoint[1] *= aspy;
- Mat4MulVecfl(t->obedit->obmat, t->tsnap.snapPoint);
+ mul_m4_v3(t->obedit->obmat, t->tsnap.snapPoint);
t->tsnap.status |= POINT_INIT;
}
@@ -780,7 +780,7 @@ void TargetSnapCenter(TransInfo *t)
VECCOPY(t->tsnap.snapTarget, t->center);
if(t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, t->tsnap.snapTarget);
+ mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
}
t->tsnap.status |= TARGET_INIT;
@@ -811,7 +811,7 @@ void TargetSnapActive(TransInfo *t)
if(t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, t->tsnap.snapTarget);
+ mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
}
t->tsnap.status |= TARGET_INIT;
@@ -840,14 +840,14 @@ void TargetSnapMedian(TransInfo *t)
for(td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
{
- VecAddf(t->tsnap.snapTarget, t->tsnap.snapTarget, td->center);
+ add_v3_v3v3(t->tsnap.snapTarget, t->tsnap.snapTarget, td->center);
}
- VecMulf(t->tsnap.snapTarget, 1.0 / i);
+ mul_v3_fl(t->tsnap.snapTarget, 1.0 / i);
if(t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, t->tsnap.snapTarget);
+ mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
}
t->tsnap.status |= TARGET_INIT;
@@ -879,7 +879,7 @@ void TargetSnapClosest(TransInfo *t)
float dist;
VECCOPY(loc, bb->vec[j]);
- Mat4MulVecfl(td->ext->obmat, loc);
+ mul_m4_v3(td->ext->obmat, loc);
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
@@ -922,7 +922,7 @@ void TargetSnapClosest(TransInfo *t)
if(t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
- Mat4MulVecfl(ob->obmat, loc);
+ mul_m4_v3(ob->obmat, loc);
}
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
@@ -947,7 +947,7 @@ int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], float *v4
int result;
int retval = 0;
- result = RayIntersectsTriangleThreshold(ray_start_local, ray_normal_local, v1co, v2co, v3co, &lambda, NULL, 0.001);
+ result = isect_ray_tri_threshold_v3(ray_start_local, ray_normal_local, v1co, v2co, v3co, &lambda, NULL, 0.001);
if (result) {
float location[3], normal[3];
@@ -957,19 +957,19 @@ int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], float *v4
int new_dist;
VECCOPY(intersect, ray_normal_local);
- VecMulf(intersect, lambda);
- VecAddf(intersect, intersect, ray_start_local);
+ mul_v3_fl(intersect, lambda);
+ add_v3_v3v3(intersect, intersect, ray_start_local);
VECCOPY(location, intersect);
if (v4co)
- CalcNormFloat4(v1co, v2co, v3co, v4co, normal);
+ normal_quad_v3( normal,v1co, v2co, v3co, v4co);
else
- CalcNormFloat(v1co, v2co, v3co, normal);
+ normal_tri_v3( normal,v1co, v2co, v3co);
- Mat4MulVecfl(obmat, location);
+ mul_m4_v3(obmat, location);
- new_depth = VecLenf(location, ray_start);
+ new_depth = len_v3v3(location, ray_start);
project_int(ar, location, screen_loc);
new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]);
@@ -982,8 +982,8 @@ int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], float *v4
VECCOPY(loc, location);
VECCOPY(no, normal);
- Mat3MulVecfl(timat, no);
- Normalize(no);
+ mul_m3_v3(timat, no);
+ normalize_v3(no);
*dist = new_dist;
}
@@ -999,10 +999,10 @@ int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2n
int retval = 0;
VECCOPY(ray_end, ray_normal_local);
- VecMulf(ray_end, 2000);
- VecAddf(ray_end, ray_start_local, ray_end);
+ mul_v3_fl(ray_end, 2000);
+ add_v3_v3v3(ray_end, ray_start_local, ray_end);
- result = LineIntersectLine(v1co, v2co, ray_start_local, ray_end, intersect, dvec); /* dvec used but we don't care about result */
+ result = isect_line_line_v3(v1co, v2co, ray_start_local, ray_end, intersect, dvec); /* dvec used but we don't care about result */
if (result)
{
@@ -1010,12 +1010,12 @@ int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2n
float mul;
/* check for behind ray_start */
- VecSubf(dvec, intersect, ray_start_local);
+ sub_v3_v3v3(dvec, intersect, ray_start_local);
- VecSubf(edge_loc, v1co, v2co);
- VecSubf(vec, intersect, v2co);
+ sub_v3_v3v3(edge_loc, v1co, v2co);
+ sub_v3_v3v3(vec, intersect, v2co);
- mul = Inpf(vec, edge_loc) / Inpf(edge_loc, edge_loc);
+ mul = dot_v3v3(vec, edge_loc) / dot_v3v3(edge_loc, edge_loc);
if (mul > 1) {
mul = 1;
@@ -1026,7 +1026,7 @@ int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2n
VECCOPY(intersect, v2co);
}
- if (Inpf(ray_normal_local, dvec) > 0)
+ if (dot_v3v3(ray_normal_local, dvec) > 0)
{
float location[3];
float new_depth;
@@ -1035,9 +1035,9 @@ int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2n
VECCOPY(location, intersect);
- Mat4MulVecfl(obmat, location);
+ mul_m4_v3(obmat, location);
- new_depth = VecLenf(location, ray_start);
+ new_depth = len_v3v3(location, ray_start);
project_int(ar, location, screen_loc);
new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]);
@@ -1053,18 +1053,18 @@ int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2n
*depth = new_depth;
retval = 1;
- VecSubf(edge_loc, v1co, v2co);
- VecSubf(vec, intersect, v2co);
+ sub_v3_v3v3(edge_loc, v1co, v2co);
+ sub_v3_v3v3(vec, intersect, v2co);
- mul = Inpf(vec, edge_loc) / Inpf(edge_loc, edge_loc);
+ mul = dot_v3v3(vec, edge_loc) / dot_v3v3(edge_loc, edge_loc);
if (no)
{
- NormalShortToFloat(n1, v1no);
- NormalShortToFloat(n2, v2no);
- VecLerpf(no, n2, n1, mul);
- Mat3MulVecfl(timat, no);
- Normalize(no);
+ normal_short_to_float_v3(n1, v1no);
+ normal_short_to_float_v3(n2, v2no);
+ interp_v3_v3v3(no, n2, n1, mul);
+ mul_m3_v3(timat, no);
+ normalize_v3(no);
}
VECCOPY(loc, location);
@@ -1082,9 +1082,9 @@ int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], float ray
int retval = 0;
float dvec[3];
- VecSubf(dvec, vco, ray_start_local);
+ sub_v3_v3v3(dvec, vco, ray_start_local);
- if (Inpf(ray_normal_local, dvec) > 0)
+ if (dot_v3v3(ray_normal_local, dvec) > 0)
{
float location[3];
float new_depth;
@@ -1093,9 +1093,9 @@ int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], float ray
VECCOPY(location, vco);
- Mat4MulVecfl(obmat, location);
+ mul_m4_v3(obmat, location);
- new_depth = VecLenf(location, ray_start);
+ new_depth = len_v3v3(location, ray_start);
project_int(ar, location, screen_loc);
new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]);
@@ -1109,9 +1109,9 @@ int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], float ray
if (no)
{
- NormalShortToFloat(no, vno);
- Mat3MulVecfl(timat, no);
- Normalize(no);
+ normal_short_to_float_v3(no, vno);
+ mul_m3_v3(timat, no);
+ normalize_v3(no);
}
*dist = new_dist;
@@ -1127,13 +1127,13 @@ int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float
float ray_start_local[3], ray_normal_local[3];
int retval = 0;
- Mat4Invert(imat, obmat);
+ invert_m4_m4(imat, obmat);
VECCOPY(ray_start_local, ray_start);
VECCOPY(ray_normal_local, ray_normal);
- Mat4MulVecfl(imat, ray_start_local);
- Mat4Mul3Vecfl(imat, ray_normal_local);
+ mul_m4_v3(imat, ray_start_local);
+ mul_mat3_m4_v3(imat, ray_normal_local);
if(arm->edbo)
{
@@ -1198,16 +1198,16 @@ int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, E
float ray_start_local[3], ray_normal_local[3];
int test = 1;
- Mat4Invert(imat, obmat);
+ invert_m4_m4(imat, obmat);
- Mat3CpyMat4(timat, imat);
- Mat3Transp(timat);
+ copy_m3_m4(timat, imat);
+ transpose_m3(timat);
VECCOPY(ray_start_local, ray_start);
VECCOPY(ray_normal_local, ray_normal);
- Mat4MulVecfl(imat, ray_start_local);
- Mat4Mul3Vecfl(imat, ray_normal_local);
+ mul_m4_v3(imat, ray_start_local);
+ mul_mat3_m4_v3(imat, ray_normal_local);
/* If number of vert is more than an arbitrary limit,
@@ -1587,16 +1587,16 @@ int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_sta
float ray_start_local[3], ray_normal_local[3];
int test = 1;
- Mat4Invert(imat, obmat);
+ invert_m4_m4(imat, obmat);
- Mat3CpyMat4(timat, imat);
- Mat3Transp(timat);
+ copy_m3_m4(timat, imat);
+ transpose_m3(timat);
VECCOPY(ray_start_local, ray_start);
VECCOPY(ray_normal_local, ray_normal);
- Mat4MulVecfl(imat, ray_start_local);
- Mat4Mul3Vecfl(imat, ray_normal_local);
+ mul_m4_v3(imat, ray_start_local);
+ mul_mat3_m4_v3(imat, ray_normal_local);
/* If number of vert is more than an arbitrary limit,
@@ -1618,7 +1618,7 @@ int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_sta
int result;
- result = RayIntersectsTriangleThreshold(ray_start_local, ray_normal_local, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, &lambda, NULL, 0.001);
+ result = isect_ray_tri_threshold_v3(ray_start_local, ray_normal_local, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, &lambda, NULL, 0.001);
if (result) {
float location[3], normal[3];
@@ -1626,29 +1626,29 @@ int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_sta
float new_depth;
VECCOPY(intersect, ray_normal_local);
- VecMulf(intersect, lambda);
- VecAddf(intersect, intersect, ray_start_local);
+ mul_v3_fl(intersect, lambda);
+ add_v3_v3v3(intersect, intersect, ray_start_local);
VECCOPY(location, intersect);
if (f->v4)
- CalcNormFloat4(verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co, normal);
+ normal_quad_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co);
else
- CalcNormFloat(verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, normal);
+ normal_tri_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co);
- Mat4MulVecfl(obmat, location);
+ mul_m4_v3(obmat, location);
- new_depth = VecLenf(location, ray_start);
+ new_depth = len_v3v3(location, ray_start);
- Mat3MulVecfl(timat, normal);
- Normalize(normal);
+ mul_m3_v3(timat, normal);
+ normalize_v3(normal);
addDepthPeel(depth_peels, new_depth, location, normal, ob);
}
if (f->v4 && result == 0)
{
- result = RayIntersectsTriangleThreshold(ray_start_local, ray_normal_local, verts[f->v3].co, verts[f->v4].co, verts[f->v1].co, &lambda, NULL, 0.001);
+ result = isect_ray_tri_threshold_v3(ray_start_local, ray_normal_local, verts[f->v3].co, verts[f->v4].co, verts[f->v1].co, &lambda, NULL, 0.001);
if (result) {
float location[3], normal[3];
@@ -1656,22 +1656,22 @@ int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_sta
float new_depth;
VECCOPY(intersect, ray_normal_local);
- VecMulf(intersect, lambda);
- VecAddf(intersect, intersect, ray_start_local);
+ mul_v3_fl(intersect, lambda);
+ add_v3_v3v3(intersect, intersect, ray_start_local);
VECCOPY(location, intersect);
if (f->v4)
- CalcNormFloat4(verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co, normal);
+ normal_quad_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co);
else
- CalcNormFloat(verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, normal);
+ normal_tri_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co);
- Mat4MulVecfl(obmat, location);
+ mul_m4_v3(obmat, location);
- new_depth = VecLenf(location, ray_start);
+ new_depth = len_v3v3(location, ray_start);
- Mat3MulVecfl(timat, normal);
- Normalize(normal);
+ mul_m3_v3(timat, normal);
+ normalize_v3(normal);
addDepthPeel(depth_peels, new_depth, location, normal, ob);
}
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index fbd12007c16..c5dccc14b03 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -42,7 +42,7 @@
#include "BKE_object.h"
#include "BKE_utildefines.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BIF_gl.h"
@@ -251,44 +251,44 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac
if(efa->v4) {
#if 0 /* Simple but slow, better reuse normalized vectors */
- uvang1 = RAD2DEG(Vec2Angle3(tf_uv[3], tf_uv[0], tf_uv[1]));
- ang1 = RAD2DEG(VecAngle3(efa->v4->co, efa->v1->co, efa->v2->co));
+ uvang1 = RAD2DEG(angle_v2v2v2(tf_uv[3], tf_uv[0], tf_uv[1]));
+ ang1 = RAD2DEG(angle_v3v3v3(efa->v4->co, efa->v1->co, efa->v2->co));
- uvang2 = RAD2DEG(Vec2Angle3(tf_uv[0], tf_uv[1], tf_uv[2]));
- ang2 = RAD2DEG(VecAngle3(efa->v1->co, efa->v2->co, efa->v3->co));
+ uvang2 = RAD2DEG(angle_v2v2v2(tf_uv[0], tf_uv[1], tf_uv[2]));
+ ang2 = RAD2DEG(angle_v3v3v3(efa->v1->co, efa->v2->co, efa->v3->co));
- uvang3 = RAD2DEG(Vec2Angle3(tf_uv[1], tf_uv[2], tf_uv[3]));
- ang3 = RAD2DEG(VecAngle3(efa->v2->co, efa->v3->co, efa->v4->co));
+ uvang3 = RAD2DEG(angle_v2v2v2(tf_uv[1], tf_uv[2], tf_uv[3]));
+ ang3 = RAD2DEG(angle_v3v3v3(efa->v2->co, efa->v3->co, efa->v4->co));
- uvang4 = RAD2DEG(Vec2Angle3(tf_uv[2], tf_uv[3], tf_uv[0]));
- ang4 = RAD2DEG(VecAngle3(efa->v3->co, efa->v4->co, efa->v1->co));
+ uvang4 = RAD2DEG(angle_v2v2v2(tf_uv[2], tf_uv[3], tf_uv[0]));
+ ang4 = RAD2DEG(angle_v3v3v3(efa->v3->co, efa->v4->co, efa->v1->co));
#endif
/* uv angles */
- VECSUB2D(av1, tf_uv[3], tf_uv[0]); Normalize2(av1);
- VECSUB2D(av2, tf_uv[0], tf_uv[1]); Normalize2(av2);
- VECSUB2D(av3, tf_uv[1], tf_uv[2]); Normalize2(av3);
- VECSUB2D(av4, tf_uv[2], tf_uv[3]); Normalize2(av4);
+ VECSUB2D(av1, tf_uv[3], tf_uv[0]); normalize_v2(av1);
+ VECSUB2D(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2);
+ VECSUB2D(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3);
+ VECSUB2D(av4, tf_uv[2], tf_uv[3]); normalize_v2(av4);
/* This is the correct angle however we are only comparing angles
- * uvang1 = 90-((NormalizedVecAngle2_2D(av1, av2) * 180.0/M_PI)-90);*/
- uvang1 = NormalizedVecAngle2_2D(av1, av2)*180.0/M_PI;
- uvang2 = NormalizedVecAngle2_2D(av2, av3)*180.0/M_PI;
- uvang3 = NormalizedVecAngle2_2D(av3, av4)*180.0/M_PI;
- uvang4 = NormalizedVecAngle2_2D(av4, av1)*180.0/M_PI;
+ * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90);*/
+ uvang1 = angle_normalized_v2v2(av1, av2)*180.0/M_PI;
+ uvang2 = angle_normalized_v2v2(av2, av3)*180.0/M_PI;
+ uvang3 = angle_normalized_v2v2(av3, av4)*180.0/M_PI;
+ uvang4 = angle_normalized_v2v2(av4, av1)*180.0/M_PI;
/* 3d angles */
- VECSUB(av1, efa->v4->co, efa->v1->co); Normalize(av1);
- VECSUB(av2, efa->v1->co, efa->v2->co); Normalize(av2);
- VECSUB(av3, efa->v2->co, efa->v3->co); Normalize(av3);
- VECSUB(av4, efa->v3->co, efa->v4->co); Normalize(av4);
+ VECSUB(av1, efa->v4->co, efa->v1->co); normalize_v3(av1);
+ VECSUB(av2, efa->v1->co, efa->v2->co); normalize_v3(av2);
+ VECSUB(av3, efa->v2->co, efa->v3->co); normalize_v3(av3);
+ VECSUB(av4, efa->v3->co, efa->v4->co); normalize_v3(av4);
/* This is the correct angle however we are only comparing angles
- * ang1 = 90-((NormalizedVecAngle2(av1, av2) * 180.0/M_PI)-90);*/
- ang1 = NormalizedVecAngle2(av1, av2)*180.0/M_PI;
- ang2 = NormalizedVecAngle2(av2, av3)*180.0/M_PI;
- ang3 = NormalizedVecAngle2(av3, av4)*180.0/M_PI;
- ang4 = NormalizedVecAngle2(av4, av1)*180.0/M_PI;
+ * ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90);*/
+ ang1 = angle_normalized_v3v3(av1, av2)*180.0/M_PI;
+ ang2 = angle_normalized_v3v3(av2, av3)*180.0/M_PI;
+ ang3 = angle_normalized_v3v3(av3, av4)*180.0/M_PI;
+ ang4 = angle_normalized_v3v3(av4, av1)*180.0/M_PI;
glBegin(GL_QUADS);
@@ -315,36 +315,36 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac
}
else {
#if 0 /* Simple but slow, better reuse normalized vectors */
- uvang1 = RAD2DEG(Vec2Angle3(tf_uv[2], tf_uv[0], tf_uv[1]));
- ang1 = RAD2DEG(VecAngle3(efa->v3->co, efa->v1->co, efa->v2->co));
+ uvang1 = RAD2DEG(angle_v2v2v2(tf_uv[2], tf_uv[0], tf_uv[1]));
+ ang1 = RAD2DEG(angle_v3v3v3(efa->v3->co, efa->v1->co, efa->v2->co));
- uvang2 = RAD2DEG(Vec2Angle3(tf_uv[0], tf_uv[1], tf_uv[2]));
- ang2 = RAD2DEG(VecAngle3(efa->v1->co, efa->v2->co, efa->v3->co));
+ uvang2 = RAD2DEG(angle_v2v2v2(tf_uv[0], tf_uv[1], tf_uv[2]));
+ ang2 = RAD2DEG(angle_v3v3v3(efa->v1->co, efa->v2->co, efa->v3->co));
uvang3 = M_PI-(uvang1+uvang2);
ang3 = M_PI-(ang1+ang2);
#endif
/* uv angles */
- VECSUB2D(av1, tf_uv[2], tf_uv[0]); Normalize2(av1);
- VECSUB2D(av2, tf_uv[0], tf_uv[1]); Normalize2(av2);
- VECSUB2D(av3, tf_uv[1], tf_uv[2]); Normalize2(av3);
+ VECSUB2D(av1, tf_uv[2], tf_uv[0]); normalize_v2(av1);
+ VECSUB2D(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2);
+ VECSUB2D(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3);
/* This is the correct angle however we are only comparing angles
- * uvang1 = 90-((NormalizedVecAngle2_2D(av1, av2) * 180.0/M_PI)-90); */
- uvang1 = NormalizedVecAngle2_2D(av1, av2)*180.0/M_PI;
- uvang2 = NormalizedVecAngle2_2D(av2, av3)*180.0/M_PI;
- uvang3 = NormalizedVecAngle2_2D(av3, av1)*180.0/M_PI;
+ * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90); */
+ uvang1 = angle_normalized_v2v2(av1, av2)*180.0/M_PI;
+ uvang2 = angle_normalized_v2v2(av2, av3)*180.0/M_PI;
+ uvang3 = angle_normalized_v2v2(av3, av1)*180.0/M_PI;
/* 3d angles */
- VECSUB(av1, efa->v3->co, efa->v1->co); Normalize(av1);
- VECSUB(av2, efa->v1->co, efa->v2->co); Normalize(av2);
- VECSUB(av3, efa->v2->co, efa->v3->co); Normalize(av3);
+ VECSUB(av1, efa->v3->co, efa->v1->co); normalize_v3(av1);
+ VECSUB(av2, efa->v1->co, efa->v2->co); normalize_v3(av2);
+ VECSUB(av3, efa->v2->co, efa->v3->co); normalize_v3(av3);
/* This is the correct angle however we are only comparing angles
- * ang1 = 90-((NormalizedVecAngle2(av1, av2) * 180.0/M_PI)-90); */
- ang1 = NormalizedVecAngle2(av1, av2)*180.0/M_PI;
- ang2 = NormalizedVecAngle2(av2, av3)*180.0/M_PI;
- ang3 = NormalizedVecAngle2(av3, av1)*180.0/M_PI;
+ * ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90); */
+ ang1 = angle_normalized_v3v3(av1, av2)*180.0/M_PI;
+ ang2 = angle_normalized_v3v3(av2, av3)*180.0/M_PI;
+ ang3 = angle_normalized_v3v3(av3, av1)*180.0/M_PI;
/* This simple makes the angles display worse then they really are ;)
* 1.0-pow((1.0-a), 2) */
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index f9a849798be..0e5e283d109 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -41,7 +41,7 @@
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
@@ -359,9 +359,9 @@ void uv_center(float uv[][2], float cent[2], int quad)
float uv_area(float uv[][2], int quad)
{
if(quad)
- return AreaF2Dfl(uv[0], uv[1], uv[2]) + AreaF2Dfl(uv[0], uv[2], uv[3]);
+ return area_tri_v2(uv[0], uv[1], uv[2]) + area_tri_v2(uv[0], uv[2], uv[3]);
else
- return AreaF2Dfl(uv[0], uv[1], uv[2]);
+ return area_tri_v2(uv[0], uv[1], uv[2]);
}
void uv_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy)
@@ -473,7 +473,7 @@ static void find_nearest_uv_edge(Scene *scene, Image *ima, EditMesh *em, float c
nverts= efa->v4? 4: 3;
for(i=0; i<nverts; i++) {
- dist= PdistVL2Dfl(co, tf->uv[i], tf->uv[(i+1)%nverts]);
+ dist= dist_to_line_segment_v2(co, tf->uv[i], tf->uv[(i+1)%nverts]);
if(dist < mindist) {
hit->tf= tf;
@@ -534,8 +534,8 @@ static int nearest_uv_between(MTFace *tf, int nverts, int id, float co[2], float
m[0]= co[0]-uv[0];
m[1]= co[1]-uv[1];
- Vec2Subf(v1, tf->uv[id1], tf->uv[id]);
- Vec2Subf(v2, tf->uv[id2], tf->uv[id]);
+ sub_v2_v2v2(v1, tf->uv[id1], tf->uv[id]);
+ sub_v2_v2v2(v2, tf->uv[id2], tf->uv[id]);
/* m and v2 on same side of v-v1? */
c1= v1[0]*m[1] - v1[1]*m[0];
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 20f74085e52..85ccef5cd7d 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -2,7 +2,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_memarena.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_heap.h"
#include "BLI_boxpack2d.h"
@@ -333,8 +333,8 @@ static float p_vec_angle_cos(float *v1, float *v2, float *v3)
d2[1] = v3[1] - v2[1];
d2[2] = v3[2] - v2[2];
- Normalize(d1);
- Normalize(d2);
+ normalize_v3(d1);
+ normalize_v3(d2);
return d1[0]*d2[0] + d1[1]*d2[1] + d1[2]*d2[2];
}
@@ -382,7 +382,7 @@ static float p_face_area(PFace *f)
PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
- return AreaT3Dfl(v1->co, v2->co, v3->co);
+ return area_tri_v3(v1->co, v2->co, v3->co);
}
static float p_area_signed(float *v1, float *v2, float *v3)
@@ -1099,7 +1099,7 @@ static PFace *p_face_add_fill(PChart *chart, PVert *v1, PVert *v2, PVert *v3)
static PBool p_quad_split_direction(PHandle *handle, float **co, PHashKey *vkeys)
{
- float fac= VecLenf(co[0], co[2]) - VecLenf(co[1], co[3]);
+ float fac= len_v3v3(co[0], co[2]) - len_v3v3(co[1], co[3]);
PBool dir = (fac <= 0.0f);
/* the face exists check is there because of a special case: when
@@ -1414,16 +1414,16 @@ static float p_vert_cotan(float *v1, float *v2, float *v3)
{
float a[3], b[3], c[3], clen;
- VecSubf(a, v2, v1);
- VecSubf(b, v3, v1);
- Crossf(c, a, b);
+ sub_v3_v3v3(a, v2, v1);
+ sub_v3_v3v3(b, v3, v1);
+ cross_v3_v3v3(c, a, b);
- clen = VecLength(c);
+ clen = len_v3(c);
if (clen == 0.0f)
return 0.0f;
- return Inpf(a, b)/clen;
+ return dot_v3v3(a, b)/clen;
}
static PBool p_vert_flipped_wheel_triangle(PVert *v)
@@ -1752,15 +1752,15 @@ static PBool p_collapse_normal_flipped(float *v1, float *v2, float *vold, float
{
float nold[3], nnew[3], sub1[3], sub2[3];
- VecSubf(sub1, vold, v1);
- VecSubf(sub2, vold, v2);
- Crossf(nold, sub1, sub2);
+ sub_v3_v3v3(sub1, vold, v1);
+ sub_v3_v3v3(sub2, vold, v2);
+ cross_v3_v3v3(nold, sub1, sub2);
- VecSubf(sub1, vnew, v1);
- VecSubf(sub2, vnew, v2);
- Crossf(nnew, sub1, sub2);
+ sub_v3_v3v3(sub1, vnew, v1);
+ sub_v3_v3v3(sub2, vnew, v2);
+ cross_v3_v3v3(nnew, sub1, sub2);
- return (Inpf(nold, nnew) <= 0.0f);
+ return (dot_v3v3(nold, nnew) <= 0.0f);
}
static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair)
@@ -1866,7 +1866,7 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
oldf1 = (edge)? edge->face: NULL;
oldf2 = (pair)? pair->face: NULL;
- VecSubf(edgevec, keepv->co, oldv->co);
+ sub_v3_v3v3(edgevec, keepv->co, oldv->co);
e = oldv->edge;
do {
@@ -1878,16 +1878,16 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
float tetrav2[3], tetrav3[3], c[3];
/* tetrahedron volume = (1/3!)*|a.(b x c)| */
- VecSubf(tetrav2, co1, oldv->co);
- VecSubf(tetrav3, co2, oldv->co);
- Crossf(c, tetrav2, tetrav3);
+ sub_v3_v3v3(tetrav2, co1, oldv->co);
+ sub_v3_v3v3(tetrav3, co2, oldv->co);
+ cross_v3_v3v3(c, tetrav2, tetrav3);
- volumecost += fabs(Inpf(edgevec, c)/6.0f);
+ volumecost += fabs(dot_v3v3(edgevec, c)/6.0f);
#if 0
- shapecost += Inpf(co1, keepv->co);
+ shapecost += dot_v3v3(co1, keepv->co);
if (p_wheel_edge_next(e) == NULL)
- shapecost += Inpf(co2, keepv->co);
+ shapecost += dot_v3v3(co2, keepv->co);
#endif
p_triangle_angles(oldv->co, co1, co2, &a1, &a2, &a3);
@@ -1915,10 +1915,10 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
PVert *v1 = p_boundary_edge_prev(oldv->edge)->vert;
PVert *v2 = p_boundary_edge_next(oldv->edge)->vert;
- areacost = AreaT3Dfl(oldv->co, v1->co, v2->co);
+ areacost = area_tri_v3(oldv->co, v1->co, v2->co);
}
- elen = VecLength(edgevec);
+ elen = len_v3(edgevec);
weight = 1.0f; /* 0.2f */
cost = weight*volumecost*volumecost + elen*elen*areacost*areacost;
#if 0
@@ -2750,7 +2750,7 @@ static void p_chart_pin_positions(PChart *chart, PVert **pin1, PVert **pin2)
int diru, dirv, dirx, diry;
float sub[3];
- VecSubf(sub, (*pin1)->co, (*pin2)->co);
+ sub_v3_v3v3(sub, (*pin1)->co, (*pin2)->co);
sub[0] = fabs(sub[0]);
sub[1] = fabs(sub[1]);
sub[2] = fabs(sub[2]);
@@ -3185,35 +3185,35 @@ static float p_face_stretch(PFace *f)
w= 1.0f/(2.0f*area);
/* compute derivatives */
- VecCopyf(Ps, v1->co);
- VecMulf(Ps, (v2->uv[1] - v3->uv[1]));
+ copy_v3_v3(Ps, v1->co);
+ mul_v3_fl(Ps, (v2->uv[1] - v3->uv[1]));
- VecCopyf(tmp, v2->co);
- VecMulf(tmp, (v3->uv[1] - v1->uv[1]));
- VecAddf(Ps, Ps, tmp);
+ copy_v3_v3(tmp, v2->co);
+ mul_v3_fl(tmp, (v3->uv[1] - v1->uv[1]));
+ add_v3_v3v3(Ps, Ps, tmp);
- VecCopyf(tmp, v3->co);
- VecMulf(tmp, (v1->uv[1] - v2->uv[1]));
- VecAddf(Ps, Ps, tmp);
+ copy_v3_v3(tmp, v3->co);
+ mul_v3_fl(tmp, (v1->uv[1] - v2->uv[1]));
+ add_v3_v3v3(Ps, Ps, tmp);
- VecMulf(Ps, w);
+ mul_v3_fl(Ps, w);
- VecCopyf(Pt, v1->co);
- VecMulf(Pt, (v3->uv[0] - v2->uv[0]));
+ copy_v3_v3(Pt, v1->co);
+ mul_v3_fl(Pt, (v3->uv[0] - v2->uv[0]));
- VecCopyf(tmp, v2->co);
- VecMulf(tmp, (v1->uv[0] - v3->uv[0]));
- VecAddf(Pt, Pt, tmp);
+ copy_v3_v3(tmp, v2->co);
+ mul_v3_fl(tmp, (v1->uv[0] - v3->uv[0]));
+ add_v3_v3v3(Pt, Pt, tmp);
- VecCopyf(tmp, v3->co);
- VecMulf(tmp, (v2->uv[0] - v1->uv[0]));
- VecAddf(Pt, Pt, tmp);
+ copy_v3_v3(tmp, v3->co);
+ mul_v3_fl(tmp, (v2->uv[0] - v1->uv[0]));
+ add_v3_v3v3(Pt, Pt, tmp);
- VecMulf(Pt, w);
+ mul_v3_fl(Pt, w);
/* Sander Tensor */
- a= Inpf(Ps, Ps);
- c= Inpf(Pt, Pt);
+ a= dot_v3v3(Ps, Ps);
+ c= dot_v3v3(Pt, Pt);
T = sqrt(0.5f*(a + c));
if (f->flag & PFACE_FILLED)
@@ -3273,7 +3273,7 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
low = 0;
stretch_low = orig_stretch;
- Vec2Addf(v->uv, orig_uv, dir);
+ add_v2_v2v2(v->uv, orig_uv, dir);
high = 1;
stretch = stretch_high = p_stretch_compute_vertex(v);
@@ -3296,7 +3296,7 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
/* no luck, stretch has increased, reset to old values */
if(stretch >= orig_stretch)
- Vec2Copyf(v->uv, orig_uv);
+ copy_v2_v2(v->uv, orig_uv);
}
}
@@ -3404,7 +3404,7 @@ static float p_rectangle_area(float *p1, float *dir, float *p2, float *p3, float
if (!p_intersect_line_2d_dir(p3, dir, p4, orthodir, corner3))
return 1e10;
- return Vec2Lenf(corner1, corner2)*Vec2Lenf(corner2, corner3);
+ return len_v2v2(corner1, corner2)*len_v2v2(corner2, corner3);
}
static float p_chart_minimum_area_angle(PChart *chart)
@@ -3499,7 +3499,7 @@ static float p_chart_minimum_area_angle(PChart *chart)
p3 = points[idx[(mini+2)%4]];
p4 = points[idx[(mini+3)%4]];
- len = Vec2Lenf(p1->uv, p1n->uv);
+ len = len_v2v2(p1->uv, p1n->uv);
if (len > 0.0f) {
len = 1.0/len;
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 29d9bb4864e..792026a798d 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -48,7 +48,7 @@
#include "BKE_mesh.h"
#include "BKE_utildefines.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_editVert.h"
@@ -563,7 +563,7 @@ static void uv_map_transform_center(Scene *scene, View3D *v3d, float *result, Ob
if(efa->v4) DO_MINMAX(efa->v4->co, min, max);
}
}
- VecMidf(result, min, max);
+ mid_v3_v3v3(result, min, max);
break;
case V3D_CURSOR: /*cursor center*/
@@ -590,23 +590,23 @@ static void uv_map_rotation_matrix(float result[][4], RegionView3D *rv3d, Object
/* get rotation of the current view matrix */
if(rv3d)
- Mat4CpyMat4(viewmatrix, rv3d->viewmat);
+ copy_m4_m4(viewmatrix, rv3d->viewmat);
else
- Mat4One(viewmatrix);
+ unit_m4(viewmatrix);
/* but shifting */
for(k=0; k<4; k++)
viewmatrix[3][k] =0.0f;
/* get rotation of the current object matrix */
- Mat4CpyMat4(rotobj,ob->obmat);
+ copy_m4_m4(rotobj,ob->obmat);
/* but shifting */
for(k=0; k<4; k++)
rotobj[3][k] =0.0f;
- Mat4Clr(*rotup);
- Mat4Clr(*rotside);
+ zero_m4(*rotup);
+ zero_m4(*rotside);
/* compensate front/side.. against opengl x,y,z world definition */
/* this is "kanonen gegen spatzen", a few plus minus 1 will do here */
@@ -626,7 +626,7 @@ static void uv_map_rotation_matrix(float result[][4], RegionView3D *rv3d, Object
rotup[0][0]= (float)1.0f/radius;
/* calculate transforms*/
- Mat4MulSerie(result, rotup, rotside, viewmatrix, rotobj, NULL, NULL, NULL, NULL);
+ mul_serie_m4(result, rotup, rotside, viewmatrix, rotobj, NULL, NULL, NULL, NULL);
}
static void uv_map_transform(bContext *C, wmOperator *op, float center[3], float rotmat[4][4])
@@ -657,7 +657,7 @@ static void uv_map_transform(bContext *C, wmOperator *op, float center[3], float
/* be compatible to the "old" sphere/cylinder mode */
if(direction == ALIGN_TO_OBJECT)
- Mat4One(rotmat);
+ unit_m4(rotmat);
else
uv_map_rotation_matrix(rotmat, rv3d, obedit, upangledeg, sideangledeg, radius);
@@ -873,7 +873,7 @@ static void uv_from_view_bounds(float target[2], float source[3], float rotmat[4
{
float pv[3];
- Mat4MulVecfl(rotmat, pv);
+ mul_m4_v3(rotmat, pv);
/* ortho projection */
target[0] = -pv[0];
@@ -885,19 +885,19 @@ static void uv_from_view(ARegion *ar, float target[2], float source[3], float ro
RegionView3D *rv3d= ar->regiondata;
float pv[3], pv4[4], dx, dy, x= 0.0, y= 0.0;
- Mat4MulVecfl(rotmat, pv);
+ mul_m4_v3(rotmat, pv);
dx= ar->winx;
dy= ar->winy;
- VecCopyf(pv4, source);
+ copy_v3_v3(pv4, source);
pv4[3]= 1.0;
/* rotmat is the object matrix in this case */
- Mat4MulVec4fl(rotmat, pv4);
+ mul_m4_v4(rotmat, pv4);
/* almost project_short */
- Mat4MulVec4fl(rv3d->persmat, pv4);
+ mul_m4_v4(rv3d->persmat, pv4);
if(fabs(pv4[3]) > 0.00001) { /* avoid division by zero */
target[0] = dx/2.0 + (dx/2.0)*pv4[0]/pv4[3];
target[1] = dy/2.0 + (dy/2.0)*pv4[1]/pv4[3];
@@ -954,7 +954,7 @@ static int from_view_exec(bContext *C, wmOperator *op)
}
}
else {
- Mat4CpyMat4(rotmat, obedit->obmat);
+ copy_m4_m4(rotmat, obedit->obmat);
for(efa= em->faces.first; efa; efa= efa->next) {
if(efa->f & SELECT) {
@@ -1063,10 +1063,10 @@ static void uv_sphere_project(float target[2], float source[3], float center[3],
{
float pv[3];
- VecSubf(pv, source, center);
- Mat4MulVecfl(rotmat, pv);
+ sub_v3_v3v3(pv, source, center);
+ mul_m4_v3(rotmat, pv);
- spheremap(pv[0], pv[1], pv[2], &target[0], &target[1]);
+ map_to_sphere( &target[0], &target[1],pv[0], pv[1], pv[2]);
/* split line is always zero */
if(target[0] >= 1.0f)
@@ -1155,10 +1155,10 @@ static void uv_cylinder_project(float target[2], float source[3], float center[3
{
float pv[3];
- VecSubf(pv, source, center);
- Mat4MulVecfl(rotmat, pv);
+ sub_v3_v3v3(pv, source, center);
+ mul_m4_v3(rotmat, pv);
- tubemap(pv[0], pv[1], pv[2], &target[0], &target[1]);
+ map_to_tube( &target[0], &target[1],pv[0], pv[1], pv[2]);
/* split line is always zero */
if(target[0] >= 1.0f)
@@ -1248,7 +1248,7 @@ static int cube_project_exec(bContext *C, wmOperator *op)
for(efa= em->faces.first; efa; efa= efa->next) {
if(efa->f & SELECT) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- CalcNormFloat(efa->v1->co, efa->v2->co, efa->v3->co, no);
+ normal_tri_v3( no,efa->v1->co, efa->v2->co, efa->v3->co);
no[0]= fabs(no[0]);
no[1]= fabs(no[1]);