Math Lib
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 10 Nov 2009 20:43:45 +0000 (20:43 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 10 Nov 2009 20:43:45 +0000 (20:43 +0000)
* 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

281 files changed:
source/blender/blenfont/intern/blf_font.c
source/blender/blenkernel/BKE_cloth.h
source/blender/blenkernel/BKE_constraint.h
source/blender/blenkernel/intern/BME_tools.c
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/boids.c
source/blender/blenkernel/intern/booleanops.c
source/blender/blenkernel/intern/booleanops_mesh.c
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/bvhutils.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/collision.c
source/blender/blenkernel/intern/colortools.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/deform.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/exotic.c
source/blender/blenkernel/intern/fcurve.c
source/blender/blenkernel/intern/fluidsim.c
source/blender/blenkernel/intern/fmodifier.c
source/blender/blenkernel/intern/font.c
source/blender/blenkernel/intern/gpencil.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/implicit.c
source/blender/blenkernel/intern/ipo.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/seqeffects.c
source/blender/blenkernel/intern/shrinkwrap.c
source/blender/blenkernel/intern/simple_deform.c
source/blender/blenkernel/intern/sketch.c
source/blender/blenkernel/intern/smoke.c
source/blender/blenkernel/intern/softbody.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenkernel/intern/texture.c
source/blender/blenkernel/intern/world.c
source/blender/blenlib/intern/BLI_kdopbvh.c
source/blender/blenlib/intern/BLI_kdtree.c
source/blender/blenlib/intern/freetypefont.c
source/blender/blenlib/intern/graph.c
source/blender/blenlib/intern/jitter.c
source/blender/blenlib/intern/scanfill.c
source/blender/blenloader/intern/readfile.c
source/blender/collada/DocumentExporter.cpp
source/blender/collada/DocumentImporter.cpp
source/blender/collada/collada_internal.h
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/animation/anim_ipo_utils.c
source/blender/editors/animation/drivers.c
source/blender/editors/animation/fmodifier_ui.c
source/blender/editors/animation/keyframes_draw.c
source/blender/editors/animation/keyframes_edit.c
source/blender/editors/animation/keyframes_general.c
source/blender/editors/animation/keyframing.c
source/blender/editors/animation/keyingsets.c
source/blender/editors/armature/armature_ops.c
source/blender/editors/armature/editarmature.c
source/blender/editors/armature/editarmature_generate.c
source/blender/editors/armature/editarmature_retarget.c
source/blender/editors/armature/editarmature_sketch.c
source/blender/editors/armature/meshlaplacian.c
source/blender/editors/armature/poseSlide.c
source/blender/editors/armature/poselib.c
source/blender/editors/armature/poseobject.c
source/blender/editors/armature/reeb.c
source/blender/editors/curve/curve_ops.c
source/blender/editors/curve/editcurve.c
source/blender/editors/curve/editfont.c
source/blender/editors/gpencil/drawgpencil.c
source/blender/editors/gpencil/editaction_gpencil.c
source/blender/editors/gpencil/gpencil_buttons.c
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_style.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/mesh/editface.c
source/blender/editors/mesh/editmesh.c
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/editmesh_lib.c
source/blender/editors/mesh/editmesh_loop.c
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/metaball/mball_edit.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_constraint.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_modifier.c
source/blender/editors/object/object_ops.c
source/blender/editors/object/object_relations.c
source/blender/editors/object/object_select.c
source/blender/editors/object/object_shapekey.c
source/blender/editors/object/object_transform.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/particle_object.c
source/blender/editors/physics/physics_fluid.c
source/blender/editors/render/render_preview.c
source/blender/editors/render/render_shading.c
source/blender/editors/screen/area.c
source/blender/editors/screen/glutil.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_stroke.c
source/blender/editors/sculpt_paint/paint_utils.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_action/action_draw.c
source/blender/editors/space_action/action_edit.c
source/blender/editors/space_action/action_select.c
source/blender/editors/space_action/space_action.c
source/blender/editors/space_api/space.c
source/blender/editors/space_buttons/space_buttons.c
source/blender/editors/space_console/space_console.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_graph/graph_buttons.c
source/blender/editors/space_graph/graph_draw.c
source/blender/editors/space_graph/graph_edit.c
source/blender/editors/space_graph/graph_select.c
source/blender/editors/space_graph/graph_utils.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_info/space_info.c
source/blender/editors/space_logic/logic_buttons.c
source/blender/editors/space_logic/space_logic.c
source/blender/editors/space_nla/nla_buttons.c
source/blender/editors/space_nla/nla_channels.c
source/blender/editors/space_nla/nla_draw.c
source/blender/editors/space_nla/nla_edit.c
source/blender/editors/space_nla/nla_header.c
source/blender/editors/space_nla/nla_ops.c
source/blender/editors/space_nla/nla_select.c
source/blender/editors/space_nla/space_nla.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/space_node.c
source/blender/editors/space_outliner/space_outliner.c
source/blender/editors/space_script/script_ops.c
source/blender/editors/space_script/space_script.c
source/blender/editors/space_sequencer/sequencer_add.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_sequencer/sequencer_ops.c
source/blender/editors/space_sequencer/sequencer_select.c
source/blender/editors/space_sequencer/space_sequencer.c
source/blender/editors/space_sound/space_sound.c
source/blender/editors/space_text/space_text.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/drawvolume.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_ops.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/space_view3d/view3d_snap.c
source/blender/editors/space_view3d/view3d_toolbar.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_constraints.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_input.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/transform/transform_ops.c
source/blender/editors/transform/transform_orientations.c
source/blender/editors/transform/transform_snap.c
source/blender/editors/uvedit/uvedit_draw.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_parametrizer.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/gpu/intern/gpu_buffers.c
source/blender/gpu/intern/gpu_material.c
source/blender/ikplugin/intern/ikplugin_api.c
source/blender/ikplugin/intern/iksolver_plugin.c
source/blender/ikplugin/intern/itasc_plugin.cpp
source/blender/makesdna/DNA_action_types.h
source/blender/makesdna/DNA_constraint_types.h
source/blender/makesrna/intern/rna_armature.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_api.c
source/blender/makesrna/intern/rna_particle.c
source/blender/makesrna/intern/rna_pose.c
source/blender/nodes/intern/CMP_util.h
source/blender/nodes/intern/SHD_nodes/SHD_camera.c
source/blender/nodes/intern/SHD_nodes/SHD_curves.c
source/blender/nodes/intern/SHD_nodes/SHD_mapping.c
source/blender/nodes/intern/SHD_nodes/SHD_material.c
source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
source/blender/nodes/intern/SHD_util.h
source/blender/nodes/intern/TEX_nodes/TEX_distance.c
source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
source/blender/nodes/intern/TEX_util.h
source/blender/python/generic/Geometry.c
source/blender/python/generic/Mathutils.c
source/blender/python/generic/euler.c
source/blender/python/generic/matrix.c
source/blender/python/generic/quat.c
source/blender/python/generic/vector.c
source/blender/render/intern/raytrace/rayobject.cpp
source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
source/blender/render/intern/raytrace/rayobject_vbvh.cpp
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/envmap.c
source/blender/render/intern/source/imagetexture.c
source/blender/render/intern/source/initrender.c
source/blender/render/intern/source/occlusion.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/pixelblending.c
source/blender/render/intern/source/pixelshading.c
source/blender/render/intern/source/pointdensity.c
source/blender/render/intern/source/rayobject_blibvh.c
source/blender/render/intern/source/rayobject_instance.c
source/blender/render/intern/source/rayobject_octree.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/renderdatabase.c
source/blender/render/intern/source/shadbuf.c
source/blender/render/intern/source/shadeinput.c
source/blender/render/intern/source/shadeoutput.c
source/blender/render/intern/source/sss.c
source/blender/render/intern/source/strand.c
source/blender/render/intern/source/sunsky.c
source/blender/render/intern/source/texture.c
source/blender/render/intern/source/volume_precache.c
source/blender/render/intern/source/volumetric.c
source/blender/render/intern/source/voxeldata.c
source/blender/render/intern/source/zbuf.c
source/blender/windowmanager/intern/wm_subwindow.c
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ArmatureActuator.cpp
source/gameengine/Converter/BL_ArmatureChannel.cpp
source/gameengine/Converter/BL_ArmatureConstraint.cpp
source/gameengine/Converter/BL_ArmatureObject.cpp
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/BL_MeshDeformer.cpp
source/gameengine/Converter/BL_ModifierDeformer.cpp
source/gameengine/Converter/BL_ShapeActionActuator.cpp
source/gameengine/Converter/BL_ShapeDeformer.cpp
source/gameengine/Converter/BL_SkinDeformer.cpp
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Ketsji/KX_Dome.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_IPO_SGController.cpp
source/gameengine/VideoTexture/ImageRender.cpp

index 8721e49..c1b54c3 100644 (file)
@@ -46,7 +46,7 @@
 #include "BLI_blenlib.h"
 #include "BLI_linklist.h"      /* linknode */
 #include "BLI_string.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 
 #include "BIF_gl.h"
 #include "BLF_api.h"
@@ -459,7 +459,7 @@ static void blf_font_fill(FontBLF *font)
        font->pos[0]= 0.0f;
        font->pos[1]= 0.0f;
        font->angle= 0.0f;
-       Mat4One(font->mat);
+       unit_m4(font->mat);
        font->clip_rec.xmin= 0.0f;
        font->clip_rec.xmax= 0.0f;
        font->clip_rec.ymin= 0.0f;
index e5b3adb..54dd823 100644 (file)
@@ -38,7 +38,7 @@
 #include "BKE_DerivedMesh.h"
 
 #include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_edgehash.h"
 
 #include "DNA_cloth_types.h"
index 6446b48..f957c5e 100644 (file)
@@ -52,7 +52,7 @@ typedef struct bConstraintOb {
        float startmat[4][4];           /* original matrix (before constraint solving) */
        
        short type;                                     /* type of owner  */
-       short rotOrder;                         /* rotation order for constraint owner (as defined in eEulerRotationOrders in BLI_arithb.h) */
+       short rotOrder;                         /* rotation order for constraint owner (as defined in eEulerRotationOrders in BLI_math.h) */
 } bConstraintOb;
 
 /* ---------------------------------------------------------------------------- */
index 32065ea..d92e8fe 100644 (file)
@@ -42,7 +42,7 @@
 
 #include "BKE_utildefines.h"
 #include "BKE_bmesh.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_blenlib.h"
 
 /*split this all into a seperate bevel.c file in src*/
@@ -88,7 +88,7 @@ BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BME_Mesh *bm, BME_Ve
        else if (org != NULL) VECCOPY(vtd->org,org);
        if (vec != NULL) {
                VECCOPY(vtd->vec,vec);
-               Normalize(vtd->vec);
+               normalize_v3(vtd->vec);
        }
        vtd->loc = loc;
 
@@ -261,7 +261,7 @@ static BME_Vert *BME_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Edge *e, BME_Edge
        nv = BME_SEMV(bm,v,e,ne);
        if (nv == NULL) return NULL;
        VECSUB(nv->co,v2->co,v->co);
-       len = VecLength(nv->co);
+       len = len_v3(nv->co);
        VECADDFAC(nv->co,v->co,nv->co,len*percent);
        nv->flag = v->flag;
        nv->bweight = v->bweight;
@@ -335,17 +335,17 @@ static int BME_bevel_get_vec(float *vec, BME_Vert *v1, BME_Vert *v2, BME_TransDa
        /* compare the transform origins to see if we can use the vert co's;
         * if they belong to different origins, then we will use the origins to determine
         * the vector */
-       if (VecCompare(vtd1->org,vtd2->org,0.000001f)) {
+       if (compare_v3v3(vtd1->org,vtd2->org,0.000001f)) {
                VECSUB(vec,v2->co,v1->co);
-               if (VecLength(vec) < 0.000001f) {
-                       VecMulf(vec,0);
+               if (len_v3(vec) < 0.000001f) {
+                       mul_v3_fl(vec,0);
                }
                return 0;
        }
        else {
                VECSUB(vec,vtd2->org,vtd1->org);
-               if (VecLength(vec) < 0.000001f) {
-                       VecMulf(vec,0);
+               if (len_v3(vec) < 0.000001f) {
+                       mul_v3_fl(vec,0);
                }
                return 1;
        }
@@ -363,18 +363,18 @@ static int BME_bevel_get_vec(float *vec, BME_Vert *v1, BME_Vert *v2, BME_TransDa
 static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *td) {
        float factor, vec3[3], tmp[3],c1,c2;
 
-       Crossf(tmp,vec1,vec2);
-       Normalize(tmp);
-       factor = Inpf(up_vec,tmp);
+       cross_v3_v3v3(tmp,vec1,vec2);
+       normalize_v3(tmp);
+       factor = dot_v3v3(up_vec,tmp);
        if ((factor > 0 && is_forward) || (factor < 0 && !is_forward)) {
-               Crossf(vec3,vec2,tmp); /* hmm, maybe up_vec should be used instead of tmp */
+               cross_v3_v3v3(vec3,vec2,tmp); /* hmm, maybe up_vec should be used instead of tmp */
        }
        else {
-               Crossf(vec3,tmp,vec2); /* hmm, maybe up_vec should be used instead of tmp */
+               cross_v3_v3v3(vec3,tmp,vec2); /* hmm, maybe up_vec should be used instead of tmp */
        }
-       Normalize(vec3);
-       c1 = Inpf(vec3,vec1);
-       c2 = Inpf(vec1,vec1);
+       normalize_v3(vec3);
+       c1 = dot_v3v3(vec3,vec1);
+       c2 = dot_v3v3(vec1,vec1);
        if (fabs(c1) < 0.000001f || fabs(c2) < 0.000001f) {
                factor = 0.0f;
        }
@@ -435,8 +435,8 @@ static BME_Vert *BME_bevel_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Vert *v1, B
                ne->tflag1 = BME_BEVEL_ORIG; /* mark edge as original, even though it isn't */
                BME_bevel_get_vec(vec1,v1,v,td);
                BME_bevel_get_vec(vec2,v2,v,td);
-               Crossf(t_up_vec,vec1,vec2);
-               Normalize(t_up_vec);
+               cross_v3_v3v3(t_up_vec,vec1,vec2);
+               normalize_v3(t_up_vec);
                up_vec = t_up_vec;
        }
        else {
@@ -486,8 +486,8 @@ static BME_Vert *BME_bevel_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Vert *v1, B
 
        is_edge = BME_bevel_get_vec(vec1,v,v1,td); /* get the vector we will be projecting onto */
        BME_bevel_get_vec(vec2,v,v2,td); /* get the vector we will be projecting parallel to */
-       len = VecLength(vec1);
-       Normalize(vec1);
+       len = len_v3(vec1);
+       normalize_v3(vec1);
 
        vtd = BME_get_transdata(td, sv);
        vtd1 = BME_get_transdata(td, v);
@@ -525,8 +525,8 @@ static BME_Vert *BME_bevel_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Vert *v1, B
        }
        VECADDFAC(sv->co,v->co,vec1,dis);
        VECSUB(vec1,sv->co,vtd1->org);
-       dis = VecLength(vec1);
-       Normalize(vec1);
+       dis = len_v3(vec1);
+       normalize_v3(vec1);
        BME_assign_transdata(td, bm, sv, vtd1->org, vtd1->org, vec1, sv->co, dis, scale, maxfactor, vtd->max);
 
        return sv;
@@ -545,10 +545,10 @@ static float BME_bevel_set_max(BME_Vert *v1, BME_Vert *v2, float value, BME_Tran
        }
        else {
                VECCOPY(vec2,vtd1->vec);
-               VecMulf(vec2,vtd1->factor);
-               if (Inpf(vec1, vec1)) {
-                       Projf(vec2,vec2,vec1);
-                       fac1 = VecLength(vec2)/value;
+               mul_v3_fl(vec2,vtd1->factor);
+               if (dot_v3v3(vec1, vec1)) {
+                       project_v3_v3v3(vec2,vec2,vec1);
+                       fac1 = len_v3(vec2)/value;
                }
                else {
                        fac1 = 0;
@@ -560,10 +560,10 @@ static float BME_bevel_set_max(BME_Vert *v1, BME_Vert *v2, float value, BME_Tran
        }
        else {
                VECCOPY(vec3,vtd2->vec);
-               VecMulf(vec3,vtd2->factor);
-               if (Inpf(vec1, vec1)) {
-                       Projf(vec2,vec3,vec1);
-                       fac2 = VecLength(vec2)/value;
+               mul_v3_fl(vec3,vtd2->factor);
+               if (dot_v3v3(vec1, vec1)) {
+                       project_v3_v3v3(vec2,vec3,vec1);
+                       fac2 = len_v3(vec2)/value;
                }
                else {
                        fac2 = 0;
@@ -571,7 +571,7 @@ static float BME_bevel_set_max(BME_Vert *v1, BME_Vert *v2, float value, BME_Tran
        }
 
        if (fac1 || fac2) {
-               max = VecLength(vec1)/(fac1 + fac2);
+               max = len_v3(vec1)/(fac1 + fac2);
                if (vtd1->max && (*vtd1->max < 0 || max < *vtd1->max)) {
                        *vtd1->max = max;
                }
@@ -760,12 +760,12 @@ static BME_Poly *BME_bevel_poly(BME_Mesh *bm, BME_Poly *f, float value, int opti
        for (i=0,ol=f->loopbase,l=ol->next; l->next!=ol; l=l->next) {
                BME_bevel_get_vec(vec1,l->next->v,ol->v,td);
                BME_bevel_get_vec(vec2,l->v,ol->v,td);
-               Crossf(vec3,vec2,vec1);
+               cross_v3_v3v3(vec3,vec2,vec1);
                VECADD(up_vec,up_vec,vec3);
                i++;
        }
-       VecMulf(up_vec,1.0f/i);
-       Normalize(up_vec);
+       mul_v3_fl(up_vec,1.0f/i);
+       normalize_v3(up_vec);
 
        for (i=0,len=f->len; i<len; i++,l=l->next) {
                if ((l->e->tflag1 & BME_BEVEL_BEVEL) && (l->e->tflag1 & BME_BEVEL_ORIG)) {
@@ -791,10 +791,10 @@ static BME_Poly *BME_bevel_poly(BME_Mesh *bm, BME_Poly *f, float value, int opti
                                }
                                else {
                                        VECCOPY(vec2,vtd1->vec);
-                                       VecMulf(vec2,vtd1->factor);
-                                       if (Inpf(vec1, vec1)) {
-                                               Projf(vec2,vec2,vec1);
-                                               fac1 = VecLength(vec2)/value;
+                                       mul_v3_fl(vec2,vtd1->factor);
+                                       if (dot_v3v3(vec1, vec1)) {
+                                               project_v3_v3v3(vec2,vec2,vec1);
+                                               fac1 = len_v3(vec2)/value;
                                        }
                                        else {
                                                fac1 = 0;
@@ -805,17 +805,17 @@ static BME_Poly *BME_bevel_poly(BME_Mesh *bm, BME_Poly *f, float value, int opti
                                }
                                else {
                                        VECCOPY(vec3,vtd2->vec);
-                                       VecMulf(vec3,vtd2->factor);
-                                       if (Inpf(vec1, vec1)) {
-                                               Projf(vec2,vec3,vec1);
-                                               fac2 = VecLength(vec2)/value;
+                                       mul_v3_fl(vec3,vtd2->factor);
+                                       if (dot_v3v3(vec1, vec1)) {
+                                               project_v3_v3v3(vec2,vec3,vec1);
+                                               fac2 = len_v3(vec2)/value;
                                        }
                                        else {
                                                fac2 = 0;
                                        }
                                }
                                if (fac1 || fac2) {
-                                       max = VecLength(vec1)/(fac1 + fac2);
+                                       max = len_v3(vec1)/(fac1 + fac2);
                                        if (vtd1->max && (*vtd1->max < 0 || max < *vtd1->max)) {
                                                *vtd1->max = max;
                                        }
@@ -880,7 +880,7 @@ static float BME_bevel_get_angle(BME_Mesh *bm, BME_Edge *e, BME_Vert *v) {
        }
        VECSUB(vec1,v1->co,v->co);
        VECSUB(vec2,v2->co,v->co);
-       Crossf(vec3,vec1,vec2);
+       cross_v3_v3v3(vec3,vec1,vec2);
 
        l1 = l2;
        if (l1->v == v) {
@@ -893,12 +893,12 @@ static float BME_bevel_get_angle(BME_Mesh *bm, BME_Edge *e, BME_Vert *v) {
        }
        VECSUB(vec1,v1->co,v->co);
        VECSUB(vec2,v2->co,v->co);
-       Crossf(vec4,vec2,vec1);
+       cross_v3_v3v3(vec4,vec2,vec1);
 
-       Normalize(vec3);
-       Normalize(vec4);
+       normalize_v3(vec3);
+       normalize_v3(vec4);
 
-       return Inpf(vec3,vec4);
+       return dot_v3v3(vec3,vec4);
 }
 static int BME_face_sharededges(BME_Poly *f1, BME_Poly *f2){
        BME_Loop *l;
index 11e5820..f9abaa9 100644 (file)
@@ -52,7 +52,7 @@
 #include "DNA_space_types.h"
 #include "DNA_particle_types.h"
 
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_edgehash.h"
 #include "BLI_editVert.h"
@@ -619,20 +619,20 @@ static void emDM__calcFaceCent(EditFace *efa, float cent[3], float (*vertexCos)[
 {
        if (vertexCos) {
                VECCOPY(cent, vertexCos[(int) efa->v1->tmp.l]);
-               VecAddf(cent, cent, vertexCos[(int) efa->v2->tmp.l]);
-               VecAddf(cent, cent, vertexCos[(int) efa->v3->tmp.l]);
-               if (efa->v4) VecAddf(cent, cent, vertexCos[(int) efa->v4->tmp.l]);
+               add_v3_v3v3(cent, cent, vertexCos[(int) efa->v2->tmp.l]);
+               add_v3_v3v3(cent, cent, vertexCos[(int) efa->v3->tmp.l]);
+               if (efa->v4) add_v3_v3v3(cent, cent, vertexCos[(int) efa->v4->tmp.l]);
        } else {
                VECCOPY(cent, efa->v1->co);
-               VecAddf(cent, cent, efa->v2->co);
-               VecAddf(cent, cent, efa->v3->co);
-               if (efa->v4) VecAddf(cent, cent, efa->v4->co);
+               add_v3_v3v3(cent, cent, efa->v2->co);
+               add_v3_v3v3(cent, cent, efa->v3->co);
+               if (efa->v4) add_v3_v3v3(cent, cent, efa->v4->co);
        }
 
        if (efa->v4) {
-               VecMulf(cent, 0.25f);
+               mul_v3_fl(cent, 0.25f);
        } else {
-               VecMulf(cent, 0.33333333333f);
+               mul_v3_fl(cent, 0.33333333333f);
        }
 }
 static void emDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no), void *userData)
@@ -1498,25 +1498,25 @@ static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, Object *ob,
                        if(efa->v4) {
                                float *v4 = vertexCos[(int) efa->v4->tmp.l];
 
-                               CalcNormFloat4(v1, v2, v3, v4, no);
-                               VecAddf(emdm->vertexNos[(int) efa->v4->tmp.l], emdm->vertexNos[(int) efa->v4->tmp.l], no);
+                               normal_quad_v3( no,v1, v2, v3, v4);
+                               add_v3_v3v3(emdm->vertexNos[(int) efa->v4->tmp.l], emdm->vertexNos[(int) efa->v4->tmp.l], no);
                        }
                        else {
-                               CalcNormFloat(v1, v2, v3, no);
+                               normal_tri_v3( no,v1, v2, v3);
                        }
 
-                       VecAddf(emdm->vertexNos[(int) efa->v1->tmp.l], emdm->vertexNos[(int) efa->v1->tmp.l], no);
-                       VecAddf(emdm->vertexNos[(int) efa->v2->tmp.l], emdm->vertexNos[(int) efa->v2->tmp.l], no);
-                       VecAddf(emdm->vertexNos[(int) efa->v3->tmp.l], emdm->vertexNos[(int) efa->v3->tmp.l], no);
+                       add_v3_v3v3(emdm->vertexNos[(int) efa->v1->tmp.l], emdm->vertexNos[(int) efa->v1->tmp.l], no);
+                       add_v3_v3v3(emdm->vertexNos[(int) efa->v2->tmp.l], emdm->vertexNos[(int) efa->v2->tmp.l], no);
+                       add_v3_v3v3(emdm->vertexNos[(int) efa->v3->tmp.l], emdm->vertexNos[(int) efa->v3->tmp.l], no);
                }
 
                for(i=0, eve= em->verts.first; eve; i++, eve=eve->next) {
                        float *no = emdm->vertexNos[i];
                        /* following Mesh convention; we use vertex coordinate itself
                         * for normal in this case */
-                       if (Normalize(no)==0.0) {
+                       if (normalize_v3(no)==0.0) {
                                VECCOPY(no, vertexCos[i]);
-                               Normalize(no);
+                               normalize_v3(no);
                        }
                }
        }
@@ -2482,7 +2482,7 @@ int editmesh_get_first_deform_matrices(Object *ob, EditMesh *em, float (**deform
                                defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats");
 
                                for(a=0; a<numVerts; a++)
-                                       Mat3One(defmats[a]);
+                                       unit_m3(defmats[a]);
                        }
 
                        mti->deformMatricesEM(md, ob, em, dm, deformedVerts, defmats,
@@ -2554,11 +2554,11 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 
                if (mf->v4) {
                        v4= &mvert[mf->v4];
-                       CalcNormFloat4(v4->co, v3->co, v2->co, v1->co, fno);
+                       normal_quad_v3( fno,v4->co, v3->co, v2->co, v1->co);
                }
                else {
                        v4= NULL;
-                       CalcNormFloat(v3->co, v2->co, v1->co, fno);
+                       normal_tri_v3( fno,v3->co, v2->co, v1->co);
                }
                
                if(mtface) {
@@ -2569,11 +2569,11 @@ void DM_add_tangent_layer(DerivedMesh *dm)
                }
                else {
                        uv1= uv[0]; uv2= uv[1]; uv3= uv[2]; uv4= uv[3];
-                       spheremap(orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2], &uv[0][0], &uv[0][1]);
-                       spheremap(orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2], &uv[1][0], &uv[1][1]);
-                       spheremap(orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2], &uv[2][0], &uv[2][1]);
+                       map_to_sphere( &uv[0][0], &uv[0][1],orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2]);
+                       map_to_sphere( &uv[1][0], &uv[1][1],orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2]);
+                       map_to_sphere( &uv[2][0], &uv[2][1],orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2]);
                        if(v4)
-                               spheremap(orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2], &uv[3][0], &uv[3][1]);
+                               map_to_sphere( &uv[3][0], &uv[3][1],orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]);
                }
                
                tangent_from_uv(uv1, uv2, uv3, v1->co, v2->co, v3->co, fno, tang);
@@ -2603,11 +2603,11 @@ void DM_add_tangent_layer(DerivedMesh *dm)
                }
                else {
                        uv1= uv[0]; uv2= uv[1]; uv3= uv[2]; uv4= uv[3];
-                       spheremap(orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2], &uv[0][0], &uv[0][1]);
-                       spheremap(orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2], &uv[1][0], &uv[1][1]);
-                       spheremap(orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2], &uv[2][0], &uv[2][1]);
+                       map_to_sphere( &uv[0][0], &uv[0][1],orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2]);
+                       map_to_sphere( &uv[1][0], &uv[1][1],orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2]);
+                       map_to_sphere( &uv[2][0], &uv[2][1],orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2]);
                        if(len==4)
-                               spheremap(orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2], &uv[3][0], &uv[3][1]);
+                               map_to_sphere( &uv[3][0], &uv[3][1],orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]);
                }
                
                mf_vi[0]= mf->v1;
@@ -2619,7 +2619,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
                        vtang= find_vertex_tangent(vtangents[mf_vi[j]], mtface ? tf->uv[j] : uv[j]);
 
                        VECCOPY(tangent[j], vtang);
-                       Normalize(tangent[j]);
+                       normalize_v3(tangent[j]);
                }
        }
        
index 2505a3a..358a482 100644 (file)
@@ -64,7 +64,7 @@
 #include "BKE_utildefines.h"
 #include "BIK_api.h"
 
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_ghash.h"
 
@@ -453,7 +453,7 @@ bPoseChannel *verify_pose_channel(bPose* pose, const char* name)
        chan->limitmax[0]= chan->limitmax[1]= chan->limitmax[2]= 180.0f;
        chan->stiffness[0]= chan->stiffness[1]= chan->stiffness[2]= 0.0f;
        chan->ikrotweight = chan->iklinweight = 0.0f;
-       Mat4One(chan->constinv);
+       unit_m4(chan->constinv);
        
        BLI_addtail(&pose->chanbase, chan);
        
@@ -611,8 +611,8 @@ static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan
        pchan->rotAngle= chan->rotAngle;
        QUATCOPY(pchan->quat, chan->quat);
        pchan->rotmode= chan->rotmode;
-       Mat4CpyMat4(pchan->chan_mat, (float(*)[4])chan->chan_mat);
-       Mat4CpyMat4(pchan->pose_mat, (float(*)[4])chan->pose_mat);
+       copy_m4_m4(pchan->chan_mat, (float(*)[4])chan->chan_mat);
+       copy_m4_m4(pchan->pose_mat, (float(*)[4])chan->pose_mat);
        pchan->flag= chan->flag;
        
        con= chan->constraints.first;
@@ -1013,8 +1013,8 @@ void copy_pose_result(bPose *to, bPose *from)
        for(pchanfrom= from->chanbase.first; pchanfrom; pchanfrom= pchanfrom->next) {
                pchanto= get_pose_channel(to, pchanfrom->name);
                if(pchanto) {
-                       Mat4CpyMat4(pchanto->pose_mat, pchanfrom->pose_mat);
-                       Mat4CpyMat4(pchanto->chan_mat, pchanfrom->chan_mat);
+                       copy_m4_m4(pchanto->pose_mat, pchanfrom->pose_mat);
+                       copy_m4_m4(pchanto->chan_mat, pchanfrom->chan_mat);
                        
                        /* used for local constraints */
                        VECCOPY(pchanto->loc, pchanfrom->loc);
@@ -1040,9 +1040,9 @@ void what_does_obaction (Scene *scene, Object *ob, Object *workob, bPose *pose,
        clear_workob(workob);
        
        /* init workob */
-       Mat4CpyMat4(workob->obmat, ob->obmat);
-       Mat4CpyMat4(workob->parentinv, ob->parentinv);
-       Mat4CpyMat4(workob->constinv, ob->constinv);
+       copy_m4_m4(workob->obmat, ob->obmat);
+       copy_m4_m4(workob->parentinv, ob->parentinv);
+       copy_m4_m4(workob->constinv, ob->constinv);
        workob->parent= ob->parent;
        workob->track= ob->track;
 
@@ -1109,7 +1109,7 @@ static void blend_pose_strides(bPose *dst, bPose *src, float srcweight, short mo
                        dstweight = 1.0F;
        }
        
-       VecLerpf(dst->stride_offset, dst->stride_offset, src->stride_offset, srcweight);
+       interp_v3_v3v3(dst->stride_offset, dst->stride_offset, src->stride_offset, srcweight);
 }
 
 
@@ -1169,27 +1169,27 @@ static void blend_pose_offset_bone(bActionStrip *strip, bPose *dst, bPose *src,
                                                execute_action_ipo(achan, &pchan);
                                                
                                                /* store offset that moves src to location of pchan */
-                                               VecSubf(vec, dpchan->loc, pchan.loc);
+                                               sub_v3_v3v3(vec, dpchan->loc, pchan.loc);
                                                
-                                               Mat4Mul3Vecfl(dpchan->bone->arm_mat, vec);
+                                               mul_mat3_m4_v3(dpchan->bone->arm_mat, vec);
                                        }
                                }
                                else {
                                        /* store offset that moves src to location of dst */
                                        
-                                       VecSubf(vec, dpchan->loc, spchan->loc);
-                                       Mat4Mul3Vecfl(dpchan->bone->arm_mat, vec);
+                                       sub_v3_v3v3(vec, dpchan->loc, spchan->loc);
+                                       mul_mat3_m4_v3(dpchan->bone->arm_mat, vec);
                                }
                                
                                /* if blending, we only add with factor scrweight */
-                               VecMulf(vec, srcweight);
+                               mul_v3_fl(vec, srcweight);
                                
-                               VecAddf(dst->cyclic_offset, dst->cyclic_offset, vec);
+                               add_v3_v3v3(dst->cyclic_offset, dst->cyclic_offset, vec);
                        }
                }
        }
        
-       VecAddf(dst->cyclic_offset, dst->cyclic_offset, src->cyclic_offset);
+       add_v3_v3v3(dst->cyclic_offset, dst->cyclic_offset, src->cyclic_offset);
 }
 
 /* added "sizecorr" here, to allow armatures to be scaled and still have striding.
@@ -1249,14 +1249,14 @@ static float stridechannel_frame(Object *ob, float sizecorr, bActionStrip *strip
                        if (pdistNewNormalized <= 1) {
                                // search for correction in positive path-direction
                                where_on_path(ob, pdistNewNormalized, vec2, dir);       /* vec needs size 4 */
