Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-10-19 03:38:51 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-10-19 03:38:51 +0400
commitfc8b0ed5e572d0e3e0ee68f5e0b2e7060acfa2cf (patch)
treedb8c9034f01967f02c2eda49e48c4084fa818363 /source
parent451607630edd2d1b1ef86bac2f62baa162546078 (diff)
Move utility functions from mball to mathutils
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/mball.c16
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h2
-rw-r--r--source/blender/blenlib/BLI_math_vector.h2
-rw-r--r--source/blender/blenlib/intern/math_matrix.c6
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c8
5 files changed, 18 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index a4b59153e2b..83c257dbd56 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -1637,22 +1637,6 @@ static void polygonize(PROCESS *process, MetaBall *mb)
}
}
-/* could move to math api */
-BLI_INLINE void copy_v3_fl3(float v[3], float x, float y, float z)
-{
- v[0] = x;
- v[1] = y;
- v[2] = z;
-}
-
-/* TODO(sergey): Perhaps it could be general utility function in mathutils. */
-static bool has_zero_axis_m4(float matrix[4][4])
-{
- return len_squared_v3(matrix[0]) < FLT_EPSILON ||
- len_squared_v3(matrix[1]) < FLT_EPSILON ||
- len_squared_v3(matrix[2]) < FLT_EPSILON;
-}
-
static float init_meta(PROCESS *process, Scene *scene, Object *ob) /* return totsize */
{
Scene *sce_iter = scene;
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index b04af44156f..7db2227dfaf 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -160,6 +160,8 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A[4][4]);
void pseudoinverse_m4_m4(float Ainv[4][4], float A[4][4], float epsilon);
void pseudoinverse_m3_m3(float Ainv[3][3], float A[3][3], float epsilon);
+bool has_zero_axis_m4(float matrix[4][4]);
+
/****************************** Transformations ******************************/
void scale_m3_fl(float R[3][3], float scale);
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 675ba88fc72..7576fbe2b54 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -82,6 +82,8 @@ MINLINE void copy_v4fl_v4db(float r[4], const double a[4]);
MINLINE void copy_v2db_v2fl(double r[2], const float a[2]);
MINLINE void copy_v3db_v3fl(double r[3], const float a[3]);
MINLINE void copy_v4db_v4fl(double r[4], const float a[4]);
+/* 3 float -> vec */
+MINLINE void copy_v3_fl3(float v[3], float x, float y, float z);
/********************************* Arithmetic ********************************/
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index d24200fc0b7..6b96f0515b9 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -2070,3 +2070,9 @@ void pseudoinverse_m3_m3(float Ainv[3][3], float A[3][3], float epsilon)
}
}
+bool has_zero_axis_m4(float matrix[4][4])
+{
+ return len_squared_v3(matrix[0]) < FLT_EPSILON ||
+ len_squared_v3(matrix[1]) < FLT_EPSILON ||
+ len_squared_v3(matrix[2]) < FLT_EPSILON;
+}
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index ce5d9657c7f..b479b06da3f 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -235,6 +235,14 @@ MINLINE void swap_v4_v4(float a[4], float b[4])
SWAP(float, a[3], b[3]);
}
+/* 3 float -> vec */
+MINLINE void copy_v3_fl3(float v[3], float x, float y, float z)
+{
+ v[0] = x;
+ v[1] = y;
+ v[2] = z;
+}
+
/********************************* Arithmetic ********************************/
MINLINE void add_v2_fl(float r[2], float f)