-                               VecSubf(stride_offset, vec2, vec1);
+                               sub_v3_v3v3(stride_offset, vec2, vec1);
                        }
                        else {
                                // we reached the end of the path, search backwards instead
                                where_on_path(ob, (pathdist-pdist)/path->totdist, vec2, dir);   /* vec needs size 4 */
-                               VecSubf(stride_offset, vec1, vec2);
+                               sub_v3_v3v3(stride_offset, vec1, vec2);
                        }
-                       Mat4Mul3Vecfl(ob->obmat, stride_offset);
+                       mul_mat3_m4_v3(ob->obmat, stride_offset);
                        return striptime;
                }
        }
@@ -1295,10 +1295,10 @@ static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float
                        }
                        if(foundvert) {
                                /* bring it into armature space */
-                               VecSubf(min, max, min);
+                               sub_v3_v3v3(min, max, min);
                                bone= get_named_bone(ob->data, strip->offs_bone);       /* weak */
                                if(bone) {
-                                       Mat4Mul3Vecfl(bone->arm_mat, min);
+                                       mul_mat3_m4_v3(bone->arm_mat, min);
                                        
                                        /* dominant motion, cyclic_offset was cleared in rest_pose */
                                        if (strip->flag & (ACTSTRIP_CYCLIC_USEX | ACTSTRIP_CYCLIC_USEY | ACTSTRIP_CYCLIC_USEZ)) {
@@ -1549,7 +1549,7 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
        }
        else if(blocktype==ID_AR) {
                /* apply stride offset to object */
-               VecAddf(ob->obmat[3], ob->obmat[3], ob->pose->stride_offset);
+               add_v3_v3v3(ob->obmat[3], ob->obmat[3], ob->pose->stride_offset);
        }
        
        /* free */
index 79372ee..e0a19da 100644 (file)
@@ -35,7 +35,7 @@
 #include "MEM_guardedalloc.h"
 #include "BLI_blenlib.h"
 #include "BLI_editVert.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_rand.h"
 #include "DNA_listBase.h"
 
@@ -134,11 +134,11 @@ void calc_curvepath(Object *ob)
        for(a=0; a<tot; a++) {
                fp++;
                if(cycl && a==tot-1)
-                       VecSubf(xyz, bevpfirst->vec, bevp->vec);
+                       sub_v3_v3v3(xyz, bevpfirst->vec, bevp->vec);
                else
-                       VecSubf(xyz, (bevp+1)->vec, bevp->vec);
+                       sub_v3_v3v3(xyz, (bevp+1)->vec, bevp->vec);
                
-               *fp= *(fp-1)+VecLength(xyz);
+               *fp= *(fp-1)+len_v3(xyz);
                bevp++;
        }
        
@@ -176,11 +176,11 @@ void calc_curvepath(Object *ob)
                fac1= fac2/fac1;
                fac2= 1.0f-fac1;
 
-               VecLerpf(pp->vec, bevp->vec, bevpn->vec, fac2);
+               interp_v3_v3v3(pp->vec, bevp->vec, bevpn->vec, fac2);
                pp->vec[3]= fac1*bevp->alfa + fac2*bevpn->alfa;
                pp->radius= fac1*bevp->radius + fac2*bevpn->radius;
-               QuatInterpol(pp->quat, bevp->quat, bevpn->quat, fac2);
-               NormalQuat(pp->quat);
+               interp_qt_qtqt(pp->quat, bevp->quat, bevpn->quat, fac2);
+               normalize_qt(pp->quat);
                
                pp++;
        }
@@ -284,20 +284,20 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir, float *quat,
                 * to more then one index in data which can give divide by zero error */
 /*
                totfac= data[0]+data[1];
-               if(totfac>0.000001)     QuatInterpol(q1, p0->quat, p1->quat, data[0] / totfac);
+               if(totfac>0.000001)     interp_qt_qtqt(q1, p0->quat, p1->quat, data[0] / totfac);
                else                            QUATCOPY(q1, p1->quat);
 
-               NormalQuat(q1);
+               normalize_qt(q1);
 
                totfac= data[2]+data[3];
-               if(totfac>0.000001)     QuatInterpol(q2, p2->quat, p3->quat, data[2] / totfac);
+               if(totfac>0.000001)     interp_qt_qtqt(q2, p2->quat, p3->quat, data[2] / totfac);
                else                            QUATCOPY(q1, p3->quat);
-               NormalQuat(q2);
+               normalize_qt(q2);
 
                totfac = data[0]+data[1]+data[2]+data[3];
-               if(totfac>0.000001)     QuatInterpol(quat, q1, q2, (data[0]+data[1]) / totfac);
+               if(totfac>0.000001)     interp_qt_qtqt(quat, q1, q2, (data[0]+data[1]) / totfac);
                else                            QUATCOPY(quat, q2);
-               NormalQuat(quat);
+               normalize_qt(quat);
                */
                // XXX - find some way to make quat interpolation work correctly, above code fails in rare but nasty cases.
                QUATCOPY(quat, p1->quat);
@@ -317,8 +317,8 @@ static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], i
        
        BLI_addtail(lb, dob);
        dob->ob= ob;
-       Mat4CpyMat4(dob->mat, mat);
-       Mat4CpyMat4(dob->omat, ob->obmat);
+       copy_m4_m4(dob->mat, mat);
+       copy_m4_m4(dob->omat, ob->obmat);
        dob->origlay= ob->lay;
        dob->index= index;
        dob->type= type;
@@ -352,20 +352,20 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i
                        
                        /* Group Dupli Offset, should apply after everything else */
                        if (group->dupli_ofs[0] || group->dupli_ofs[1] || group->dupli_ofs[2]) {
-                               Mat4CpyMat4(tmat, go->ob->obmat);
-                               VecSubf(tmat[3], tmat[3], group->dupli_ofs);
-                               Mat4MulMat4(mat, tmat, ob->obmat);
+                               copy_m4_m4(tmat, go->ob->obmat);
+                               sub_v3_v3v3(tmat[3], tmat[3], group->dupli_ofs);
+                               mul_m4_m4m4(mat, tmat, ob->obmat);
                        } else {
-                               Mat4MulMat4(mat, go->ob->obmat, ob->obmat);
+                               mul_m4_m4m4(mat, go->ob->obmat, ob->obmat);
                        }
                        
                        dob= new_dupli_object(lb, go->ob, mat, ob->lay, 0, OB_DUPLIGROUP, animated);
                        dob->no_draw= (dob->origlay & group->layer)==0;
                        
                        if(go->ob->transflag & OB_DUPLI) {
-                               Mat4CpyMat4(dob->ob->obmat, dob->mat);
+                               copy_m4_m4(dob->ob->obmat, dob->mat);
                                object_duplilist_recursive((ID *)group, scene, go->ob, lb, ob->obmat, level+1, animated);
-                               Mat4CpyMat4(dob->ob->obmat, dob->omat);
+                               copy_m4_m4(dob->ob->obmat, dob->omat);
                        }
                }
        }
@@ -402,7 +402,7 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level,
 #endif // XXX old animation system
                        where_is_object_time(scene, ob, (float)scene->r.cfra);
                        dob= new_dupli_object(lb, ob, ob->obmat, ob->lay, scene->r.cfra, OB_DUPLIFRAMES, animated);
-                       Mat4CpyMat4(dob->omat, copyob.obmat);
+                       copy_m4_m4(dob->omat, copyob.obmat);
                }
        }
 
@@ -430,11 +430,11 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
        float vec[3], q2[4], mat[3][3], tmat[4][4], obmat[4][4];
        
        VECCOPY(vec, co);
-       Mat4MulVecfl(vdd->pmat, vec);
-       VecSubf(vec, vec, vdd->pmat[3]);
-       VecAddf(vec, vec, vdd->obmat[3]);
+       mul_m4_v3(vdd->pmat, vec);
+       sub_v3_v3v3(vec, vec, vdd->pmat[3]);
+       add_v3_v3v3(vec, vec, vdd->obmat[3]);
        
-       Mat4CpyMat4(obmat, vdd->obmat);
+       copy_m4_m4(obmat, vdd->obmat);
        VECCOPY(obmat[3], vec);
        
        if(vdd->par->transflag & OB_DUPLIROT) {
@@ -445,11 +445,11 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
                        vec[0]= -no_s[0]; vec[1]= -no_s[1]; vec[2]= -no_s[2];
                }
                
-               vectoquat(vec, vdd->ob->trackflag, vdd->ob->upflag, q2);
+               vec_to_quat( q2,vec, vdd->ob->trackflag, vdd->ob->upflag);
                
-               QuatToMat3(q2, mat);
-               Mat4CpyMat4(tmat, obmat);
-               Mat4MulMat43(obmat, tmat, mat);
+               quat_to_mat3( mat,q2);
+               copy_m4_m4(tmat, obmat);
+               mul_m4_m4m3(obmat, tmat, mat);
        }
        dob= new_dupli_object(vdd->lb, vdd->ob, obmat, vdd->par->lay, index, OB_DUPLIVERTS, vdd->animated);
        if(vdd->orco)
@@ -457,10 +457,10 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
        
        if(vdd->ob->transflag & OB_DUPLI) {
                float tmpmat[4][4];
-               Mat4CpyMat4(tmpmat, vdd->ob->obmat);
-               Mat4CpyMat4(vdd->ob->obmat, obmat); /* pretend we are really this mat */
+               copy_m4_m4(tmpmat, vdd->ob->obmat);
+               copy_m4_m4(vdd->ob->obmat, obmat); /* pretend we are really this mat */
                object_duplilist_recursive((ID *)vdd->id, vdd->scene, vdd->ob, vdd->lb, obmat, vdd->level+1, vdd->animated);
-               Mat4CpyMat4(vdd->ob->obmat, tmpmat);
+               copy_m4_m4(vdd->ob->obmat, tmpmat);
        }
 }
 
@@ -478,7 +478,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
        float vec[3], no[3], pmat[4][4];
        int lay, totvert, a, oblay;
        
-       Mat4CpyMat4(pmat, par->obmat);
+       copy_m4_m4(pmat, par->obmat);
        
        /* simple preventing of too deep nested groups */
        if(level>MAX_DUPLI_RECUR) return;
@@ -533,9 +533,9 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
                                           when par_space_mat is NULL ob->obmat can be used instead of ob__obmat
                                        */
                                        if(par_space_mat)
-                                               Mat4MulMat4(vdd.obmat, ob->obmat, par_space_mat);
+                                               mul_m4_m4m4(vdd.obmat, ob->obmat, par_space_mat);
                                        else
-                                               Mat4CpyMat4(vdd.obmat, ob->obmat);
+                                               copy_m4_m4(vdd.obmat, ob->obmat);
 
                                        vdd.id= id;
                                        vdd.level= level;
@@ -544,7 +544,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
                                        vdd.ob= ob;
                                        vdd.scene= scene;
                                        vdd.par= par;
-                                       Mat4CpyMat4(vdd.pmat, pmat);
+                                       copy_m4_m4(vdd.pmat, pmat);
                                        
                                        /* mballs have a different dupli handling */
                                        if(ob->type!=OB_MBALL) ob->flag |= OB_DONE;     /* doesnt render */
@@ -596,7 +596,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
        /* simple preventing of too deep nested groups */
        if(level>MAX_DUPLI_RECUR) return;
        
-       Mat4CpyMat4(pmat, par->obmat);
+       copy_m4_m4(pmat, par->obmat);
        
        em = BKE_mesh_get_editmesh(me);
        if(em) {
@@ -664,11 +664,11 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
                                           when par_space_mat is NULL ob->obmat can be used instead of ob__obmat
                                        */
                                        if(par_space_mat)
-                                               Mat4MulMat4(ob__obmat, ob->obmat, par_space_mat);
+                                               mul_m4_m4m4(ob__obmat, ob->obmat, par_space_mat);
                                        else
-                                               Mat4CpyMat4(ob__obmat, ob->obmat);
+                                               copy_m4_m4(ob__obmat, ob->obmat);
                                        
-                                       Mat3CpyMat4(imat, ob->parentinv);
+                                       copy_m3_m4(imat, ob->parentinv);
                                                
                                        /* mballs have a different dupli handling */
                                        if(ob->type!=OB_MBALL) ob->flag |= OB_DONE;     /* doesnt render */
@@ -686,34 +686,34 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
 
                                                /* translation */
                                                if(v4)
-                                                       CalcCent4f(cent, v1, v2, v3, v4);
+                                                       cent_quad_v3(cent, v1, v2, v3, v4);
                                                else
-                                                       CalcCent3f(cent, v1, v2, v3);
-                                               Mat4MulVecfl(pmat, cent);
+                                                       cent_tri_v3(cent, v1, v2, v3);
+                                               mul_m4_v3(pmat, cent);
                                                
-                                               VecSubf(cent, cent, pmat[3]);
-                                               VecAddf(cent, cent, ob__obmat[3]);
+                                               sub_v3_v3v3(cent, cent, pmat[3]);
+                                               add_v3_v3v3(cent, cent, ob__obmat[3]);
                                                
-                                               Mat4CpyMat4(obmat, ob__obmat);
+                                               copy_m4_m4(obmat, ob__obmat);
                                                
                                                VECCOPY(obmat[3], cent);
                                                
                                                /* rotation */
-                                               triatoquat(v1, v2, v3, quat);
-                                               QuatToMat3(quat, mat);
+                                               tri_to_quat( quat,v1, v2, v3);
+                                               quat_to_mat3( mat,quat);
                                                
                                                /* scale */
                                                if(par->transflag & OB_DUPLIFACES_SCALE) {
-                                                       float size= v4? AreaQ3Dfl(v1, v2, v3, v4): AreaT3Dfl(v1, v2, v3);
+                                                       float size= v4? area_quad_v3(v1, v2, v3, v4): area_tri_v3(v1, v2, v3);
                                                        size= sqrt(size) * par->dupfacesca;
-                                                       Mat3MulFloat(mat[0], size);
+                                                       mul_m3_fl(mat[0], size);
                                                }
                                                
-                                               Mat3CpyMat3(mat3, mat);
-                                               Mat3MulMat3(mat, imat, mat3);
+                                               copy_m3_m3(mat3, mat);
+                                               mul_m3_m3m3(mat, imat, mat3);
                                                
-                                               Mat4CpyMat4(tmat, obmat);
-                                               Mat4MulMat43(obmat, tmat, mat);
+                                               copy_m4_m4(tmat, obmat);
+                                               mul_m4_m4m3(obmat, tmat, mat);
                                                
                                                dob= new_dupli_object(lb, ob, obmat, lay, a, OB_DUPLIFACES, animated);
                                                if(G.rendering) {
@@ -744,10 +744,10 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
                                                
                                                if(ob->transflag & OB_DUPLI) {
                                                        float tmpmat[4][4];
-                                                       Mat4CpyMat4(tmpmat, ob->obmat);
-                                                       Mat4CpyMat4(ob->obmat, obmat); /* pretend we are really this mat */
+                                                       copy_m4_m4(tmpmat, ob->obmat);
+                                                       copy_m4_m4(ob->obmat, obmat); /* pretend we are really this mat */
                                                        object_duplilist_recursive((ID *)id, scene, ob, lb, ob->obmat, level+1, animated);
-                                                       Mat4CpyMat4(ob->obmat, tmpmat);
+                                                       copy_m4_m4(ob->obmat, tmpmat);
                                                }
                                        }
                                        
@@ -935,22 +935,22 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
                                if(psys_get_particle_state(&sim, a, &state, 0) == 0)
                                        continue;
 
-                               QuatToMat4(state.rot, pamat);
+                               quat_to_mat4( pamat,state.rot);
                                VECCOPY(pamat[3], state.co);
                                pamat[3][3]= 1.0f;
                        }
 
                        if(part->ren_as==PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
                                for(go= part->dup_group->gobject.first, b=0; go; go= go->next, b++) {
-                                       Mat4MulMat4(tmat, oblist[b]->obmat, pamat);
-                                       Mat4MulFloat3((float *)tmat, size*scale);
+                                       mul_m4_m4m4(tmat, oblist[b]->obmat, pamat);
+                                       mul_mat3_m4_fl((float *)tmat, size*scale);
                                        if(par_space_mat)
-                                               Mat4MulMat4(mat, tmat, par_space_mat);
+                                               mul_m4_m4m4(mat, tmat, par_space_mat);
                                        else
-                                               Mat4CpyMat4(mat, tmat);
+                                               copy_m4_m4(mat, tmat);
 
                                        dob= new_dupli_object(lb, go->ob, mat, par->lay, counter, OB_DUPLIPARTS, animated);
-                                       Mat4CpyMat4(dob->omat, obcopylist[b].obmat);
+                                       copy_m4_m4(dob->omat, obcopylist[b].obmat);
                                        if(G.rendering)
                                                psys_get_dupli_texture(par, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
                                }
@@ -962,21 +962,21 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
                                VECCOPY(vec, obmat[3]);
                                obmat[3][0] = obmat[3][1] = obmat[3][2] = 0.0f;
                                
-                               Mat4CpyMat4(mat, pamat);
+                               copy_m4_m4(mat, pamat);
 
-                               Mat4MulMat4(tmat, obmat, mat);
-                               Mat4MulFloat3((float *)tmat, size*scale);
+                               mul_m4_m4m4(tmat, obmat, mat);
+                               mul_mat3_m4_fl((float *)tmat, size*scale);
 
                                if(part->draw & PART_DRAW_GLOBAL_OB)
                                        VECADD(tmat[3], tmat[3], vec);
 
                                if(par_space_mat)
-                                       Mat4MulMat4(mat, tmat, par_space_mat);
+                                       mul_m4_m4m4(mat, tmat, par_space_mat);
                                else
-                                       Mat4CpyMat4(mat, tmat);
+                                       copy_m4_m4(mat, tmat);
 
                                dob= new_dupli_object(lb, ob, mat, ob->lay, counter, OB_DUPLIPARTS, animated);
-                               Mat4CpyMat4(dob->omat, oldobmat);
+                               copy_m4_m4(dob->omat, oldobmat);
                                if(G.rendering)
                                        psys_get_dupli_texture(par, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
                        }
@@ -1037,7 +1037,7 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i
        /* simple preventing of too deep nested groups */
        if(level>MAX_DUPLI_RECUR) return;
        
-       Mat4CpyMat4(pmat, par->obmat);
+       copy_m4_m4(pmat, par->obmat);
        
        /* in par the family name is stored, use this to find the other objects */
        
@@ -1062,9 +1062,9 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i
                        vec[1]= fsize*(ct->yof - yof);
                        vec[2]= 0.0;
                        
-                       Mat4MulVecfl(pmat, vec);
+                       mul_m4_v3(pmat, vec);
                        
-                       Mat4CpyMat4(obmat, par->obmat);
+                       copy_m4_m4(obmat, par->obmat);
                        VECCOPY(obmat[3], vec);
                        
                        new_dupli_object(lb, ob, obmat, par->lay, a, OB_DUPLIVERTS, animated);
@@ -1122,7 +1122,7 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
                if (level==0) {
                        for(dob= duplilist->first; dob; dob= dob->next)
                                if(dob->type == OB_DUPLIGROUP)
-                                       Mat4CpyMat4(dob->ob->obmat, dob->mat);
+                                       copy_m4_m4(dob->ob->obmat, dob->mat);
                }
        }
 }
@@ -1143,7 +1143,7 @@ void free_object_duplilist(ListBase *lb)
        
        for(dob= lb->first; dob; dob= dob->next) {
                dob->ob->lay= dob->origlay;
-               Mat4CpyMat4(dob->ob->obmat, dob->omat);
+               copy_m4_m4(dob->ob->obmat, dob->omat);
        }
        
        BLI_freelistN(lb);
index 61e754f..e284982 100644 (file)
@@ -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"
index 2515171..ab1f60e 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_blenlib.h"
 
 #include "DNA_armature_types.h"
@@ -482,7 +482,7 @@ static void equalize_bezier(float *data, int desired)
        pdist[0]= 0.0f;
        for(a=0, fp= data; a<MAX_BBONE_SUBDIV; a++, fp+=4) {
                QUATCOPY(temp[a], fp);
-               pdist[a+1]= pdist[a]+VecLenf(fp, fp+4);
+               pdist[a+1]= pdist[a]+len_v3v3(fp, fp+4);
        }
        /* do last point */
        QUATCOPY(temp[a], fp);
@@ -532,16 +532,16 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
 
        if(!rest) {
                /* check if we need to take non-uniform bone scaling into account */
-               scale[0]= VecLength(pchan->pose_mat[0]);
-               scale[1]= VecLength(pchan->pose_mat[1]);
-               scale[2]= VecLength(pchan->pose_mat[2]);
+               scale[0]= len_v3(pchan->pose_mat[0]);
+               scale[1]= len_v3(pchan->pose_mat[1]);
+               scale[2]= len_v3(pchan->pose_mat[2]);
 
                if(fabs(scale[0] - scale[1]) > 1e-6f || fabs(scale[1] - scale[2]) > 1e-6f) {
-                       Mat4One(scalemat);
+                       unit_m4(scalemat);
                        scalemat[0][0]= scale[0];
                        scalemat[1][1]= scale[1];
                        scalemat[2][2]= scale[2];
-                       Mat4Invert(iscalemat, scalemat);
+                       invert_m4_m4(iscalemat, scalemat);
 
                        length *= scale[1];
                        doscale = 1;
@@ -564,15 +564,15 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
                last point =  (0, length, 0) */
        
        if(rest) {
-               Mat4Invert(imat, pchan->bone->arm_mat);
+               invert_m4_m4(imat, pchan->bone->arm_mat);
        }
        else if(doscale) {
-               Mat4CpyMat4(posemat, pchan->pose_mat);
-               Mat4Ortho(posemat);
-               Mat4Invert(imat, posemat);
+               copy_m4_m4(posemat, pchan->pose_mat);
+               normalize_m4(posemat);
+               invert_m4_m4(imat, posemat);
        }
        else
-               Mat4Invert(imat, pchan->pose_mat);
+               invert_m4_m4(imat, pchan->pose_mat);
        
        if(prev) {
                float difmat[4][4], result[3][3], imat3[3][3];
@@ -582,7 +582,7 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
                        VECCOPY(h1, prev->bone->arm_head)
                else
                        VECCOPY(h1, prev->pose_head)
-               Mat4MulVecfl(imat, h1);
+               mul_m4_v3(imat, h1);
 
                if(prev->bone->segments>1) {
                        /* if previous bone is B-bone too, use average handle direction */
@@ -590,21 +590,21 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
                        roll1= 0.0f;
                }
 
-               Normalize(h1);
-               VecMulf(h1, -hlength1);
+               normalize_v3(h1);
+               mul_v3_fl(h1, -hlength1);
 
                if(prev->bone->segments==1) {
                        /* find the previous roll to interpolate */
                        if(rest)
-                               Mat4MulMat4(difmat, prev->bone->arm_mat, imat);
+                               mul_m4_m4m4(difmat, prev->bone->arm_mat, imat);
                        else
-                               Mat4MulMat4(difmat, prev->pose_mat, imat);
-                       Mat3CpyMat4(result, difmat);                            // the desired rotation at beginning of next bone
+                               mul_m4_m4m4(difmat, prev->pose_mat, imat);
+                       copy_m3_m4(result, difmat);                             // the desired rotation at beginning of next bone
                        
                        vec_roll_to_mat3(h1, 0.0f, mat3);                       // the result of vec_roll without roll
                        
-                       Mat3Inv(imat3, mat3);
-                       Mat3MulMat3(mat3, result, imat3);                       // the matrix transforming vec_roll to desired roll
+                       invert_m3_m3(imat3, mat3);
+                       mul_m3_m3m3(mat3, result, imat3);                       // the matrix transforming vec_roll to desired roll
                        
                        roll1= (float)atan2(mat3[2][0], mat3[2][2]);
                }
@@ -621,28 +621,28 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
                        VECCOPY(h2, next->bone->arm_tail)
                else
                        VECCOPY(h2, next->pose_tail)
-               Mat4MulVecfl(imat, h2);
+               mul_m4_v3(imat, h2);
                /* if next bone is B-bone too, use average handle direction */
                if(next->bone->segments>1);
                else h2[1]-= length;
-               Normalize(h2);
+               normalize_v3(h2);
                
                /* find the next roll to interpolate as well */
                if(rest)
-                       Mat4MulMat4(difmat, next->bone->arm_mat, imat);
+                       mul_m4_m4m4(difmat, next->bone->arm_mat, imat);
                else
-                       Mat4MulMat4(difmat, next->pose_mat, imat);
-               Mat3CpyMat4(result, difmat);                            // the desired rotation at beginning of next bone
+                       mul_m4_m4m4(difmat, next->pose_mat, imat);
+               copy_m3_m4(result, difmat);                             // the desired rotation at beginning of next bone
                
                vec_roll_to_mat3(h2, 0.0f, mat3);                       // the result of vec_roll without roll
                
-               Mat3Inv(imat3, mat3);
-               Mat3MulMat3(mat3, imat3, result);                       // the matrix transforming vec_roll to desired roll
+               invert_m3_m3(imat3, mat3);
+               mul_m3_m3m3(mat3, imat3, result);                       // the matrix transforming vec_roll to desired roll
                
                roll2= (float)atan2(mat3[2][0], mat3[2][2]);
                
                /* and only now negate handle */
-               VecMulf(h2, -hlength2);
+               mul_v3_fl(h2, -hlength2);
        }
        else {
                h2[0]= 0.0f; h2[1]= -hlength2; h2[2]= 0.0f;
@@ -662,15 +662,15 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
        
        /* make transformation matrices for the segments for drawing */
        for(a=0, fp= data[0]; a<bone->segments; a++, fp+=4) {
-               VecSubf(h1, fp+4, fp);
+               sub_v3_v3v3(h1, fp+4, fp);
                vec_roll_to_mat3(h1, fp[3], mat3);              // fp[3] is roll
 
-               Mat4CpyMat3(result_array[a].mat, mat3);
+               copy_m4_m3(result_array[a].mat, mat3);
                VECCOPY(result_array[a].mat[3], fp);
 
                if(doscale) {
                        /* correct for scaling when this matrix is used in scaled space */
-                       Mat4MulSerie(result_array[a].mat, iscalemat, result_array[a].mat,
+                       mul_serie_m4(result_array[a].mat, iscalemat, result_array[a].mat,
                                scalemat, NULL, NULL, NULL, NULL, NULL);
                }
        }
@@ -701,26 +701,26 @@ static void pchan_b_bone_defmats(bPoseChannel *pchan, int use_quaternion, int re
        
        /* first matrix is the inverse arm_mat, to bring points in local bone space
           for finding out which segment it belongs to */
-       Mat4Invert(b_bone_mats[0].mat, bone->arm_mat);
+       invert_m4_m4(b_bone_mats[0].mat, bone->arm_mat);
 
        /* then we make the b_bone_mats:
            - first transform to local bone space
                - translate over the curve to the bbone mat space
                - transform with b_bone matrix
                - transform back into global space */
-       Mat4One(tmat);
+       unit_m4(tmat);
 
        for(a=0; a<bone->segments; a++) {
                if(b_bone_rest)
-                       Mat4Invert(tmat, b_bone_rest[a].mat);
+                       invert_m4_m4(tmat, b_bone_rest[a].mat);
                else
                        tmat[3][1] = -a*(bone->length/(float)bone->segments);
 
-               Mat4MulSerie(b_bone_mats[a+1].mat, pchan->chan_mat, bone->arm_mat,
+               mul_serie_m4(b_bone_mats[a+1].mat, pchan->chan_mat, bone->arm_mat,
                        b_bone[a].mat, tmat, b_bone_mats[0].mat, NULL, NULL, NULL);
 
                if(use_quaternion)
-                       Mat4ToDQuat(bone->arm_mat, b_bone_mats[a+1].mat, &b_bone_dual_quats[a]);
+                       mat4_to_dquat( &b_bone_dual_quats[a],bone->arm_mat, b_bone_mats[a+1].mat);
        }
 }
 
@@ -743,13 +743,13 @@ static void b_bone_deform(bPoseChannel *pchan, Bone *bone, float *co, DualQuat *
        CLAMP(a, 0, bone->segments-1);
 
        if(dq) {
-               DQuatCpyDQuat(dq, &((DualQuat*)pchan->b_bone_dual_quats)[a]);
+               copy_dq_dq(dq, &((DualQuat*)pchan->b_bone_dual_quats)[a]);
        }
        else {
-               Mat4MulVecfl(b_bone[a+1].mat, co);
+               mul_m4_v3(b_bone[a+1].mat, co);
 
                if(defmat)
-                       Mat3CpyMat4(defmat, b_bone[a+1].mat);
+                       copy_m3_m4(defmat, b_bone[a+1].mat);
        }
 }
 
@@ -761,10 +761,10 @@ float distfactor_to_bone (float vec[3], float b1[3], float b2[3], float rad1, fl
        float pdelta[3];
        float hsqr, a, l, rad;
        
-       VecSubf (bdelta, b2, b1);
-       l = Normalize (bdelta);
+       sub_v3_v3v3(bdelta, b2, b1);
+       l = normalize_v3(bdelta);
        
-       VecSubf (pdelta, vec, b1);
+       sub_v3_v3v3(pdelta, vec, b1);
        
        a = bdelta[0]*pdelta[0] + bdelta[1]*pdelta[1] + bdelta[2]*pdelta[2];
        hsqr = ((pdelta[0]*pdelta[0]) + (pdelta[1]*pdelta[1]) + (pdelta[2]*pdelta[2]));
@@ -809,12 +809,12 @@ static void pchan_deform_mat_add(bPoseChannel *pchan, float weight, float bbonem
        float wmat[3][3];
 
        if(pchan->bone->segments>1)
-               Mat3CpyMat3(wmat, bbonemat);
+               copy_m3_m3(wmat, bbonemat);
        else
-               Mat3CpyMat4(wmat, pchan->chan_mat);
+               copy_m3_m4(wmat, pchan->chan_mat);
 
-       Mat3MulFloat((float*)wmat, weight);
-       Mat3AddMat3(mat, mat, wmat);
+       mul_m3_fl((float*)wmat, weight);
+       add_m3_m3m3(mat, mat, wmat);
 }
 
 static float dist_bone_deform(bPoseChannel *pchan, float *vec, DualQuat *dq, float mat[][3], float *co)
@@ -840,12 +840,12 @@ static float dist_bone_deform(bPoseChannel *pchan, float *vec, DualQuat *dq, flo
                                        // applies on cop and bbonemat
                                        b_bone_deform(pchan, bone, cop, NULL, (mat)?bbonemat:NULL);
                                else
-                                       Mat4MulVecfl(pchan->chan_mat, cop);
+                                       mul_m4_v3(pchan->chan_mat, cop);
 
                                //      Make this a delta from the base position
-                               VecSubf (cop, cop, co);
+                               sub_v3_v3v3(cop, cop, co);
                                cop[0]*=fac; cop[1]*=fac; cop[2]*=fac;
-                               VecAddf (vec, vec, cop);
+                               add_v3_v3v3(vec, vec, cop);
 
                                if(mat)
                                        pchan_deform_mat_add(pchan, fac, bbonemat, mat);
@@ -853,10 +853,10 @@ static float dist_bone_deform(bPoseChannel *pchan, float *vec, DualQuat *dq, flo
                        else {
                                if(bone->segments>1) {
                                        b_bone_deform(pchan, bone, cop, &bbonedq, NULL);
-                                       DQuatAddWeighted(dq, &bbonedq, fac);
+                                       add_weighted_dq_dq(dq, &bbonedq, fac);
                                }
                                else
-                                       DQuatAddWeighted(dq, pchan->dual_quat, fac);
+                                       add_weighted_dq_dq(dq, pchan->dual_quat, fac);
                        }
                }
        }
@@ -879,7 +879,7 @@ static void pchan_bone_deform(bPoseChannel *pchan, float weight, float *vec, Dua
                        // applies on cop and bbonemat
                        b_bone_deform(pchan, pchan->bone, cop, NULL, (mat)?bbonemat:NULL);
                else
-                       Mat4MulVecfl(pchan->chan_mat, cop);
+                       mul_m4_v3(pchan->chan_mat, cop);
                
                vec[0]+=(cop[0]-co[0])*weight;
                vec[1]+=(cop[1]-co[1])*weight;
@@ -891,10 +891,10 @@ static void pchan_bone_deform(bPoseChannel *pchan, float weight, float *vec, Dua
        else {
                if(pchan->bone->segments>1) {
                        b_bone_deform(pchan, pchan->bone, cop, &bbonedq, NULL);
-                       DQuatAddWeighted(dq, &bbonedq, weight);
+                       add_weighted_dq_dq(dq, &bbonedq, weight);
                }
                else
-                       DQuatAddWeighted(dq, pchan->dual_quat, weight);
+                       add_weighted_dq_dq(dq, pchan->dual_quat, weight);
        }
 
        (*contrib)+=weight;
@@ -923,10 +923,10 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
 
        if(arm->edbo) return;
        
-       Mat4Invert(obinv, target->obmat);
-       Mat4CpyMat4(premat, target->obmat);
-       Mat4MulMat4(postmat, armOb->obmat, obinv);
-       Mat4Invert(premat, postmat);
+       invert_m4_m4(obinv, target->obmat);
+       copy_m4_m4(premat, target->obmat);
+       mul_m4_m4m4(postmat, armOb->obmat, obinv);
+       invert_m4_m4(premat, postmat);
 
        /* bone defmats are already in the channels, chan_mat */
        
@@ -944,7 +944,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
 
                        if(use_quaternion) {
                                pchan->dual_quat= &dualquats[totchan++];
-                               Mat4ToDQuat(pchan->bone->arm_mat, pchan->chan_mat, pchan->dual_quat);
+                               mat4_to_dquat( pchan->dual_quat,pchan->bone->arm_mat, pchan->chan_mat);
                        }
                }
        }
@@ -1013,7 +1013,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
                        vec= sumvec;
 
                        if(defMats) {
-                               Mat3Clr((float*)summat);
+                               zero_m3((float*)summat);
                                smat = summat;
                        }
                }
@@ -1050,7 +1050,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
                co= prevCos?prevCos[i]:vertexCos[i];
                
                /* Apply the object's matrix */
-               Mat4MulVecfl(premat, co);
+               mul_m4_v3(premat, co);
                
                if(use_dverts && dvert && dvert->totweight) { // use weight groups ?
                        int deformed = 0;
@@ -1096,42 +1096,42 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
                /* actually should be EPSILON? weight values and contrib can be like 10e-39 small */
                if(contrib > 0.0001f) {
                        if(use_quaternion) {
-                               DQuatNormalize(dq, contrib);
+                               normalize_dq(dq, contrib);
 
                                if(armature_weight != 1.0f) {
                                        VECCOPY(dco, co);
-                                       DQuatMulVecfl(dq, dco, (defMats)? summat: NULL);
-                                       VecSubf(dco, dco, co);
-                                       VecMulf(dco, armature_weight);
-                                       VecAddf(co, co, dco);
+                                       mul_v3m3_dq( dco, (defMats)? summat: NULL,dq);
+                                       sub_v3_v3v3(dco, dco, co);
+                                       mul_v3_fl(dco, armature_weight);
+                                       add_v3_v3v3(co, co, dco);
                                }
                                else
-                                       DQuatMulVecfl(dq, co, (defMats)? summat: NULL);
+                                       mul_v3m3_dq( co, (defMats)? summat: NULL,dq);
 
                                smat = summat;
                        }
                        else {
-                               VecMulf(vec, armature_weight/contrib);
-                               VecAddf(co, vec, co);
+                               mul_v3_fl(vec, armature_weight/contrib);
+                               add_v3_v3v3(co, vec, co);
                        }
 
                        if(defMats) {
                                float pre[3][3], post[3][3], tmpmat[3][3];
 
-                               Mat3CpyMat4(pre, premat);
-                               Mat3CpyMat4(post, postmat);
-                               Mat3CpyMat3(tmpmat, defMats[i]);
+                               copy_m3_m4(pre, premat);
+                               copy_m3_m4(post, postmat);
+                               copy_m3_m3(tmpmat, defMats[i]);
 
                                if(!use_quaternion) /* quaternion already is scale corrected */
-                                       Mat3MulFloat((float*)smat, armature_weight/contrib);
+                                       mul_m3_fl((float*)smat, armature_weight/contrib);
 
-                               Mat3MulSerie(defMats[i], tmpmat, pre, smat, post,
+                               mul_serie_m3(defMats[i], tmpmat, pre, smat, post,
                                        NULL, NULL, NULL, NULL);
                        }
                }
                
                /* always, check above code */
-               Mat4MulVecfl(postmat, co);
+               mul_m4_v3(postmat, co);
                
                
                /* interpolate with previous modifier position using weight group */
@@ -1165,7 +1165,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
 
 void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[][4], int root, int posed)
 {
-       Mat4CpyMat4(M_accumulatedMatrix, bone->arm_mat);
+       copy_m4_m4(M_accumulatedMatrix, bone->arm_mat);
 }
 
 /* **************** Space to Space API ****************** */
@@ -1179,10 +1179,10 @@ void armature_mat_world_to_pose(Object *ob, float inmat[][4], float outmat[][4])
        if (ob==NULL) return;
        
        /* get inverse of (armature) object's matrix  */
-       Mat4Invert(obmat, ob->obmat);
+       invert_m4_m4(obmat, ob->obmat);
        
        /* multiply given matrix by object's-inverse to find pose-space matrix */
-       Mat4MulMat4(outmat, obmat, inmat);
+       mul_m4_m4m4(outmat, obmat, inmat);
 }
 
 /* Convert Wolrd-Space Location to Pose-Space Location
@@ -1195,7 +1195,7 @@ void armature_loc_world_to_pose(Object *ob, float *inloc, float *outloc)
        float nLocMat[4][4];
        
        /* build matrix for location */
-       Mat4One(xLocMat);
+       unit_m4(xLocMat);
        VECCOPY(xLocMat[3], inloc);
 
        /* get bone-space cursor matrix and extract location */
@@ -1217,24 +1217,24 @@ void armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[][4], float outm
        
        /* get the inverse matrix of the pchan's transforms */
        if (pchan->rotmode)
-               LocEulSizeToMat4(pc_trans, pchan->loc, pchan->eul, pchan->size);
+               loc_eul_size_to_mat4(pc_trans, pchan->loc, pchan->eul, pchan->size);
        else
-               LocQuatSizeToMat4(pc_trans, pchan->loc, pchan->quat, pchan->size);
-       Mat4Invert(inv_trans, pc_trans);
+               loc_quat_size_to_mat4(pc_trans, pchan->loc, pchan->quat, pchan->size);
+       invert_m4_m4(inv_trans, pc_trans);
        
        /* Remove the pchan's transforms from it's pose_mat.
         * This should leave behind the effects of restpose + 
         * parenting + constraints
         */
-       Mat4MulMat4(pc_posemat, inv_trans, pchan->pose_mat);
+       mul_m4_m4m4(pc_posemat, inv_trans, pchan->pose_mat);
        
        /* get the inverse of the leftovers so that we can remove 
         * that component from the supplied matrix
         */
-       Mat4Invert(inv_posemat, pc_posemat);
+       invert_m4_m4(inv_posemat, pc_posemat);
        
        /* get the new matrix */
-       Mat4MulMat4(outmat, inmat, inv_posemat);
+       mul_m4_m4m4(outmat, inmat, inv_posemat);
 }
 
 /* Convert Pose-Space Location to Bone-Space Location
@@ -1247,7 +1247,7 @@ void armature_loc_pose_to_bone(bPoseChannel *pchan, float *inloc, float *outloc)
        float nLocMat[4][4];
        
        /* build matrix for location */
-       Mat4One(xLocMat);
+       unit_m4(xLocMat);
        VECCOPY(xLocMat[3], inloc);
 
        /* get bone-space cursor matrix and extract location */
@@ -1263,8 +1263,8 @@ void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float
 {
        float imat[4][4];
  
-       Mat4Invert(imat, arm_mat);
-       Mat4MulMat4(delta_mat, pose_mat, imat);
+       invert_m4_m4(imat, arm_mat);
+       mul_m4_m4m4(delta_mat, pose_mat, imat);
 }
 
 /* **************** Rotation Mode Conversions ****************************** */
@@ -1280,33 +1280,33 @@ void BKE_rotMode_change_values (float quat[4], float eul[3], float axis[3], floa
        if (newMode > 0) { /* to euler */
                if (oldMode == ROT_MODE_AXISANGLE) {
                        /* axis-angle to euler */
-                       AxisAngleToEulO(axis, *angle, eul, newMode);
+                       axis_angle_to_eulO( eul, newMode,axis, *angle);
                }
                else if (oldMode == ROT_MODE_QUAT) {
                        /* quat to euler */
-                       QuatToEulO(quat, eul, newMode);
+                       quat_to_eulO( eul, newMode,quat);
                }
                /* else { no conversion needed } */
        }
        else if (newMode == ROT_MODE_QUAT) { /* to quat */
                if (oldMode == ROT_MODE_AXISANGLE) {
                        /* axis angle to quat */
-                       AxisAngleToQuat(quat, axis, *angle);
+                       axis_angle_to_quat(quat, axis, *angle);
                }
                else if (oldMode > 0) {
                        /* euler to quat */
-                       EulOToQuat(eul, oldMode, quat);
+                       eulO_to_quat( quat,eul, oldMode);
                }
                /* else { no conversion needed } */
        }
        else if (newMode == ROT_MODE_AXISANGLE) { /* to axis-angle */
                if (oldMode > 0) {
                        /* euler to axis angle */
-                       EulOToAxisAngle(eul, oldMode, axis, angle);
+                       eulO_to_axis_angle( axis, angle,eul, oldMode);
                }
                else if (oldMode == ROT_MODE_QUAT) {
                        /* quat to axis angle */
-                       QuatToAxisAngle(quat, axis, angle);
+                       quat_to_axis_angle( axis, angle,quat);
                }
                
                /* when converting to axis-angle, we need a special exception for the case when there is no axis */
@@ -1341,14 +1341,14 @@ void BKE_rotMode_change_values (float quat[4], float eul[3], float axis[3], floa
 void mat3_to_vec_roll(float mat[][3], float *vec, float *roll) 
 {
     if (vec)
-        VecCopyf(vec, mat[1]);
+        copy_v3_v3(vec, mat[1]);
 
     if (roll) {
         float vecmat[3][3], vecmatinv[3][3], rollmat[3][3];
 
         vec_roll_to_mat3(mat[1], 0.0f, vecmat);
-        Mat3Inv(vecmatinv, vecmat);
-        Mat3MulMat3(rollmat, vecmatinv, mat);
+        invert_m3_m3(vecmatinv, vecmat);
+        mul_m3_m3m3(rollmat, vecmatinv, mat);
 
         *roll= (float)atan2(rollmat[2][0], rollmat[2][2]);
     }
@@ -1363,26 +1363,26 @@ void vec_roll_to_mat3(float *vec, float roll, float mat[][3])
        float   rMatrix[3][3], bMatrix[3][3];
        
        VECCOPY (nor, vec);
-       Normalize (nor);
+       normalize_v3(nor);
        
        /*      Find Axis & Amount for bone matrix*/
-       Crossf (axis,target,nor);
+       cross_v3_v3v3(axis,target,nor);
 
-       if (Inpf(axis,axis) > 0.0000000000001) {
+       if (dot_v3v3(axis,axis) > 0.0000000000001) {
                /* if nor is *not* a multiple of target ... */
-               Normalize (axis);
+               normalize_v3(axis);
                
-               theta= NormalizedVecAngle2(target, nor);
+               theta= angle_normalized_v3v3(target, nor);
                
                /*      Make Bone matrix*/
-               VecRotToMat3(axis, theta, bMatrix);
+               vec_rot_to_mat3( bMatrix,axis, theta);
        }
        else {
                /* if nor is a multiple of target ... */
                float updown;
                
                /* point same direction, or opposite? */
-               updown = ( Inpf (target,nor) > 0 ) ? 1.0f : -1.0f;
+               updown = ( dot_v3v3(target,nor) > 0 ) ? 1.0f : -1.0f;
                
                /* I think this should work ... */
                bMatrix[0][0]=updown; bMatrix[0][1]=0.0;    bMatrix[0][2]=0.0;
@@ -1391,10 +1391,10 @@ void vec_roll_to_mat3(float *vec, float roll, float mat[][3])
        }
        
        /*      Make Roll matrix*/
-       VecRotToMat3(nor, roll, rMatrix);
+       vec_rot_to_mat3( rMatrix,nor, roll);
        
        /*      Combine and output result*/
-       Mat3MulMat3 (mat, rMatrix, bMatrix);
+       mul_m3_m3m3(mat, rMatrix, bMatrix);
 }
 
 
@@ -1405,10 +1405,10 @@ void where_is_armature_bone(Bone *bone, Bone *prevbone)
        float vec[3];
        
        /* Bone Space */
-       VecSubf (vec, bone->tail, bone->head);
+       sub_v3_v3v3(vec, bone->tail, bone->head);
        vec_roll_to_mat3(vec, bone->roll, bone->bone_mat);
 
-       bone->length= VecLenf(bone->head, bone->tail);
+       bone->length= len_v3v3(bone->head, bone->tail);
        
        /* this is called on old file reading too... */
        if(bone->xwidth==0.0) {
@@ -1421,7 +1421,7 @@ void where_is_armature_bone(Bone *bone, Bone *prevbone)
                float offs_bone[4][4];  // yoffs(b-1) + root(b) + bonemat(b)
                
                /* bone transform itself */
-               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);
@@ -1430,10 +1430,10 @@ void where_is_armature_bone(Bone *bone, Bone *prevbone)
                offs_bone[3][1]+= prevbone->length;
                
                /* Compose the matrix for this bone  */
-               Mat4MulMat4(bone->arm_mat, offs_bone, prevbone->arm_mat);
+               mul_m4_m4m4(bone->arm_mat, offs_bone, prevbone->arm_mat);
        }
        else {
-               Mat4CpyMat3(bone->arm_mat, bone->bone_mat);
+               copy_m4_m3(bone->arm_mat, bone->bone_mat);
                VECCOPY(bone->arm_mat[3], bone->head);
        }
        
@@ -1441,8 +1441,8 @@ void where_is_armature_bone(Bone *bone, Bone *prevbone)
        VECCOPY(bone->arm_head, bone->arm_mat[3]);
        /* tail is in current local coord system */
        VECCOPY(vec, bone->arm_mat[1]);
-       VecMulf(vec, bone->length);
-       VecAddf(bone->arm_tail, bone->arm_head, vec);
+       mul_v3_fl(vec, bone->length);
+       add_v3_v3v3(bone->arm_tail, bone->arm_head, vec);
        
        /* and the kiddies */
        prevbone= bone;
@@ -1824,7 +1824,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
        /* step 1a: get xyz positions for the tail endpoint of the bone */
        if ( where_on_path(ikData->tar, tree->points[index], vec, dir, NULL, &rad) ) {
                /* convert the position to pose-space, then store it */
-               Mat4MulVecfl(ob->imat, vec);
+               mul_m4_v3(ob->imat, vec);
                VECCOPY(poseTail, vec);
                
                /* set the new radius */
@@ -1834,7 +1834,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
        /* step 1b: get xyz positions for the head endpoint of the bone */
        if ( where_on_path(ikData->tar, tree->points[index+1], vec, dir, NULL, &rad) ) {
                /* store the position, and convert it to pose space */
-               Mat4MulVecfl(ob->imat, vec);
+               mul_m4_v3(ob->imat, vec);
                VECCOPY(poseHead, vec);
                
                /* set the new radius (it should be the average value) */
@@ -1845,8 +1845,8 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
         *      - splineVec: the vector direction that the spline applies on the bone
         *      - scaleFac: the factor that the bone length is scaled by to get the desired amount
         */
-       VecSubf(splineVec, poseTail, poseHead);
-       scaleFac= VecLength(splineVec) / pchan->bone->length;
+       sub_v3_v3v3(splineVec, poseTail, poseHead);
+       scaleFac= len_v3(splineVec) / pchan->bone->length;
        
        /* step 3: compute the shortest rotation needed to map from the bone rotation to the current axis 
         *      - this uses the same method as is used for the Damped Track Constraint (see the code there for details)
@@ -1861,45 +1861,45 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
                VECCOPY(rmat[0], pchan->pose_mat[0]);
                VECCOPY(rmat[1], pchan->pose_mat[1]);
                VECCOPY(rmat[2], pchan->pose_mat[2]);
-               Mat3Ortho(rmat);
+               normalize_m3(rmat);
                
                /* also, normalise the orientation imposed by the bone, now that we've extracted the scale factor */
-               Normalize(splineVec);
+               normalize_v3(splineVec);
                
                /* calculate smallest axis-angle rotation necessary for getting from the
                 * current orientation of the bone, to the spline-imposed direction
                 */
-               Crossf(raxis, rmat[1], splineVec);
+               cross_v3_v3v3(raxis, rmat[1], splineVec);
                
-               rangle= Inpf(rmat[1], splineVec);
+               rangle= dot_v3v3(rmat[1], splineVec);
                rangle= acos( MAX2(-1.0f, MIN2(1.0f, rangle)) );
                
                /* construct rotation matrix from the axis-angle rotation found above 
                 *      - this call takes care to make sure that the axis provided is a unit vector first
                 */
-               AxisAngleToMat3(raxis, rangle, dmat);
+               axis_angle_to_mat3( dmat,raxis, rangle);
                
                /* combine these rotations so that the y-axis of the bone is now aligned as the spline dictates,
                 * while still maintaining roll control from the existing bone animation
                 */
-               Mat3MulMat3(tmat, dmat, rmat); // m1, m3, m2
-               Mat3Ortho(tmat); /* attempt to reduce shearing, though I doubt this'll really help too much now... */
-               Mat4CpyMat3(poseMat, tmat);
+               mul_m3_m3m3(tmat, dmat, rmat); // m1, m3, m2
+               normalize_m3(tmat); /* attempt to reduce shearing, though I doubt this'll really help too much now... */
+               copy_m4_m3(poseMat, tmat);
        }
        
        /* step 4: set the scaling factors for the axes */
        // TODO: include a no-scale option?
        {
                /* only multiply the y-axis by the scaling factor to get nice volume-preservation */
-               VecMulf(poseMat[1], scaleFac);
+               mul_v3_fl(poseMat[1], scaleFac);
                
                /* set the scaling factors of the x and z axes from... */
                switch (ikData->xzScaleMode) {
                        case CONSTRAINT_SPLINEIK_XZS_RADIUS:
                        {
                                /* radius of curve */
-                               VecMulf(poseMat[0], radius);
-                               VecMulf(poseMat[2], radius);
+                               mul_v3_fl(poseMat[0], radius);
+                               mul_v3_fl(poseMat[2], radius);
                        }
                                break;
                        case CONSTRAINT_SPLINEIK_XZS_ORIGINAL:
@@ -1908,11 +1908,11 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
                                float scale;
                                
                                /* x-axis scale */
-                               scale= VecLength(pchan->pose_mat[0]);
-                               VecMulf(poseMat[0], scale);
+                               scale= len_v3(pchan->pose_mat[0]);
+                               mul_v3_fl(poseMat[0], scale);
                                /* z-axis scale */
-                               scale= VecLength(pchan->pose_mat[2]);
-                               VecMulf(poseMat[2], scale);
+                               scale= len_v3(pchan->pose_mat[2]);
+                               mul_v3_fl(poseMat[2], scale);
                        }
                                break;
                }
@@ -1922,7 +1922,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
        VECCOPY(poseMat[3], poseHead);
        
        /* finally, store the new transform */
-       Mat4CpyMat4(pchan->pose_mat, poseMat);
+       copy_m4_m4(pchan->pose_mat, poseMat);
        VECCOPY(pchan->pose_head, poseHead);
        VECCOPY(pchan->pose_tail, poseTail);
        
@@ -1974,26 +1974,26 @@ void chan_calc_mat(bPoseChannel *chan)
        float tmat[3][3];
        
        /* get scaling matrix */
-       SizeToMat3(chan->size, smat);
+       size_to_mat3( smat,chan->size);
        
        /* rotations may either be quats, eulers (with various rotation orders), or axis-angle */
        if (chan->rotmode > 0) {
                /* euler rotations (will cause gimble lock, but this can be alleviated a bit with rotation orders) */
-               EulOToMat3(chan->eul, chan->rotmode, rmat);
+               eulO_to_mat3( rmat,chan->eul, chan->rotmode);
        }
        else if (chan->rotmode == ROT_MODE_AXISANGLE) {
                /* axis-angle - not really that great for 3D-changing orientations */
-               AxisAngleToMat3(chan->rotAxis, chan->rotAngle, rmat);
+               axis_angle_to_mat3( rmat,chan->rotAxis, chan->rotAngle);
        }
        else {
                /* quats are normalised before use to eliminate scaling issues */
-               NormalQuat(chan->quat); // TODO: do this with local vars only!
-               QuatToMat3(chan->quat, rmat);
+               normalize_qt(chan->quat); // TODO: do this with local vars only!
+               quat_to_mat3( rmat,chan->quat);
        }
        
        /* calculate matrix of bone (as 3x3 matrix, but then copy the 4x4) */
-       Mat3MulMat3(tmat, rmat, smat);
-       Mat4CpyMat3(chan->chan_mat, tmat);
+       mul_m3_m3m3(tmat, rmat, smat);
+       copy_m4_m3(chan->chan_mat, tmat);
        
        /* prevent action channels breaking chains */
        /* need to check for bone here, CONSTRAINT_TYPE_ACTION uses this call */
@@ -2057,8 +2057,8 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
                                                        float mat4[4][4], mat3[3][3];
                                                        
                                                        curve_deform_vector(scene, amod->ob, armob, bone->arm_mat[3], pchan->pose_mat[3], mat3, amod->no_rot_axis);
-                                                       Mat4CpyMat4(mat4, pchan->pose_mat);
-                                                       Mat4MulMat34(pchan->pose_mat, mat3, mat4);
+                                                       copy_m4_m4(mat4, pchan->pose_mat);
+                                                       mul_m4_m3m4(pchan->pose_mat, mat3, mat4);
                                                        
                                                }
                                        }
@@ -2075,8 +2075,8 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
                                                
                                                /* make a copy of starting conditions */
                                                VECCOPY(loc, pchan->pose_mat[3]);
-                                               Mat4ToEul(pchan->pose_mat, eul);
-                                               Mat4ToSize(pchan->pose_mat, size);
+                                               mat4_to_eul( eul,pchan->pose_mat);
+                                               mat4_to_size( size,pchan->pose_mat);
                                                VECCOPY(eulo, eul);
                                                VECCOPY(sizeo, size);
                                                
@@ -2086,14 +2086,14 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
                                                        nor[0] = BLI_gNoise(amod->noisesize, size[0]+ofs, size[1], size[2], 0, 0) - ofs;
                                                        nor[1] = BLI_gNoise(amod->noisesize, size[0], size[1]+ofs, size[2], 0, 0) - ofs;        
                                                        nor[2] = BLI_gNoise(amod->noisesize, size[0], size[1], size[2]+ofs, 0, 0) - ofs;
-                                                       VecAddf(size, size, nor);
+                                                       add_v3_v3v3(size, size, nor);
                                                        
                                                        if (sizeo[0] != 0)
-                                                               VecMulf(pchan->pose_mat[0], size[0] / sizeo[0]);
+                                                               mul_v3_fl(pchan->pose_mat[0], size[0] / sizeo[0]);
                                                        if (sizeo[1] != 0)
-                                                               VecMulf(pchan->pose_mat[1], size[1] / sizeo[1]);
+                                                               mul_v3_fl(pchan->pose_mat[1], size[1] / sizeo[1]);
                                                        if (sizeo[2] != 0)
-                                                               VecMulf(pchan->pose_mat[2], size[2] / sizeo[2]);
+                                                               mul_v3_fl(pchan->pose_mat[2], size[2] / sizeo[2]);
                                                }
                                                if (amod->channels & 2) {
                                                        /* for rotation */
@@ -2102,10 +2102,10 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
                                                        nor[2] = BLI_gNoise(amod->noisesize, eul[0], eul[1], eul[2]+ofs, 0, 0) - ofs;
                                                        
                                                        compatible_eul(nor, eulo);
-                                                       VecAddf(eul, eul, nor);
+                                                       add_v3_v3v3(eul, eul, nor);
                                                        compatible_eul(eul, eulo);
                                                        
-                                                       LocEulSizeToMat4(pchan->pose_mat, loc, eul, size);
+                                                       loc_eul_size_to_mat4(pchan->pose_mat, loc, eul, size);
                                                }
                                                if (amod->channels & 1) {
                                                        /* for location */
@@ -2113,7 +2113,7 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
                                                        nor[1] = BLI_gNoise(amod->noisesize, loc[0], loc[1]+ofs, loc[2], 0, 0) - ofs;   
                                                        nor[2] = BLI_gNoise(amod->noisesize, loc[0], loc[1], loc[2]+ofs, 0, 0) - ofs;
                                                        
-                                                       VecAddf(pchan->pose_mat[3], loc, nor);
+                                                       add_v3_v3v3(pchan->pose_mat[3], loc, nor);
                                                }
                                        }
                                }
@@ -2148,7 +2148,7 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
                float offs_bone[4][4];  // yoffs(b-1) + root(b) + bonemat(b)
                
                /* bone transform itself */
-               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);
@@ -2161,39 +2161,39 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
                        float tmat[4][4];
                        
                        /* the rotation of the parent restposition */
-                       Mat4CpyMat4(tmat, parbone->arm_mat);
+                       copy_m4_m4(tmat, parbone->arm_mat);
                        
                        /* the location of actual parent transform */
                        VECCOPY(tmat[3], offs_bone[3]);
                        offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
-                       Mat4MulVecfl(parchan->pose_mat, tmat[3]);
+                       mul_m4_v3(parchan->pose_mat, tmat[3]);
                        
-                       Mat4MulSerie(pchan->pose_mat, tmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
+                       mul_serie_m4(pchan->pose_mat, tmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
                }
                else if(bone->flag & BONE_NO_SCALE) {
                        float orthmat[4][4];
                        
                        /* get the official transform, but we only use the vector from it (optimize...) */
-                       Mat4MulSerie(pchan->pose_mat, parchan->pose_mat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
+                       mul_serie_m4(pchan->pose_mat, parchan->pose_mat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
                        VECCOPY(vec, pchan->pose_mat[3]);
                        
                        /* do this again, but with an ortho-parent matrix */
-                       Mat4CpyMat4(orthmat, parchan->pose_mat);
-                       Mat4Ortho(orthmat);
-                       Mat4MulSerie(pchan->pose_mat, orthmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
+                       copy_m4_m4(orthmat, parchan->pose_mat);
+                       normalize_m4(orthmat);
+                       mul_serie_m4(pchan->pose_mat, orthmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
                        
                        /* copy correct transform */
                        VECCOPY(pchan->pose_mat[3], vec);
                }
                else 
-                       Mat4MulSerie(pchan->pose_mat, parchan->pose_mat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
+                       mul_serie_m4(pchan->pose_mat, parchan->pose_mat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
        }
        else {
-               Mat4MulMat4(pchan->pose_mat, pchan->chan_mat, bone->arm_mat);
+               mul_m4_m4m4(pchan->pose_mat, pchan->chan_mat, bone->arm_mat);
                
                /* only rootbones get the cyclic offset (unless user doesn't want that) */
                if ((bone->flag & BONE_NO_CYCLICOFFSET) == 0)
-                       VecAddf(pchan->pose_mat[3], pchan->pose_mat[3], ob->pose->cyclic_offset);
+                       add_v3_v3v3(pchan->pose_mat[3], pchan->pose_mat[3], ob->pose->cyclic_offset);
        }
        
        /* do NLA strip modifiers - i.e. curve follow */
@@ -2229,8 +2229,8 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
        VECCOPY(pchan->pose_head, pchan->pose_mat[3]);
        /* calculate tail */
        VECCOPY(vec, pchan->pose_mat[1]);
-       VecMulf(vec, bone->length);
-       VecAddf(pchan->pose_tail, pchan->pose_head, vec);
+       mul_v3_fl(vec, bone->length);
+       add_v3_v3v3(pchan->pose_tail, pchan->pose_head, vec);
 }
 
 /* This only reads anim data from channels, and writes to channels */
@@ -2258,14 +2258,14 @@ void where_is_pose (Scene *scene, Object *ob)
                for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
                        bone= pchan->bone;
                        if(bone) {
-                               Mat4CpyMat4(pchan->pose_mat, bone->arm_mat);
+                               copy_m4_m4(pchan->pose_mat, bone->arm_mat);
                                VECCOPY(pchan->pose_head, bone->arm_head);
                                VECCOPY(pchan->pose_tail, bone->arm_tail);
                        }
                }
        }
        else {
-               Mat4Invert(ob->imat, ob->obmat);        // imat is needed 
+               invert_m4_m4(ob->imat, ob->obmat);      // imat is needed 
                
                /* 1. clear flags */
                for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
@@ -2303,8 +2303,8 @@ void where_is_pose (Scene *scene, Object *ob)
        /* calculating deform matrices */
        for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
                if(pchan->bone) {
-                       Mat4Invert(imat, pchan->bone->arm_mat);
-                       Mat4MulMat4(pchan->chan_mat, imat, pchan->pose_mat);
+                       invert_m4_m4(imat, pchan->bone->arm_mat);
+                       mul_m4_m4m4(pchan->chan_mat, imat, pchan->pose_mat);
                }
        }
 }
index 712fb13..389009c 100644 (file)
@@ -43,7 +43,7 @@
 #include "DNA_listBase.h"
 
 #include "BLI_rand.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_kdtree.h"
 #include "BLI_kdopbvh.h"
@@ -135,10 +135,10 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
                        /* estimate future location of target */
                        get_effector_data(eff, &efd, &epoint, 1);
 
-                       VecMulf(efd.vel, efd.distance / (val->max_speed * bbd->timestep));
-                       VecAddf(efd.loc, efd.loc, efd.vel);
-                       VecSubf(efd.vec_to_point, pa->prev_state.co, efd.loc);
-                       efd.distance = VecLength(efd.vec_to_point);
+                       mul_v3_fl(efd.vel, efd.distance / (val->max_speed * bbd->timestep));
+                       add_v3_v3v3(efd.loc, efd.loc, efd.vel);
+                       sub_v3_v3v3(efd.vec_to_point, pa->prev_state.co, efd.loc);
+                       efd.distance = len_v3(efd.vec_to_point);
                }
 
                if(rule->type == eBoidRuleType_Goal && boids->options & BOID_ALLOW_CLIMB && surface!=0.0f) {
@@ -152,17 +152,17 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
                        priority > 2.0f * gabr->fear_factor) {
                        /* detach from surface and try to fly away from danger */
                        VECCOPY(efd.vec_to_point, bpa->gravity);
-                       VecMulf(efd.vec_to_point, -1.0f);
+                       mul_v3_fl(efd.vec_to_point, -1.0f);
                }
 
                VECCOPY(bbd->wanted_co, efd.vec_to_point);
-               VecMulf(bbd->wanted_co, mul);
+               mul_v3_fl(bbd->wanted_co, mul);
 
                bbd->wanted_speed = val->max_speed * priority;
 
                /* with goals factor is approach velocity factor */
                if(rule->type == eBoidRuleType_Goal && boids->landing_smoothness > 0.0f) {
-                       float len2 = 2.0f*VecLength(pa->prev_state.vel);
+                       float len2 = 2.0f*len_v3(pa->prev_state.vel);
 
                        surface *= pa->size * boids->height;
 
@@ -198,12 +198,12 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
                float radius = val->personal_space * pa->size, ray_dir[3];
 
                VECCOPY(col.co1, pa->prev_state.co);
-               VecAddf(col.co2, pa->prev_state.co, pa->prev_state.vel);
-               VecSubf(ray_dir, col.co2, col.co1);
-               VecMulf(ray_dir, acbr->look_ahead);
+               add_v3_v3v3(col.co2, pa->prev_state.co, pa->prev_state.vel);
+               sub_v3_v3v3(ray_dir, col.co2, col.co1);
+               mul_v3_fl(ray_dir, acbr->look_ahead);
                col.t = 0.0f;
                hit.index = -1;
-               hit.dist = col.ray_len = VecLength(ray_dir);
+               hit.dist = col.ray_len = len_v3(ray_dir);
 
                /* find out closest deflector object */
                for(coll = bbd->sim->colliders->first; coll; coll=coll->next) {
@@ -224,9 +224,9 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 
                        VECCOPY(bbd->wanted_co, col.nor);
 
-                       VecMulf(bbd->wanted_co, (1.0f - t) * val->personal_space * pa->size);
+                       mul_v3_fl(bbd->wanted_co, (1.0f - t) * val->personal_space * pa->size);
 
-                       bbd->wanted_speed = sqrt(t) * VecLength(pa->prev_state.vel);
+                       bbd->wanted_speed = sqrt(t) * len_v3(pa->prev_state.vel);
 
                        return 1;
                }
@@ -235,39 +235,39 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
        //check boids in own system
        if(acbr->options & BRULE_ACOLL_WITH_BOIDS)
        {
-               neighbors = BLI_kdtree_range_search(bbd->sim->psys->tree, acbr->look_ahead * VecLength(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn);
+               neighbors = BLI_kdtree_range_search(bbd->sim->psys->tree, acbr->look_ahead * len_v3(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn);
                if(neighbors > 1) for(n=1; n<neighbors; n++) {
                        VECCOPY(co1, pa->prev_state.co);
                        VECCOPY(vel1, pa->prev_state.vel);
                        VECCOPY(co2, (bbd->sim->psys->particles + ptn[n].index)->prev_state.co);
                        VECCOPY(vel2, (bbd->sim->psys->particles + ptn[n].index)->prev_state.vel);
 
-                       VecSubf(loc, co1, co2);
+                       sub_v3_v3v3(loc, co1, co2);
 
-                       VecSubf(vec, vel1, vel2);
+                       sub_v3_v3v3(vec, vel1, vel2);
                        
-                       inp = Inpf(vec,vec);
+                       inp = dot_v3v3(vec,vec);
 
                        /* velocities not parallel */
                        if(inp != 0.0f) {
-                               t = -Inpf(loc, vec)/inp;
+                               t = -dot_v3v3(loc, vec)/inp;
                                /* cpa is not too far in the future so investigate further */
                                if(t > 0.0f && t < t_min) {
                                        VECADDFAC(co1, co1, vel1, t);
                                        VECADDFAC(co2, co2, vel2, t);
                                        
-                                       VecSubf(vec, co2, co1);
+                                       sub_v3_v3v3(vec, co2, co1);
 
-                                       len = Normalize(vec);
+                                       len = normalize_v3(vec);
 
                                        /* distance of cpa is close enough */
                                        if(len < 2.0f * val->personal_space * pa->size) {
                                                t_min = t;
 
-                                               VecMulf(vec, VecLength(vel1));
-                                               VecMulf(vec, (2.0f - t)/2.0f);
-                                               VecSubf(bbd->wanted_co, vel1, vec);
-                                               bbd->wanted_speed = VecLength(bbd->wanted_co);
+                                               mul_v3_fl(vec, len_v3(vel1));
+                                               mul_v3_fl(vec, (2.0f - t)/2.0f);
+                                               sub_v3_v3v3(bbd->wanted_co, vel1, vec);
+                                               bbd->wanted_speed = len_v3(bbd->wanted_co);
                                                ret = 1;
                                        }
                                }
@@ -281,39 +281,39 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
                ParticleSystem *epsys = psys_get_target_system(bbd->sim->ob, pt);
 
                if(epsys) {
-                       neighbors = BLI_kdtree_range_search(epsys->tree, acbr->look_ahead * VecLength(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn);
+                       neighbors = BLI_kdtree_range_search(epsys->tree, acbr->look_ahead * len_v3(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn);
                        if(neighbors > 0) for(n=0; n<neighbors; n++) {
                                VECCOPY(co1, pa->prev_state.co);
                                VECCOPY(vel1, pa->prev_state.vel);
                                VECCOPY(co2, (epsys->particles + ptn[n].index)->prev_state.co);
                                VECCOPY(vel2, (epsys->particles + ptn[n].index)->prev_state.vel);
 
-                               VecSubf(loc, co1, co2);
+                               sub_v3_v3v3(loc, co1, co2);
 
-                               VecSubf(vec, vel1, vel2);
+                               sub_v3_v3v3(vec, vel1, vel2);
                                
-                               inp = Inpf(vec,vec);
+                               inp = dot_v3v3(vec,vec);
 
                                /* velocities not parallel */
                                if(inp != 0.0f) {
-                                       t = -Inpf(loc, vec)/inp;
+                                       t = -dot_v3v3(loc, vec)/inp;
                                        /* cpa is not too far in the future so investigate further */
                                        if(t > 0.0f && t < t_min) {
                                                VECADDFAC(co1, co1, vel1, t);
                                                VECADDFAC(co2, co2, vel2, t);
                                                
-                                               VecSubf(vec, co2, co1);
+                                               sub_v3_v3v3(vec, co2, co1);
 
-                                               len = Normalize(vec);
+                                               len = normalize_v3(vec);
 
                                                /* distance of cpa is close enough */
                                                if(len < 2.0f * val->personal_space * pa->size) {
                                                        t_min = t;
 
-                                                       VecMulf(vec, VecLength(vel1));
-                                                       VecMulf(vec, (2.0f - t)/2.0f);
-                                                       VecSubf(bbd->wanted_co, vel1, vec);
-                                                       bbd->wanted_speed = VecLength(bbd->wanted_co);
+                                                       mul_v3_fl(vec, len_v3(vel1));
+                                                       mul_v3_fl(vec, (2.0f - t)/2.0f);
+                                                       sub_v3_v3v3(bbd->wanted_co, vel1, vec);
+                                                       bbd->wanted_speed = len_v3(bbd->wanted_co);
                                                        ret = 1;
                                                }
                                        }
@@ -340,9 +340,9 @@ static int rule_separate(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Pa
        int ret = 0;
 
        if(neighbors > 1 && ptn[1].dist!=0.0f) {
-               VecSubf(vec, pa->prev_state.co, bbd->sim->psys->particles[ptn[1].index].state.co);
-               VecMulf(vec, (2.0f * val->personal_space * pa->size - ptn[1].dist) / ptn[1].dist);
-               VecAddf(bbd->wanted_co, bbd->wanted_co, vec);
+               sub_v3_v3v3(vec, pa->prev_state.co, bbd->sim->psys->particles[ptn[1].index].state.co);
+               mul_v3_fl(vec, (2.0f * val->personal_space * pa->size - ptn[1].dist) / ptn[1].dist);
+               add_v3_v3v3(bbd->wanted_co, bbd->wanted_co, vec);
                bbd->wanted_speed = val->max_speed;
                len = ptn[1].dist;
                ret = 1;
@@ -357,9 +357,9 @@ static int rule_separate(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Pa
                        neighbors = BLI_kdtree_range_search(epsys->tree, 2.0f * val->personal_space * pa->size, pa->prev_state.co, NULL, &ptn);
                        
                        if(neighbors > 0 && ptn[0].dist < len) {
-                               VecSubf(vec, pa->prev_state.co, ptn[0].co);
-                               VecMulf(vec, (2.0f * val->personal_space * pa->size - ptn[0].dist) / ptn[1].dist);
-                               VecAddf(bbd->wanted_co, bbd->wanted_co, vec);
+                               sub_v3_v3v3(vec, pa->prev_state.co, ptn[0].co);
+                               mul_v3_fl(vec, (2.0f * val->personal_space * pa->size - ptn[0].dist) / ptn[1].dist);
+                               add_v3_v3v3(bbd->wanted_co, bbd->wanted_co, vec);
                                bbd->wanted_speed = val->max_speed;
                                len = ptn[0].dist;
                                ret = 1;
@@ -380,19 +380,19 @@ static int rule_flock(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
 
        if(neighbors > 1) {
                for(n=1; n<neighbors; n++) {
-                       VecAddf(loc, loc, bbd->sim->psys->particles[ptn[n].index].prev_state.co);
-                       VecAddf(vec, vec, bbd->sim->psys->particles[ptn[n].index].prev_state.vel);
+                       add_v3_v3v3(loc, loc, bbd->sim->psys->particles[ptn[n].index].prev_state.co);
+                       add_v3_v3v3(vec, vec, bbd->sim->psys->particles[ptn[n].index].prev_state.vel);
                }
 
-               VecMulf(loc, 1.0f/((float)neighbors - 1.0f));
-               VecMulf(vec, 1.0f/((float)neighbors - 1.0f));
+               mul_v3_fl(loc, 1.0f/((float)neighbors - 1.0f));
+               mul_v3_fl(vec, 1.0f/((float)neighbors - 1.0f));
 
-               VecSubf(loc, loc, pa->prev_state.co);
-               VecSubf(vec, vec, pa->prev_state.vel);
+               sub_v3_v3v3(loc, loc, pa->prev_state.co);
+               sub_v3_v3v3(vec, vec, pa->prev_state.vel);
 
-               VecAddf(bbd->wanted_co, bbd->wanted_co, vec);
-               VecAddf(bbd->wanted_co, bbd->wanted_co, loc);
-               bbd->wanted_speed = VecLength(bbd->wanted_co);
+               add_v3_v3v3(bbd->wanted_co, bbd->wanted_co, vec);
+               add_v3_v3v3(bbd->wanted_co, bbd->wanted_co, loc);
+               bbd->wanted_speed = len_v3(bbd->wanted_co);
 
                ret = 1;
        }
@@ -410,16 +410,16 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
                float vec2[3], t;
 
                /* first check we're not blocking the leader*/
-               VecSubf(vec, flbr->loc, flbr->oloc);
-               VecMulf(vec, 1.0f/bbd->timestep);
+               sub_v3_v3v3(vec, flbr->loc, flbr->oloc);
+               mul_v3_fl(vec, 1.0f/bbd->timestep);
 
-               VecSubf(loc, pa->prev_state.co, flbr->oloc);
+               sub_v3_v3v3(loc, pa->prev_state.co, flbr->oloc);
 
-               mul = Inpf(vec, vec);
+               mul = dot_v3v3(vec, vec);
 
                /* leader is not moving */
                if(mul < 0.01) {
-                       len = VecLength(loc);
+                       len = len_v3(loc);
                        /* too close to leader */
                        if(len < 2.0f * val->personal_space * pa->size) {
                                VECCOPY(bbd->wanted_co, loc);
@@ -428,16 +428,16 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
                        }
                }
                else {
-                       t = Inpf(loc, vec)/mul;
+                       t = dot_v3v3(loc, vec)/mul;
 
                        /* possible blocking of leader in near future */
                        if(t > 0.0f && t < 3.0f) {
                                VECCOPY(vec2, vec);
-                               VecMulf(vec2, t);
+                               mul_v3_fl(vec2, t);
 
-                               VecSubf(vec2, loc, vec2);
+                               sub_v3_v3v3(vec2, loc, vec2);
 
-                               len = VecLength(vec2);
+                               len = len_v3(vec2);
 
                                if(len < 2.0f * val->personal_space * pa->size) {
                                        VECCOPY(bbd->wanted_co, vec2);
@@ -454,15 +454,15 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
                }
                else {
                        VECCOPY(loc, flbr->oloc);
-                       VecSubf(vec, flbr->loc, flbr->oloc);
-                       VecMulf(vec, 1.0/bbd->timestep);
+                       sub_v3_v3v3(vec, flbr->loc, flbr->oloc);
+                       mul_v3_fl(vec, 1.0/bbd->timestep);
                }
                
                /* fac is seconds behind leader */
                VECADDFAC(loc, loc, vec, -flbr->distance);
 
-               VecSubf(bbd->wanted_co, loc, pa->prev_state.co);
-               bbd->wanted_speed = VecLength(bbd->wanted_co);
+               sub_v3_v3v3(bbd->wanted_co, loc, pa->prev_state.co);
+               bbd->wanted_speed = len_v3(bbd->wanted_co);
                        
                ret = 1;
        }
@@ -473,13 +473,13 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
                for(i = 0; i< bbd->sim->psys->totpart; i+=n){
                        VECCOPY(vec, bbd->sim->psys->particles[i].prev_state.vel);
 
-                       VecSubf(loc, pa->prev_state.co, bbd->sim->psys->particles[i].prev_state.co);
+                       sub_v3_v3v3(loc, pa->prev_state.co, bbd->sim->psys->particles[i].prev_state.co);
 
-                       mul = Inpf(vec, vec);
+                       mul = dot_v3v3(vec, vec);
 
                        /* leader is not moving */
                        if(mul < 0.01) {
-                               len = VecLength(loc);
+                               len = len_v3(loc);
                                /* too close to leader */
                                if(len < 2.0f * val->personal_space * pa->size) {
                                        VECCOPY(bbd->wanted_co, loc);
@@ -488,16 +488,16 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
                                }
                        }
                        else {
-                               t = Inpf(loc, vec)/mul;
+                               t = dot_v3v3(loc, vec)/mul;
 
                                /* possible blocking of leader in near future */
                                if(t > 0.0f && t < t_min) {
                                        VECCOPY(vec2, vec);
-                                       VecMulf(vec2, t);
+                                       mul_v3_fl(vec2, t);
 
-                                       VecSubf(vec2, loc, vec2);
+                                       sub_v3_v3v3(vec2, loc, vec2);
 
-                                       len = VecLength(vec2);
+                                       len = len_v3(vec2);
 
                                        if(len < 2.0f * val->personal_space * pa->size) {
                                                t_min = t;
@@ -524,8 +524,8 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
                /* fac is seconds behind leader */
                VECADDFAC(loc, loc, vec, -flbr->distance);
 
-               VecSubf(bbd->wanted_co, loc, pa->prev_state.co);
-               bbd->wanted_speed = VecLength(bbd->wanted_co);
+               sub_v3_v3v3(bbd->wanted_co, loc, pa->prev_state.co);
+               bbd->wanted_speed = len_v3(bbd->wanted_co);
                
                ret = 1;
        }
@@ -544,30 +544,30 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
                bpa->wander[1] += asbr->wander * (-1.0f + 2.0f * BLI_frand());
                bpa->wander[2] += asbr->wander * (-1.0f + 2.0f * BLI_frand());
 
-               Normalize(bpa->wander);
+               normalize_v3(bpa->wander);
 
                VECCOPY(vec, bpa->wander);
 
-               QuatMulVecf(pa->prev_state.rot, vec);
+               mul_qt_v3(pa->prev_state.rot, vec);
 
                VECCOPY(bbd->wanted_co, pa->prev_state.ave);
 
-               VecMulf(bbd->wanted_co, 1.1f);
+               mul_v3_fl(bbd->wanted_co, 1.1f);
 
-               VecAddf(bbd->wanted_co, bbd->wanted_co, vec);
+               add_v3_v3v3(bbd->wanted_co, bbd->wanted_co, vec);
 
                /* leveling */
                if(asbr->level > 0.0f) {
-                       Projf(vec, bbd->wanted_co, bbd->sim->psys->part->acc);
-                       VecMulf(vec, asbr->level);
-                       VecSubf(bbd->wanted_co, bbd->wanted_co, vec);
+                       project_v3_v3v3(vec, bbd->wanted_co, bbd->sim->psys->part->acc);
+                       mul_v3_fl(vec, asbr->level);
+                       sub_v3_v3v3(bbd->wanted_co, bbd->wanted_co, vec);
                }
        }
        else {
                VECCOPY(bbd->wanted_co, pa->prev_state.ave);
 
                /* may happen at birth */
-               if(Inp2f(bbd->wanted_co,bbd->wanted_co)==0.0f) {
+               if(dot_v2v2(bbd->wanted_co,bbd->wanted_co)==0.0f) {
                        bbd->wanted_co[0] = 2.0f*(0.5f - BLI_frand());
                        bbd->wanted_co[1] = 2.0f*(0.5f - BLI_frand());
                        bbd->wanted_co[2] = 2.0f*(0.5f - BLI_frand());
@@ -575,9 +575,9 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
                
                /* leveling */
                if(asbr->level > 0.0f) {
-                       Projf(vec, bbd->wanted_co, bbd->sim->psys->part->acc);
-                       VecMulf(vec, asbr->level);
-                       VecSubf(bbd->wanted_co, bbd->wanted_co, vec);
+                       project_v3_v3v3(vec, bbd->wanted_co, bbd->sim->psys->part->acc);
+                       mul_v3_fl(vec, asbr->level);
+                       sub_v3_v3v3(bbd->wanted_co, bbd->wanted_co, vec);
                }
 
        }
@@ -641,20 +641,20 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
        }
        /* decide action if enemy presence found */
        if(e_strength > 0.0f) {
-               VecSubf(bbd->wanted_co, closest_enemy, pa->prev_state.co);
+               sub_v3_v3v3(bbd->wanted_co, closest_enemy, pa->prev_state.co);
 
                /* attack if in range */
                if(closest_dist <= bbd->part->boids->range + pa->size + enemy_pa->size) {
                        float damage = BLI_frand();
                        float enemy_dir[3] = {bbd->wanted_co[0],bbd->wanted_co[1],bbd->wanted_co[2]};
 
-                       Normalize(enemy_dir);
+                       normalize_v3(enemy_dir);
 
                        /* fight mode */
                        bbd->wanted_speed = 0.0f;
 
                        /* must face enemy to fight */
-                       if(Inpf(pa->prev_state.ave, enemy_dir)>0.5f) {
+                       if(dot_v3v3(pa->prev_state.ave, enemy_dir)>0.5f) {
                                bpa = enemy_pa->boid;
                                bpa->data.health -= bbd->part->boids->strength * bbd->timestep * ((1.0f-bbd->part->boids->accuracy)*damage + bbd->part->boids->accuracy);
                        }
@@ -669,7 +669,7 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
                if(bpa->data.health/bbd->part->boids->health * bbd->part->boids->aggression < e_strength / f_strength) {
                        /* decide to flee */
                        if(closest_dist < fbr->flee_distance * fbr->distance) {
-                               VecMulf(bbd->wanted_co, -1.0f);
+                               mul_v3_fl(bbd->wanted_co, -1.0f);
                                bbd->wanted_speed = val->max_speed;
                        }
                        else { /* wait for better odds */
@@ -735,7 +735,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float *gro
 
                /* take surface velocity into account */
                closest_point_on_surface(surmd, pa->state.co, x, NULL, v);
-               VecAddf(x, x, v);
+               add_v3_v3v3(x, x, v);
 
                /* get actual position on surface */
                closest_point_on_surface(surmd, x, ground_co, ground_nor, NULL);
@@ -754,12 +754,12 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float *gro
 
                VECCOPY(col.co1, pa->state.co);
                VECCOPY(col.co2, pa->state.co);
-               VecAddf(col.co1, col.co1, zvec);
-               VecSubf(col.co2, col.co2, zvec);
-               VecSubf(ray_dir, col.co2, col.co1);
+               add_v3_v3v3(col.co1, col.co1, zvec);
+               sub_v3_v3v3(col.co2, col.co2, zvec);
+               sub_v3_v3v3(ray_dir, col.co2, col.co1);
                col.t = 0.0f;
                hit.index = -1;
-               hit.dist = col.ray_len = VecLength(ray_dir);
+               hit.dist = col.ray_len = len_v3(ray_dir);
 
                /* find out upmost deflector object */
                for(coll = bbd->sim->colliders->first; coll; coll = coll->next){
@@ -772,9 +772,9 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float *gro
                /* then use that object */
                if(hit.index>=0) {
                        t = hit.dist/col.ray_len;
-                       VecLerpf(ground_co, col.co1, col.co2, t);
+                       interp_v3_v3v3(ground_co, col.co1, col.co2, t);
                        VECCOPY(ground_nor, col.nor);
-                       Normalize(ground_nor);
+                       normalize_v3(ground_nor);
                        return col.hit_ob;
                }
                else {
@@ -829,23 +829,23 @@ static void boid_climb(BoidSettings *boids, ParticleData *pa, float *surface_co,
 
        /* gather apparent gravity */
        VECADDFAC(bpa->gravity, bpa->gravity, surface_nor, -1.0);
-       Normalize(bpa->gravity);
+       normalize_v3(bpa->gravity);
 
        /* raise boid it's size from surface */
-       VecMulf(nor, pa->size * boids->height);
-       VecAddf(pa->state.co, surface_co, nor);
+       mul_v3_fl(nor, pa->size * boids->height);
+       add_v3_v3v3(pa->state.co, surface_co, nor);
 
        /* remove normal component from velocity */
-       Projf(vel, pa->state.vel, surface_nor);
-       VecSubf(pa->state.vel, pa->state.vel, vel);
+       project_v3_v3v3(vel, pa->state.vel, surface_nor);
+       sub_v3_v3v3(pa->state.vel, pa->state.vel, vel);
 }
 static float boid_goal_signed_dist(float *boid_co, float *goal_co, float *goal_nor)
 {
        float vec[3];
 
-       VecSubf(vec, boid_co, goal_co);
+       sub_v3_v3v3(vec, boid_co, goal_co);
 
-       return Inpf(vec, goal_nor);
+       return dot_v3v3(vec, goal_nor);
 }
 /* wanted_co is relative to boid location */
 static int apply_boid_rule(BoidBrainData *bbd, BoidRule *rule, BoidValues *val, ParticleData *pa, float fuzziness)
@@ -859,7 +859,7 @@ static int apply_boid_rule(BoidBrainData *bbd, BoidRule *rule, BoidValues *val,
        if(boid_rules[rule->type](rule, bbd, val, pa)==0)
                return 0;
 
-       if(fuzziness < 0.0f || VecLenCompare(bbd->wanted_co, pa->prev_state.vel, fuzziness * VecLength(pa->prev_state.vel))==0)
+       if(fuzziness < 0.0f || compare_len_v3v3(bbd->wanted_co, pa->prev_state.vel, fuzziness * len_v3(pa->prev_state.vel))==0)
                return 1;
        else
                return 0;
@@ -943,7 +943,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
                        int n = 0;
                        for(rule = state->rules.first; rule; rule=rule->next) {
                                if(apply_boid_rule(bbd, rule, &val, pa, -1.0f)) {
-                                       VecAddf(wanted_co, wanted_co, bbd->wanted_co);
+                                       add_v3_v3v3(wanted_co, wanted_co, bbd->wanted_co);
                                        wanted_speed += bbd->wanted_speed;
                                        n++;
                                        bbd->wanted_co[0]=bbd->wanted_co[1]=bbd->wanted_co[2]=bbd->wanted_speed=0.0f;
@@ -951,7 +951,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
                        }
 
                        if(n > 1) {
-                               VecMulf(wanted_co, 1.0f/(float)n);
+                               mul_v3_fl(wanted_co, 1.0f/(float)n);
                                wanted_speed /= (float)n;
                        }
 
@@ -971,12 +971,12 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
                        float cvel[3], dir[3];
 
                        VECCOPY(dir, pa->prev_state.ave);
-                       Normalize2(dir);
+                       normalize_v2(dir);
 
                        VECCOPY(cvel, bbd->wanted_co);
-                       Normalize2(cvel);
+                       normalize_v2(cvel);
 
-                       if(Inp2f(cvel, dir) > 0.95 / mul)
+                       if(dot_v2v2(cvel, dir) > 0.95 / mul)
                                bpa->data.mode = eBoidMode_Liftoff;
                }
                else if(val.jump_speed > 0.0f) {
@@ -990,20 +990,20 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
                                float len;
 
                                VECCOPY(dir, pa->prev_state.ave);
-                               Normalize2(dir);
+                               normalize_v2(dir);
 
                                VECCOPY(cvel, bbd->wanted_co);
-                               Normalize2(cvel);
+                               normalize_v2(cvel);
 
-                               len = Vec2Length(pa->prev_state.vel);
+                               len = len_v2(pa->prev_state.vel);
 
                                /* first of all, are we going in a suitable direction? */
                                /* or at a suitably slow speed */
-                               if(Inp2f(cvel, dir) > 0.95f / mul || len <= state->rule_fuzziness) {
+                               if(dot_v2v2(cvel, dir) > 0.95f / mul || len <= state->rule_fuzziness) {
                                        /* try to reach goal at highest point of the parabolic path */
-                                       cur_v = Vec2Length(pa->prev_state.vel);
+                                       cur_v = len_v2(pa->prev_state.vel);
                                        z_v = sasqrt(-2.0f * bbd->part->acc[2] * bbd->wanted_co[2]);
-                                       ground_v = Vec2Length(bbd->wanted_co)*sasqrt(-0.5f * bbd->part->acc[2] / bbd->wanted_co[2]);
+                                       ground_v = len_v2(bbd->wanted_co)*sasqrt(-0.5f * bbd->part->acc[2] / bbd->wanted_co[2]);
 
                                        len = sasqrt((ground_v-cur_v)*(ground_v-cur_v) + z_v*z_v);
 
@@ -1014,11 +1014,11 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
 
                                                VECCOPY(jump_v, dir);
                                                jump_v[2] = z_v;
-                                               VecMulf(jump_v, ground_v);
+                                               mul_v3_fl(jump_v, ground_v);
 
-                                               Normalize(jump_v);
-                                               VecMulf(jump_v, len);
-                                               Vec2Addf(jump_v, jump_v, pa->prev_state.vel);
+                                               normalize_v3(jump_v);
+                                               mul_v3_fl(jump_v, len);
+                                               add_v2_v2v2(jump_v, jump_v, pa->prev_state.vel);
                                        }
                                }
                        }
@@ -1103,7 +1103,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 
                VECCOPY(old_dir, pa->prev_state.ave);
                VECCOPY(wanted_dir, bbd->wanted_co);
-               new_speed = Normalize(wanted_dir);
+               new_speed = normalize_v3(wanted_dir);
 
                /* first check if we have valid direction we want to go towards */
                if(new_speed == 0.0f) {
@@ -1111,39 +1111,39 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
                }
                else {
                        float old_dir2[2], wanted_dir2[2], nor[3], angle;
-                       Vec2Copyf(old_dir2, old_dir);
-                       Normalize2(old_dir2);
-                       Vec2Copyf(wanted_dir2, wanted_dir);
-                       Normalize2(wanted_dir2);
+                       copy_v2_v2(old_dir2, old_dir);
+                       normalize_v2(old_dir2);
+                       copy_v2_v2(wanted_dir2, wanted_dir);
+                       normalize_v2(wanted_dir2);
 
                        /* choose random direction to turn if wanted velocity */
                        /* is directly behind regardless of z-coordinate */
-                       if(Inp2f(old_dir2, wanted_dir2) < -0.99f) {
+                       if(dot_v2v2(old_dir2, wanted_dir2) < -0.99f) {
                                wanted_dir[0] = 2.0f*(0.5f - BLI_frand());
                                wanted_dir[1] = 2.0f*(0.5f - BLI_frand());
                                wanted_dir[2] = 2.0f*(0.5f - BLI_frand());
-                               Normalize(wanted_dir);
+                               normalize_v3(wanted_dir);
                        }
 
                        /* constrain direction with maximum angular velocity */
-                       angle = saacos(Inpf(old_dir, wanted_dir));
+                       angle = saacos(dot_v3v3(old_dir, wanted_dir));
                        angle = MIN2(angle, val.max_ave);
 
-                       Crossf(nor, old_dir, wanted_dir);
-                       VecRotToQuat(nor, angle, q);
+                       cross_v3_v3v3(nor, old_dir, wanted_dir);
+                       axis_angle_to_quat( q,nor, angle);
                        VECCOPY(new_dir, old_dir);
-                       QuatMulVecf(q, new_dir);
-                       Normalize(new_dir);
+                       mul_qt_v3(q, new_dir);
+                       normalize_v3(new_dir);
 
                        /* save direction in case resulting velocity too small */
-                       VecRotToQuat(nor, angle*dtime, q);
+                       axis_angle_to_quat( q,nor, angle*dtime);
                        VECCOPY(pa->state.ave, old_dir);
-                       QuatMulVecf(q, pa->state.ave);
-                       Normalize(pa->state.ave);
+                       mul_qt_v3(q, pa->state.ave);
+                       normalize_v3(pa->state.ave);
                }
 
                /* constrain speed with maximum acceleration */
-               old_speed = VecLength(pa->prev_state.vel);
+               old_speed = len_v3(pa->prev_state.vel);
                
                if(bbd->wanted_speed < old_speed)
                        new_speed = MAX2(bbd->wanted_speed, old_speed - val.max_acc);
@@ -1152,11 +1152,11 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 
                /* combine direction and speed */
                VECCOPY(new_vel, new_dir);
-               VecMulf(new_vel, new_speed);
+               mul_v3_fl(new_vel, new_speed);
 
                /* maintain minimum flying velocity if not landing */
                if(level >= landing_level) {
-                       float len2 = Inp2f(new_vel,new_vel);
+                       float len2 = dot_v2v2(new_vel,new_vel);
                        float root;
 
                        len2 = MAX2(len2, val.min_speed*val.min_speed);
@@ -1164,20 +1164,20 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 
                        new_vel[2] = new_vel[2] < 0.0f ? -root : root;
 
-                       Normalize2(new_vel);
-                       Vec2Mulf(new_vel, sasqrt(len2));
+                       normalize_v2(new_vel);
+                       mul_v2_fl(new_vel, sasqrt(len2));
                }
 
                /* finally constrain speed to max speed */
-               new_speed = Normalize(new_vel);
-               VecMulf(new_vel, MIN2(new_speed, val.max_speed));
+               new_speed = normalize_v3(new_vel);
+               mul_v3_fl(new_vel, MIN2(new_speed, val.max_speed));
 
                /* get acceleration from difference of velocities */
-               VecSubf(acc, new_vel, pa->prev_state.vel);
+               sub_v3_v3v3(acc, new_vel, pa->prev_state.vel);
 
                /* break acceleration to components */
-               Projf(tan_acc, acc, pa->prev_state.ave);
-               VecSubf(nor_acc, acc, tan_acc);
+               project_v3_v3v3(tan_acc, acc, pa->prev_state.ave);
+               sub_v3_v3v3(nor_acc, acc, tan_acc);
        }
 
        /* account for effectors */
@@ -1185,32 +1185,32 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
        pdDoEffectors(bbd->sim->psys->effectors, bbd->sim->colliders, bbd->part->effector_weights, &epoint, force, NULL);
 
        if(ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)) {
-               float length = Normalize(force);
+               float length = normalize_v3(force);
 
                length = MAX2(0.0f, length - boids->land_stick_force);
 
-               VecMulf(force, length);
+               mul_v3_fl(force, length);
        }
        
-       VecAddf(acc, acc, force);
+       add_v3_v3v3(acc, acc, force);
 
        /* store smoothed acceleration for nice banking etc. */
        VECADDFAC(bpa->data.acc, bpa->data.acc, acc, dtime);
-       VecMulf(bpa->data.acc, 1.0f / (1.0f + dtime));
+       mul_v3_fl(bpa->data.acc, 1.0f / (1.0f + dtime));
 
        /* integrate new location & velocity */
 
        /* by regarding the acceleration as a force at this stage we*/
        /* can get better control allthough it's a bit unphysical       */
-       VecMulf(acc, 1.0f/pa_mass);
+       mul_v3_fl(acc, 1.0f/pa_mass);
 
        VECCOPY(dvec, acc);
-       VecMulf(dvec, dtime*dtime*0.5f);
+       mul_v3_fl(dvec, dtime*dtime*0.5f);
        
        VECCOPY(bvec, pa->prev_state.vel);
-       VecMulf(bvec, dtime);
-       VecAddf(dvec, dvec, bvec);
-       VecAddf(pa->state.co, pa->state.co, dvec);
+       mul_v3_fl(bvec, dtime);
+       add_v3_v3v3(dvec, dvec, bvec);
+       add_v3_v3v3(pa->state.co, pa->state.co, dvec);
 
        VECADDFAC(pa->state.vel, pa->state.vel, acc, dtime);
 
@@ -1224,9 +1224,9 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
                        float grav[3] = {0.0f, 0.0f, bbd->part->acc[2] < 0.0f ? -1.0f : 0.0f};
 
                        /* don't take forward acceleration into account (better banking) */
-                       if(Inpf(bpa->data.acc, pa->state.vel) > 0.0f) {
-                               Projf(dvec, bpa->data.acc, pa->state.vel);
-                               VecSubf(dvec, bpa->data.acc, dvec);
+                       if(dot_v3v3(bpa->data.acc, pa->state.vel) > 0.0f) {
+                               project_v3_v3v3(dvec, bpa->data.acc, pa->state.vel);
+                               sub_v3_v3v3(dvec, bpa->data.acc, dvec);
                        }
                        else {
                                VECCOPY(dvec, bpa->data.acc);
@@ -1234,7 +1234,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 
                        /* gather apparent gravity */
                        VECADDFAC(bpa->gravity, grav, dvec, -boids->banking);
-                       Normalize(bpa->gravity);
+                       normalize_v3(bpa->gravity);
 
                        /* stick boid on goal when close enough */
                        if(bbd->goal_ob && boid_goal_signed_dist(pa->state.co, bbd->goal_co, bbd->goal_nor) <= pa->size * boids->height) {
@@ -1257,7 +1257,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 
                        /* gather apparent gravity */
                        VECADDFAC(bpa->gravity, bpa->gravity, grav, dtime);
-                       Normalize(bpa->gravity);
+                       normalize_v3(bpa->gravity);
 
                        if(boids->options & BOID_ALLOW_LAND) {
                                /* stick boid on goal when close enough */
@@ -1289,15 +1289,15 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 
                        ///* gather apparent gravity to r_ve */
                        //VECADDFAC(pa->r_ve, pa->r_ve, ground_nor, -1.0);
-                       //Normalize(pa->r_ve);
+                       //normalize_v3(pa->r_ve);
 
                        ///* raise boid it's size from surface */
-                       //VecMulf(nor, pa->size * boids->height);
-                       //VecAddf(pa->state.co, ground_co, nor);
+                       //mul_v3_fl(nor, pa->size * boids->height);
+                       //add_v3_v3v3(pa->state.co, ground_co, nor);
 
                        ///* remove normal component from velocity */
-                       //Projf(v, pa->state.vel, ground_nor);
-                       //VecSubf(pa->state.vel, pa->state.vel, v);
+                       //project_v3_v3v3(v, pa->state.vel, ground_nor);
+                       //sub_v3_v3v3(pa->state.vel, pa->state.vel, v);
                        break;
                }
                case eBoidMode_OnLand:
@@ -1323,19 +1323,19 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
                                /* Don't take gravity's strength in to account, */
                                /* otherwise amount of banking is hard to control. */
                                VECCOPY(grav, ground_nor);
-                               VecMulf(grav, -1.0f);
+                               mul_v3_fl(grav, -1.0f);
                                
-                               Projf(dvec, bpa->data.acc, pa->state.vel);
-                               VecSubf(dvec, bpa->data.acc, dvec);
+                               project_v3_v3v3(dvec, bpa->data.acc, pa->state.vel);
+                               sub_v3_v3v3(dvec, bpa->data.acc, dvec);
 
                                /* gather apparent gravity */
                                VECADDFAC(bpa->gravity, grav, dvec, -boids->banking);
-                               Normalize(bpa->gravity);
+                               normalize_v3(bpa->gravity);
                        }
                        else {
                                /* gather negative surface normal */
                                VECADDFAC(bpa->gravity, bpa->gravity, ground_nor, -1.0f);
-                               Normalize(bpa->gravity);
+                               normalize_v3(bpa->gravity);
                        }
                        break;
                }
@@ -1343,36 +1343,36 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 
        /* save direction to state.ave unless the boid is falling */
        /* (boids can't effect their direction when falling) */
-       if(bpa->data.mode!=eBoidMode_Falling && VecLength(pa->state.vel) > 0.1*pa->size) {
+       if(bpa->data.mode!=eBoidMode_Falling && len_v3(pa->state.vel) > 0.1*pa->size) {
                VECCOPY(pa->state.ave, pa->state.vel);
-               Normalize(pa->state.ave);
+               normalize_v3(pa->state.ave);
        }
 
        /* apply damping */
        if(ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing))
-               VecMulf(pa->state.vel, 1.0f - 0.2f*bbd->part->dampfac);
+               mul_v3_fl(pa->state.vel, 1.0f - 0.2f*bbd->part->dampfac);
 
        /* calculate rotation matrix based on forward & down vectors */
        if(bpa->data.mode == eBoidMode_InAir) {
                VECCOPY(mat[0], pa->state.ave);
 
-               Projf(dvec, bpa->gravity, pa->state.ave);
-               VecSubf(mat[2], bpa->gravity, dvec);
-               Normalize(mat[2]);
+               project_v3_v3v3(dvec, bpa->gravity, pa->state.ave);
+               sub_v3_v3v3(mat[2], bpa->gravity, dvec);
+               normalize_v3(mat[2]);
        }
        else {
-               Projf(dvec, pa->state.ave, bpa->gravity);
-               VecSubf(mat[0], pa->state.ave, dvec);
-               Normalize(mat[0]);
+               project_v3_v3v3(dvec, pa->state.ave, bpa->gravity);
+               sub_v3_v3v3(mat[0], pa->state.ave, dvec);
+               normalize_v3(mat[0]);
 
                VECCOPY(mat[2], bpa->gravity);
        }
-       VecMulf(mat[2], -1.0f);
-       Crossf(mat[1], mat[2], mat[0]);
+       mul_v3_fl(mat[2], -1.0f);
+       cross_v3_v3v3(mat[1], mat[2], mat[0]);
        
        /* apply rotation */
-       Mat3ToQuat_is_ok(mat, q);
-       QuatCopy(pa->state.rot, q);
+       mat3_to_quat_is_ok( q,mat);
+       copy_qt_qt(pa->state.rot, q);
 }
 
 BoidRule *boid_new_rule(int type)
index 1f64571..68e1f61 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_ghash.h"
 
@@ -104,7 +104,7 @@ static void VertexIt_Fill(CSG_IteratorPtr it, CSG_IVertex *vert)
        float global_pos[3];
 
        /* boolean happens in global space, transform both with obmat */
-       VecMat4MulVecfl(
+       mul_v3_m4v3(
                global_pos,
                iterator->ob->obmat, 
                verts[iterator->pos].co
@@ -327,11 +327,11 @@ static void InterpCSGFace(
        for (j = 0; j < nr; j++) {
                // get coordinate into the space of the original mesh
                if (mapmat)
-                       VecMat4MulVecfl(obco, mapmat, co[j]);
+                       mul_v3_m4v3(obco, mapmat, co[j]);
                else
-                       VecCopyf(obco, co[j]);
+                       copy_v3_v3(obco, co[j]);
 
-               InterpWeightsQ3Dfl(orig_co[0], orig_co[1], orig_co[2], orig_co[3], obco, w[j]);
+               interp_weights_face_v3( w[j],orig_co[0], orig_co[1], orig_co[2], orig_co[3], obco);
        }
 
        CustomData_interp(&orig_dm->faceData, &dm->faceData, &orig_index, NULL, (float*)w, 1, index);
@@ -375,7 +375,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
 
                // we have to map the vertex coordinates back in the coordinate frame
                // of the resulting object, since it was computed in world space
-               VecMat4MulVecfl(mvert->co, parinv, csgvert.position);
+               mul_v3_m4v3(mvert->co, parinv, csgvert.position);
        }
 
        // a hash table to remap materials to indices
@@ -478,9 +478,9 @@ DerivedMesh *NewBooleanDerivedMesh_intern(
        // we map the final object back into ob's local coordinate space. For this
        // we need to compute the inverse transform from global to ob (inv_mat),
        // and the transform from ob to ob_select for use in interpolation (map_mat)
-       Mat4Invert(inv_mat, ob->obmat);
-       Mat4MulMat4(map_mat, ob_select->obmat, inv_mat);
-       Mat4Invert(inv_mat, ob_select->obmat);
+       invert_m4_m4(inv_mat, ob->obmat);
+       mul_m4_m4m4(map_mat, ob_select->obmat, inv_mat);
+       invert_m4_m4(inv_mat, ob_select->obmat);
 
        {
                // interface with the boolean module:
index 14e3287..15a3d04 100644 (file)
@@ -47,7 +47,7 @@
 #include "BKE_library.h"
 #include "BKE_material.h"
 
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 
 /**
  * Implementation of boolean ops mesh interface.
@@ -151,7 +151,7 @@ CSG_AddMeshToBlender(
        if (mesh == NULL) return 0;
        if (mesh->base == NULL) return 0;
 
-       Mat4Invert(inv_mat,mesh->base->object->obmat);
+       invert_m4_m4(inv_mat,mesh->base->object->obmat);
 
        // Create a new blender mesh object - using 'base' as 
        // a template for the new object.
index 115d31b..ccee5a2 100644 (file)
@@ -42,7 +42,7 @@
 
 #include "RNA_access.h"
 
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_rand.h"
 
@@ -845,8 +845,8 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
 
                /* setup starting time, direction vector and accumulated time */
                starttime= painter->accumtime;
-               Vec2Subf(dmousepos, pos, painter->lastmousepos);
-               len= Normalize2(dmousepos);
+               sub_v2_v2v2(dmousepos, pos, painter->lastmousepos);
+               len= normalize_v2(dmousepos);
                painter->accumtime += curtime - painter->lasttime;
 
                /* do paint op over unpainted time distance */
@@ -880,8 +880,8 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
 
                /* setup starting distance, direction vector and accumulated distance */
                startdistance= painter->accumdistance;
-               Vec2Subf(dmousepos, pos, painter->lastmousepos);
-               len= Normalize2(dmousepos);
+               sub_v2_v2v2(dmousepos, pos, painter->lastmousepos);
+               len= normalize_v2(dmousepos);
                painter->accumdistance += len;
 
                /* do paint op over unpainted distance */
index f252623..5ee8210 100644 (file)
@@ -45,7 +45,7 @@
 #include "BKE_displist.h"
 #include "BKE_global.h"
 
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_linklist.h"
 #include "MEM_guardedalloc.h"
 
@@ -55,7 +55,7 @@ static float ray_tri_intersection(const BVHTreeRay *ray, const float m_dist, con
 {
        float dist;
 
-       if(RayIntersectsTriangle((float*)ray->origin, (float*)ray->direction, (float*)v0, (float*)v1, (float*)v2, &dist, NULL))
+       if(isect_ray_tri_v3((float*)ray->origin, (float*)ray->direction, (float*)v0, (float*)v1, (float*)v2, &dist, NULL))
                return dist;
 
        return FLT_MAX;
@@ -68,10 +68,10 @@ static float sphereray_tri_intersection(const BVHTreeRay *ray, float radius, con
        float p1[3];
        float plane_normal[3], hit_point[3];
 
-       CalcNormFloat((float*)v0, (float*)v1, (float*)v2, plane_normal);
+       normal_tri_v3( plane_normal,(float*)v0, (float*)v1, (float*)v2);
 
        VECADDFAC( p1, ray->origin, ray->direction, m_dist);
-       if(SweepingSphereIntersectsTriangleUV((float*)ray->origin, p1, radius, (float*)v0, (float*)v1, (float*)v2, &idist, hit_point))
+       if(isect_sweeping_sphere_tri_v3((float*)ray->origin, p1, radius, (float*)v0, (float*)v1, (float*)v2, &idist, hit_point))
        {
                return idist * m_dist;
        }
@@ -384,9 +384,9 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const
                float w[3], x[3], y[3], z[3];
                VECCOPY(w, v0);
                VECCOPY(x, e0);
-               VecMulf(x, S);
+               mul_v3_fl(x, S);
                VECCOPY(y, e1);
-               VecMulf(y, T);
+               mul_v3_fl(y, T);
                VECADD(z, w, x);
                VECADD(z, z, y);
                //VECSUB(d, p, z);
@@ -430,7 +430,7 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float *co,
                        nearest->index = index;
                        nearest->dist = dist;
                        VECCOPY(nearest->co, nearest_tmp);
-                       CalcNormFloat(t0, t1, t2, nearest->no);
+                       normal_tri_v3( nearest->no,t0, t1, t2);
                }
 
                t1 = t2;
@@ -469,7 +469,7 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
                        hit->dist = dist;
                        VECADDFAC(hit->co, ray->origin, ray->direction, dist);
 
-                       CalcNormFloat(t0, t1, t2, hit->no);
+                       normal_tri_v3( hit->no,t0, t1, t2);
                }
 
                t1 = t2;
@@ -492,16 +492,16 @@ static void mesh_edges_nearest_point(void *userdata, int index, const float *co,
        t0 = vert[ edge->v1 ].co;
        t1 = vert[ edge->v2 ].co;
        
-       PclosestVL3Dfl(nearest_tmp, co, t0, t1);
-       dist = VecLenf(nearest_tmp, co);
+       closest_to_line_segment_v3(nearest_tmp, co, t0, t1);
+       dist = len_v3v3(nearest_tmp, co);
        
        if(dist < nearest->dist)
        {
                nearest->index = index;
                nearest->dist = dist;
                VECCOPY(nearest->co, nearest_tmp);
-               VecSubf(nearest->no, t0, t1);
-               Normalize(nearest->no);
+               sub_v3_v3v3(nearest->no, t0, t1);
+               normalize_v3(nearest->no);
        }
 }
 
index 25f60a4..30d1b65 100644 (file)
@@ -45,7 +45,7 @@
 #include "BKE_multires.h"
 #include "BKE_utildefines.h"
 
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_edgehash.h"
 #include "BLI_editVert.h"
@@ -405,9 +405,9 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm, int (*setMaterial)(int, void *a
                                                /* TODO make this better (cache facenormals as layer?) */
                                                float nor[3];
                                                if(mface->v4) {
-                                                       CalcNormFloat4(mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co, nor);
+                                                       normal_quad_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co);
                                                } else {
-                                                       CalcNormFloat(mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, nor);
+                                                       normal_tri_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co);
                                                }
                                                glNormal3fv(nor);
                                        }
@@ -576,9 +576,9 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
                                        else {
                                                float nor[3];
                                                if(mf->v4) {
-                                                       CalcNormFloat4(mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co, nor);
+                                                       normal_quad_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
                                                } else {
-                                                       CalcNormFloat(mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, nor);
+                                                       normal_tri_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
                                                }
                                                glNormal3fv(nor);
                                        }
@@ -748,9 +748,9 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
                                        else {
                                                float nor[3];
                                                if(mf->v4) {
-                                                       CalcNormFloat4(mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co, nor);
+                                                       normal_quad_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
                                                } else {
-                                                       CalcNormFloat(mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, nor);
+                                                       normal_tri_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
                                                }
                                                glNormal3fv(nor);
                                        }
@@ -920,9 +920,9 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo
                                        /* TODO ideally a normal layer should always be available */
                                        float nor[3];
                                        if(mface->v4) {
-                                               CalcNormFloat4(mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co, nor);
+                                               normal_quad_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co);
                                        } else {
-                                               CalcNormFloat(mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, nor);
+                                               normal_tri_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co);
                                        }
                                        glNormal3fv(nor);
                                }
@@ -1259,16 +1259,16 @@ static void cdDM_foreachMappedFaceCenter(
                        orig = i;
 
                VECCOPY(cent, mv[mf->v1].co);
-               VecAddf(cent, cent, mv[mf->v2].co);
-               VecAddf(cent, cent, mv[mf->v3].co);
+               add_v3_v3v3(cent, cent, mv[mf->v2].co);
+               add_v3_v3v3(cent, cent, mv[mf->v3].co);
 
                if (mf->v4) {
-                       CalcNormFloat4(mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co, no);
-                       VecAddf(cent, cent, mv[mf->v4].co);
-                       VecMulf(cent, 0.25f);
+                       normal_quad_v3( no,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
+                       add_v3_v3v3(cent, cent, mv[mf->v4].co);
+                       mul_v3_fl(cent, 0.25f);
                } else {
-                       CalcNormFloat(mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, no);
-                       VecMulf(cent, 0.33333333333f);
+                       normal_tri_v3( no,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
+                       mul_v3_fl(cent, 0.33333333333f);
                }
 
                func(userData, orig, cent, no);
@@ -1616,24 +1616,24 @@ void CDDM_calc_normals(DerivedMesh *dm)
                float *f_no = face_nors[i];
 
                if(mf->v4)
-                       CalcNormFloat4(mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co, f_no);
+                       normal_quad_v3( f_no,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
                else
-                       CalcNormFloat(mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, f_no);
+                       normal_tri_v3( f_no,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
                
-               VecAddf(temp_nors[mf->v1], temp_nors[mf->v1], f_no);
-               VecAddf(temp_nors[mf->v2], temp_nors[mf->v2], f_no);
-               VecAddf(temp_nors[mf->v3], temp_nors[mf->v3], f_no);
+               add_v3_v3v3(temp_nors[mf->v1], temp_nors[mf->v1], f_no);
+               add_v3_v3v3(temp_nors[mf->v2], temp_nors[mf->v2], f_no);
+               add_v3_v3v3(temp_nors[mf->v3], temp_nors[mf->v3], f_no);
                if(mf->v4)
-                       VecAddf(temp_nors[mf->v4], temp_nors[mf->v4], f_no);
+                       add_v3_v3v3(temp_nors[mf->v4], temp_nors[mf->v4], f_no);
        }
 
        /* normalize vertex normals and assign */
        for(i = 0; i < numVerts; i++, mv++) {
                float *no = temp_nors[i];
                
-               if (Normalize(no) == 0.0) {
+               if (normalize_v3(no) == 0.0) {
                        VECCOPY(no, mv->co);
-                       Normalize(no);
+                       normalize_v3(no);
                }
 
                mv->no[0] = (short)(no[0] * 32767.0);
@@ -1844,7 +1844,7 @@ DerivedMesh *MultiresDM_new(MultiresSubsurf *ms, DerivedMesh *orig, int numVerts
                mvert = CustomData_get_layer(&orig->vertData, CD_MVERT);
                mrdm->orco = MEM_callocN(sizeof(float) * 3 * orig->getNumVerts(orig), "multires orco");
                for(i = 0; i < orig->getNumVerts(orig); ++i)
-                       VecCopyf(mrdm->orco[i], mvert[i].co);
+                       copy_v3_v3(mrdm->orco[i], mvert[i].co);
        }
        else
                DM_init(dm, numVerts, numEdges, numFaces);
index 74f88a7..4a9cb23 100644 (file)
@@ -403,7 +403,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
 
                /* Get the current position. */
                VECCOPY(verts->xconst, mvert[i].co);
-               Mat4MulVecfl(ob->obmat, verts->xconst);
+               mul_m4_v3(ob->obmat, verts->xconst);
        }
 
        effectors = pdInitEffectors(clmd->scene, ob, NULL, clmd->sim_parms->effector_weights);
@@ -723,7 +723,7 @@ static void cloth_to_object (Object *ob,  ClothModifierData *clmd, DerivedMesh *
 
        if (clmd->clothObject) {
                /* inverse matrix is not uptodate... */
-               Mat4Invert (ob->imat, ob->obmat);
+               invert_m4_m4(ob->imat, ob->obmat);
 
                mvert = CDDM_get_verts(dm);
                numverts = dm->getNumVerts(dm);
@@ -731,7 +731,7 @@ static void cloth_to_object (Object *ob,  ClothModifierData *clmd, DerivedMesh *
                for (i = 0; i < numverts; i++)
                {
                        VECCOPY (mvert[i].co, cloth->verts[i].x);
-                       Mat4MulVecfl (ob->imat, mvert[i].co);   /* cloth is in global coords */
+                       mul_m4_v3(ob->imat, mvert[i].co);       /* cloth is in global coords */
                }
        }
 }
@@ -867,7 +867,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
                if(first)
                {
                        VECCOPY ( verts->x, mvert[i].co );
-                       Mat4MulVecfl ( ob->obmat, verts->x );
+                       mul_m4_v3( ob->obmat, verts->x );
                }
                
                /* no GUI interface yet */
@@ -884,7 +884,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
                VECCOPY ( verts->xconst, verts->x );
                VECCOPY ( verts->txold, verts->x );
                VECCOPY ( verts->tx, verts->x );
-               VecMulf ( verts->v, 0.0f );
+               mul_v3_fl( verts->v, 0.0f );
 
                verts->impulse_count = 0;
                VECCOPY ( verts->impulse, tnull );
index 8c664bc..3d995d7 100644 (file)
@@ -529,7 +529,7 @@ int cloth_collision_response_static ( ClothModifierData *clmd, CollisionModifier
 
                        // calculate tangential velocity
                        VECCOPY ( temp, collpair->normal );
-                       VecMulf ( temp, magrelVel );
+                       mul_v3_fl( temp, magrelVel );
                        VECSUB ( vrel_t_pre, relativeVelocity, temp );
 
                        // Decrease in magnitude of relative tangential velocity due to coulomb friction
@@ -539,7 +539,7 @@ int cloth_collision_response_static ( ClothModifierData *clmd, CollisionModifier
                        // Apply friction impulse.
                        if ( magtangent > ALMOST_ZERO )
                        {
-                               Normalize ( vrel_t_pre );
+                               normalize_v3( vrel_t_pre );
 
                                impulse = magtangent / ( 1.0 + w1*w1 + w2*w2 + w3*w3 ); // 2.0 * 
                                VECADDMUL ( cloth1->verts[collpair->ap1].impulse, vrel_t_pre, w1 * impulse );
@@ -681,7 +681,7 @@ CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTreeOverlap
                if ( distance <= ( epsilon1 + epsilon2 + ALMOST_ZERO ) )
                {
                        VECCOPY ( collpair->normal, collpair->vector );
-                       Normalize ( collpair->normal );
+                       normalize_v3( collpair->normal );
 
                        collpair->distance = distance;
                        collpair->flag = 0;
@@ -778,7 +778,7 @@ static int cloth_collision_response_moving( ClothModifierData *clmd, CollisionMo
 
                        // calculate tangential velocity
                        VECCOPY ( temp, collpair->normal );
-                       VecMulf ( temp, magrelVel );
+                       mul_v3_fl( temp, magrelVel );
                        VECSUB ( vrel_t_pre, relativeVelocity, temp );
 
                        // Decrease in magnitude of relative tangential velocity due to coulomb friction
@@ -788,7 +788,7 @@ static int cloth_collision_response_moving( ClothModifierData *clmd, CollisionMo
                        // Apply friction impulse.
                        if ( magtangent > ALMOST_ZERO )
                        {
-                               Normalize ( vrel_t_pre );
+                               normalize_v3( vrel_t_pre );
 
                                impulse = 2.0 * magtangent / ( 1.0 + w1*w1 + w2*w2 + w3*w3 );
                                VECADDMUL ( cloth1->verts[collpair->ap1].impulse, vrel_t_pre, w1 * impulse );
@@ -853,15 +853,15 @@ static void calculateEENormal(float *np1, float *np2, float *np3, float *np4,flo
 
        // printf("l1: %f, l1: %f, l2: %f, l2: %f\n", line1[0], line1[1], line2[0], line2[1]);
 
-       Crossf(out_normal, line1, line2);
+       cross_v3_v3v3(out_normal, line1, line2);
 
        
 
-       length = Normalize(out_normal);
+       length = normalize_v3(out_normal);
        if (length <= FLT_EPSILON)
        { // lines are collinear
                VECSUB(out_normal, np2, np1);
-               Normalize(out_normal);
+               normalize_v3(out_normal);
        }
 }
 
@@ -901,7 +901,7 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
        VECSUB(line1, np12, np11);
        VECSUB(line2, np22, np21);
 
-       Crossf(cross, line1, line2);
+       cross_v3_v3v3(cross, line1, line2);
        length = INPR(cross, cross);
 
        if (length < FLT_EPSILON) 
@@ -912,7 +912,7 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
                        *out_a1 = 0;
                        calculateEENormal(np11, np12, np21, np22, out_normal);
                        VECSUB(temp, np22, np21);
-                       VecMulf(temp, *out_a2);
+                       mul_v3_fl(temp, *out_a2);
                        VECADD(temp2, temp, np21);
                        VECADD(temp2, temp2, np11);
                        return INPR(temp2, temp2);
@@ -928,7 +928,7 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
 
                                // return (np22 - (np11 + (np12 - np11) * out_a1)).lengthSquared();
                                VECSUB(temp, np12, np11);
-                               VecMulf(temp, *out_a1);
+                               mul_v3_fl(temp, *out_a1);
                                VECADD(temp2, temp, np11);
                                VECSUB(temp2, np22, temp2);
                                return INPR(temp2, temp2);
@@ -943,7 +943,7 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
 
                                // return (np21 - (np11 + (np12 - np11) * out_a1)).lengthSquared();
                                VECSUB(temp, np12, np11);
-                               VecMulf(temp, *out_a1);
+                               mul_v3_fl(temp, *out_a1);
                                VECADD(temp2, temp, np11);
                                VECSUB(temp2, np21, temp2);
                                return INPR(temp2, temp2);
@@ -991,12 +991,12 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
                        
                        // p1= np11 + (np12 - np11) * out_a1;
                        VECSUB(temp, np12, np11);
-                       VecMulf(temp, *out_a1);
+                       mul_v3_fl(temp, *out_a1);
                        VECADD(p1, np11, temp);
                        
                        // p2 = np21 + (np22 - np21) * out_a2;
                        VECSUB(temp, np22, np21);
-                       VecMulf(temp, *out_a2);
+                       mul_v3_fl(temp, *out_a2);
                        VECADD(p2, np21, temp);
 
                        calculateEENormal(np11, np12, np21, np22, out_normal);
@@ -1022,7 +1022,7 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
 
                        // p1 = np11 + (np12 - np11) * out_a1;
                        VECSUB(temp, np12, np11);
-                       VecMulf(temp, *out_a1);
+                       mul_v3_fl(temp, *out_a1);
                        VECADD(p1, np11, temp);
 
                        *out_a2 = projectPointOntoLine(p1, np21, np22);
@@ -1032,7 +1032,7 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
 
                        // return (p1 - (np21 + (np22 - np21) * out_a2)).lengthSquared();
                        VECSUB(temp, np22, np21);
-                       VecMulf(temp, *out_a2);
+                       mul_v3_fl(temp, *out_a2);
                        VECADD(temp, temp, np21);
                        VECSUB(temp, p1, temp);
                        return INPR(temp, temp);
@@ -1044,7 +1044,7 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
                        
                        // p2 = np21 + (np22 - np21) * out_a2;
                        VECSUB(temp, np22, np21);
-                       VecMulf(temp, *out_a2);
+                       mul_v3_fl(temp, *out_a2);
                        VECADD(p2, np21, temp);
 
                        *out_a1 = projectPointOntoLine(p2, np11, np12);
@@ -1054,7 +1054,7 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
                        
                        // return ((np11 + (np12 - np11) * out_a1) - p2).lengthSquared();
                        VECSUB(temp, np12, np11);
-                       VecMulf(temp, *out_a1);
+                       mul_v3_fl(temp, *out_a1);
                        VECADD(temp, temp, np11);
                        VECSUB(temp, temp, p2);
                        return INPR(temp, temp);
@@ -1217,16 +1217,16 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
                                                float desiredVn;
 
                                                VECCOPY(vrel_1_to_2, verts1[edgecollpair.p11].tv);
-                                               VecMulf(vrel_1_to_2, 1.0 - a);
+                                               mul_v3_fl(vrel_1_to_2, 1.0 - a);
                                                VECCOPY(temp, verts1[edgecollpair.p12].tv);
-                                               VecMulf(temp, a);
+                                               mul_v3_fl(temp, a);
 
                                                VECADD(vrel_1_to_2, vrel_1_to_2, temp);
 
                                                VECCOPY(temp, verts1[edgecollpair.p21].tv);
-                                               VecMulf(temp, 1.0 - b);
+                                               mul_v3_fl(temp, 1.0 - b);
                                                VECCOPY(temp2, verts1[edgecollpair.p22].tv);
-                                               VecMulf(temp2, b);
+                                               mul_v3_fl(temp2, b);
                                                VECADD(temp, temp, temp2);
 
                                                VECSUB(vrel_1_to_2, vrel_1_to_2, temp);
@@ -1237,7 +1237,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
                                                if(out_normalVelocity < 0.0)
                                                {
                                                        out_normalVelocity*= -1.0;
-                                                       VecNegf(out_normal);
+                                                       negate_v3(out_normal);
                                                }
 */
                                                /* Inelastic repulsion impulse. */
@@ -1707,7 +1707,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
                                                        continue;
                                                }
        
-                                               length = Normalize ( temp );
+                                               length = normalize_v3( temp );
        
                                                if ( length < mindistance )
                                                {
@@ -1715,17 +1715,17 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
        
                                                        if ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED )
                                                        {
-                                                               VecMulf ( temp, -correction );
+                                                               mul_v3_fl( temp, -correction );
                                                                VECADD ( verts[j].tx, verts[j].tx, temp );
                                                        }
                                                        else if ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED )
                                                        {
-                                                               VecMulf ( temp, correction );
+                                                               mul_v3_fl( temp, correction );
                                                                VECADD ( verts[i].tx, verts[i].tx, temp );
                                                        }
                                                        else
                                                        {
-                                                               VecMulf ( temp, -correction*0.5 );
+                                                               mul_v3_fl( temp, -correction*0.5 );
                                                                VECADD ( verts[j].tx, verts[j].tx, temp );
        
                                                                VECSUB ( verts[i].tx, verts[i].tx, temp );
index 8cd64ae..f3448a6 100644 (file)
@@ -52,7 +52,7 @@
 #include "BKE_utildefines.h"
 
 #include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_threads.h"
 
 #include "IMB_imbuf.h"
@@ -462,35 +462,35 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
                
                if(bezt[0].h2==HD_AUTO) {
                        
-                       hlen= VecLenf(bezt[0].vec[1], bezt[0].vec[2]);  /* original handle length */
+                       hlen= len_v3v3(bezt[0].vec[1], bezt[0].vec[2]); /* original handle length */
                        /* clip handle point */
                        VECCOPY(vec, bezt[1].vec[0]);
                        if(vec[0] < bezt[0].vec[1][0])
                                vec[0]= bezt[0].vec[1][0];
                        
-                       VecSubf(vec, vec, bezt[0].vec[1]);
-                       nlen= VecLength(vec);
+                       sub_v3_v3v3(vec, vec, bezt[0].vec[1]);
+                       nlen= len_v3(vec);
                        if(nlen>FLT_EPSILON) {
-                               VecMulf(vec, hlen/nlen);
-                               VecAddf(bezt[0].vec[2], vec, bezt[0].vec[1]);
-                               VecSubf(bezt[0].vec[0], bezt[0].vec[1], vec);
+                               mul_v3_fl(vec, hlen/nlen);
+                               add_v3_v3v3(bezt[0].vec[2], vec, bezt[0].vec[1]);
+                               sub_v3_v3v3(bezt[0].vec[0], bezt[0].vec[1], vec);
                        }
                }
                a= cuma->totpoint-1;
                if(bezt[a].h2==HD_AUTO) {
                        
-                       hlen= VecLenf(bezt[a].vec[1], bezt[a].vec[0]);  /* original handle length */
+                       hlen= len_v3v3(bezt[a].vec[1], bezt[a].vec[0]); /* original handle length */
                        /* clip handle point */
                        VECCOPY(vec, bezt[a-1].vec[2]);
                        if(vec[0] > bezt[a].vec[1][0])
                                vec[0]= bezt[a].vec[1][0];
                        
-                       VecSubf(vec, vec, bezt[a].vec[1]);
-                       nlen= VecLength(vec);
+                       sub_v3_v3v3(vec, vec, bezt[a].vec[1]);
+                       nlen= len_v3(vec);
                        if(nlen>FLT_EPSILON) {
-                               VecMulf(vec, hlen/nlen);
-                               VecAddf(bezt[a].vec[0], vec, bezt[a].vec[1]);
-                               VecSubf(bezt[a].vec[2], bezt[a].vec[1], vec);
+                               mul_v3_fl(vec, hlen/nlen);
+                               add_v3_v3v3(bezt[a].vec[0], vec, bezt[a].vec[1]);
+                               sub_v3_v3v3(bezt[a].vec[2], bezt[a].vec[1], vec);
                        }
                }
        }       
index a319838..55001f5 100644 (file)
@@ -36,7 +36,7 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
 #include "BLI_editVert.h"
 
 #include "DNA_armature_types.h"
@@ -122,12 +122,12 @@ bConstraintOb *constraints_make_evalob (Scene *scene, Object *ob, void *subdata,
                                cob->ob = ob;
                                cob->type = datatype;
                                cob->rotOrder = EULER_ORDER_DEFAULT; // TODO: when objects have rotation order too, use that
-                               Mat4CpyMat4(cob->matrix, ob->obmat);
+                               copy_m4_m4(cob->matrix, ob->obmat);
                        }
                        else
-                               Mat4One(cob->matrix);
+                               unit_m4(cob->matrix);
                        
-                       Mat4CpyMat4(cob->startmat, cob->matrix);
+                       copy_m4_m4(cob->startmat, cob->matrix);
                }
                        break;
                case CONSTRAINT_OBTYPE_BONE:
@@ -148,18 +148,18 @@ bConstraintOb *constraints_make_evalob (Scene *scene, Object *ob, void *subdata,
                                }
                                
                                /* matrix in world-space */
-                               Mat4MulMat4(cob->matrix, cob->pchan->pose_mat, ob->obmat);
+                               mul_m4_m4m4(cob->matrix, cob->pchan->pose_mat, ob->obmat);
                        }
                        else
-                               Mat4One(cob->matrix);
+                               unit_m4(cob->matrix);
                                
-                       Mat4CpyMat4(cob->startmat, cob->matrix);
+                       copy_m4_m4(cob->startmat, cob->matrix);
                }
                        break;
                        
                default: /* other types not yet handled */
-                       Mat4One(cob->matrix);
-                       Mat4One(cob->startmat);
+                       unit_m4(cob->matrix);
+                       unit_m4(cob->startmat);
                        break;
        }
        
@@ -176,8 +176,8 @@ void constraints_clear_evalob (bConstraintOb *cob)
                return;
        
        /* calculate delta of constraints evaluation */
-       Mat4Invert(imat, cob->startmat);
-       Mat4MulMat4(delta, imat, cob->matrix);
+       invert_m4_m4(imat, cob->startmat);
+       mul_m4_m4m4(delta, imat, cob->matrix);
        
        /* copy matrices back to source */
        switch (cob->type) {
@@ -186,10 +186,10 @@ void constraints_clear_evalob (bConstraintOb *cob)
                        /* cob->ob might not exist! */
                        if (cob->ob) {
                                /* copy new ob-matrix back to owner */
-                               Mat4CpyMat4(cob->ob->obmat, cob->matrix);
+                               copy_m4_m4(cob->ob->obmat, cob->matrix);
                                
                                /* copy inverse of delta back to owner */
-                               Mat4Invert(cob->ob->constinv, delta);
+                               invert_m4_m4(cob->ob->constinv, delta);
                        }
                }
                        break;
@@ -198,10 +198,10 @@ void constraints_clear_evalob (bConstraintOb *cob)
                        /* cob->ob or cob->pchan might not exist */
                        if (cob->ob && cob->pchan) {
                                /* copy new pose-matrix back to owner */
-                               Mat4MulMat4(cob->pchan->pose_mat, cob->matrix, cob->ob->imat);
+                               mul_m4_m4m4(cob->pchan->pose_mat, cob->matrix, cob->ob->imat);
                                
                                /* copy inverse of delta back to owner */
-                               Mat4Invert(cob->pchan->constinv, delta);
+                               invert_m4_m4(cob->pchan->constinv, delta);
                        }
                }
                        break;
@@ -235,9 +235,9 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
                        case CONSTRAINT_SPACE_WORLD: /* ---------- FROM WORLDSPACE ---------- */
                        {
                                /* world to pose */
-                               Mat4Invert(imat, ob->obmat);
-                               Mat4CpyMat4(tempmat, mat);
-                               Mat4MulMat4(mat, tempmat, imat);
+                               invert_m4_m4(imat, ob->obmat);
+                               copy_m4_m4(tempmat, mat);
+                               mul_m4_m4m4(mat, tempmat, imat);
                                
                                /* use pose-space as stepping stone for other spaces... */
                                if (ELEM(to, CONSTRAINT_SPACE_LOCAL, CONSTRAINT_SPACE_PARLOCAL)) {
@@ -250,8 +250,8 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
                        {
                                /* pose to world */
                                if (to == CONSTRAINT_SPACE_WORLD) {
-                                       Mat4CpyMat4(tempmat, mat);
-                                       Mat4MulMat4(mat, tempmat, ob->obmat);
+                                       copy_m4_m4(tempmat, mat);
+                                       mul_m4_m4m4(mat, tempmat, ob->obmat);
                                }
                                /* pose to local */
                                else if (to == CONSTRAINT_SPACE_LOCAL) {
@@ -260,7 +260,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
                                                        float offs_bone[4][4];
                                                                
                                                        /* construct offs_bone the same way it is done in armature.c */
-                                                       Mat4CpyMat3(offs_bone, pchan->bone->bone_mat);
+                                                       copy_m4_m3(offs_bone, pchan->bone->bone_mat);
                                                        VECCOPY(offs_bone[3], pchan->bone->head);
                                                        offs_bone[3][1]+= pchan->bone->parent->length;
                                                        
@@ -269,37 +269,37 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
                                                                float tmat[4][4];
                                                                
                                                                /* the rotation of the parent restposition */
-                                                               Mat4CpyMat4(tmat, pchan->bone->parent->arm_mat);
+                                                               copy_m4_m4(tmat, pchan->bone->parent->arm_mat);
                                                                
                                                                /* the location of actual parent transform */
                                                                VECCOPY(tmat[3], offs_bone[3]);
                                                                offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
-                                                               Mat4MulVecfl(pchan->parent->pose_mat, tmat[3]);
+                                                               mul_m4_v3(pchan->parent->pose_mat, tmat[3]);
                                                                
-                                                               Mat4MulMat4(diff_mat, offs_bone, tmat);
-                                                               Mat4Invert(imat, diff_mat);
+                                                               mul_m4_m4m4(diff_mat, offs_bone, tmat);
+                                                               invert_m4_m4(imat, diff_mat);
                                                        }
                                                        else {
                                                                /* pose_mat = par_pose_mat * bone_mat * chan_mat */
-                                                               Mat4MulMat4(diff_mat, offs_bone, pchan->parent->pose_mat);
-                                                               Mat4Invert(imat, diff_mat);
+                                                               mul_m4_m4m4(diff_mat, offs_bone, pchan->parent->pose_mat);
+                                                               invert_m4_m4(imat, diff_mat);
                                                        }
                                                }
                                                else {
                                                        /* pose_mat = chan_mat * arm_mat */
-                                                       Mat4Invert(imat, pchan->bone->arm_mat);
+                                                       invert_m4_m4(imat, pchan->bone->arm_mat);
                                                }
                                                
-                                               Mat4CpyMat4(tempmat, mat);
-                                               Mat4MulMat4(mat, tempmat, imat);
+                                               copy_m4_m4(tempmat, mat);
+                                               mul_m4_m4m4(mat, tempmat, imat);
                                        }
                                }
                                /* pose to local with parent */
                                else if (to == CONSTRAINT_SPACE_PARLOCAL) {
                                        if (pchan->bone) {
-                                               Mat4Invert(imat, pchan->bone->arm_mat);
-                                               Mat4CpyMat4(tempmat, mat);
-                                               Mat4MulMat4(mat, tempmat, imat);
+                                               invert_m4_m4(imat, pchan->bone->arm_mat);
+                                               copy_m4_m4(tempmat, mat);
+                                               mul_m4_m4m4(mat, tempmat, imat);
                                        }
                                }
                        }
@@ -313,7 +313,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
                                                float offs_bone[4][4];
                                                
                                                /* construct offs_bone the same way it is done in armature.c */
-                                               Mat4CpyMat3(offs_bone, pchan->bone->bone_mat);
+                                               copy_m4_m3(offs_bone, pchan->bone->bone_mat);
                                                VECCOPY(offs_bone[3], pchan->bone->head);
                                                offs_bone[3][1]+= pchan->bone->parent->length;
                                                
@@ -322,29 +322,29 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
                                                        float tmat[4][4];
                                                        
                                                        /* the rotation of the parent restposition */
-                                                       Mat4CpyMat4(tmat, pchan->bone->parent->arm_mat);
+                                                       copy_m4_m4(tmat, pchan->bone->parent->arm_mat);
                                                        
                                                        /* the location of actual parent transform */
                                                        VECCOPY(tmat[3], offs_bone[3]);
                                                        offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
-                                                       Mat4MulVecfl(pchan->parent->pose_mat, tmat[3]);
+                                                       mul_m4_v3(pchan->parent->pose_mat, tmat[3]);
                                                        
-                                                       Mat4MulMat4(diff_mat, offs_bone, tmat);
-                                                       Mat4CpyMat4(tempmat, mat);
-                                                       Mat4MulMat4(mat, tempmat, diff_mat);
+                                                       mul_m4_m4m4(diff_mat, offs_bone, tmat);
+                                                       copy_m4_m4(tempmat, mat);
+                                                       mul_m4_m4m4(mat, tempmat, diff_mat);
                                                }
                                                else {
                                                        /* pose_mat = par_pose_mat * bone_mat * chan_mat */
-                                                       Mat4MulMat4(diff_mat, offs_bone, pchan->parent->pose_mat);
-                                                       Mat4CpyMat4(tempmat, mat);
-                                                       Mat4MulMat4(mat, tempmat, diff_mat);
+                                                       mul_m4_m4m4(diff_mat, offs_bone, pchan->parent->pose_mat);
+                                                       copy_m4_m4(tempmat, mat);
+                                                       mul_m4_m4m4(mat, tempmat, diff_mat);
                                                }
                                        }