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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/BLI_math_vector.h')
-rw-r--r--source/blender/blenlib/BLI_math_vector.h76
1 files changed, 53 insertions, 23 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 0749e657f08..1f56694f85b 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -25,8 +25,12 @@
* ***** END GPL LICENSE BLOCK *****
* */
-#ifndef BLI_MATH_VECTOR
-#define BLI_MATH_VECTOR
+#ifndef BLI_MATH_VECTOR_H
+#define BLI_MATH_VECTOR_H
+
+/** \file BLI_math_vector.h
+ * \ingroup bli
+ */
#ifdef __cplusplus
extern "C" {
@@ -34,7 +38,7 @@ extern "C" {
#include "BLI_math_inline.h"
-#ifdef BLI_MATH_INLINE
+#ifdef BLI_MATH_INLINE_H
#include "intern/math_vector_inline.c"
#else
#define MINLINE
@@ -65,6 +69,8 @@ MINLINE void sub_v2_v2(float r[2], const float a[2]);
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2]);
MINLINE void sub_v3_v3(float r[3], const float a[3]);
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3]);
+MINLINE void sub_v4_v4(float r[4], const float a[4]);
+MINLINE void sub_v4_v4v4(float r[4], const float a[4], const float b[4]);
MINLINE void mul_v2_fl(float r[2], float f);
MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f);
@@ -84,6 +90,8 @@ MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f);
MINLINE void negate_v3(float r[3]);
MINLINE void negate_v3_v3(float r[3], const float a[3]);
+MINLINE void negate_v4(float r[4]);
+MINLINE void negate_v4_v4(float r[4], const float a[3]);
MINLINE float dot_v2v2(const float a[2], const float b[2]);
MINLINE float dot_v3v3(const float a[3], const float b[3]);
@@ -97,6 +105,7 @@ MINLINE void star_m3_v3(float R[3][3],float a[3]);
MINLINE float len_v2(const float a[2]);
MINLINE float len_v2v2(const float a[2], const float b[2]);
+MINLINE float len_squared_v2v2(const float a[3], const float b[3]);
MINLINE float len_v3(const float a[3]);
MINLINE float len_v3v3(const float a[3], const float b[3]);
MINLINE float len_squared_v3v3(const float a[3], const float b[3]);
@@ -116,40 +125,47 @@ void interp_v3_v3v3v3v3(float p[3], const float v1[3], const float v2[3], const
void interp_v4_v4v4(float r[4], const float a[4], const float b[4], const float t);
void interp_v4_v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float w[3]);
-void mid_v3_v3v3(float r[3], float a[3], float b[3]);
+void mid_v3_v3v3(float r[3], const float a[3], const float b[3]);
/********************************* Comparison ********************************/
-MINLINE int is_zero_v3(float a[3]);
-MINLINE int is_one_v3(float a[3]);
+MINLINE int is_zero_v3(const float a[3]);
+MINLINE int is_zero_v4(const float a[4]);
+MINLINE int is_one_v3(const float a[3]);
+
+MINLINE int equals_v2v2(const float *v1, const float *v2);
+MINLINE int equals_v3v3(const float a[3], const float b[3]);
+MINLINE int compare_v3v3(const float a[3], const float b[3], const float limit);
+MINLINE int compare_len_v3v3(const float a[3], const float b[3], const float limit);
-MINLINE int equals_v3v3(float a[3], float b[3]);
-MINLINE int compare_v3v3(float a[3], float b[3], float limit);
-MINLINE int compare_len_v3v3(float a[3], float b[3], float limit);
+MINLINE int compare_v4v4(const float a[4], const float b[4], const float limit);
+MINLINE int equals_v4v4(const float a[4], const float b[4]);
-MINLINE int compare_v4v4(float a[4], float b[4], float limit);
-MINLINE int equals_v4v4(float a[4], float b[4]);
+MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]);
/********************************** Angles ***********************************/
/* - angle with 2 arguments is angle between vector */
/* - angle with 3 arguments is angle between 3 points at the middle point */
/* - angle_normalized_* is faster equivalent if vectors are normalized */
-float angle_v2v2(float a[2], float b[2]);
-float angle_v2v2v2(float a[2], float b[2], float c[2]);
-float angle_normalized_v2v2(float a[2], float b[2]);
-float angle_v3v3(float a[2], float b[2]);
-float angle_v3v3v3(float a[2], float b[2], float c[2]);
+float angle_v2v2(const float a[2], const float b[2]);
+float angle_v2v2v2(const float a[2], const float b[2], const float c[2]);
+float angle_normalized_v2v2(const float a[2], const float b[2]);
+float angle_v3v3(const float a[3], const float b[3]);
+float angle_v3v3v3(const float a[3], const float b[3], const float c[3]);
float angle_normalized_v3v3(const float v1[3], const float v2[3]);
void angle_tri_v3(float angles[3], const float v1[3], const float v2[3], const float v3[3]);
void angle_quad_v3(float angles[4], const float v1[3], const float v2[3], const float v3[3], const float v4[3]);
/********************************* Geometry **********************************/
-void project_v3_v3v3(float r[3], float p[3], float n[3]);
-void reflect_v3_v3v3(float r[3], float v[3], float n[3]);
-void ortho_basis_v3v3_v3(float r1[3], float r2[3], float a[3]);
-void bisect_v3_v3v3v3(float r[3], float a[3], float b[3], float c[3]);
+void project_v2_v2v2(float c[2], const float v1[2], const float v2[2]);
+void project_v3_v3v3(float r[3], const float p[3], const float n[3]);
+void reflect_v3_v3v3(float r[3], const float v[3], const float n[3]);
+void ortho_basis_v3v3_v3(float r1[3], float r2[3], const float a[3]);
+void bisect_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3]);
+void rotate_v3_v3v3fl(float v[3], const float p[3], const float axis[3], const float angle);
+void rotate_normalized_v3_v3v3fl(float v[3], const float p[3], const float axis[3], const float angle);
/*********************************** Other ***********************************/
@@ -160,11 +176,25 @@ void print_v4(const char *str, const float a[4]);
MINLINE void normal_short_to_float_v3(float r[3], const short n[3]);
MINLINE void normal_float_to_short_v3(short r[3], const float n[3]);
-void minmax_v3_v3v3(float r[3], float min[3], float max[3]);
+void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]);
+
+/***************************** Array Functions *******************************/
+/* attempted to follow fixed length vertex functions. names could be improved*/
+void range_vni(int *array, const int size, const int start);
+void negate_vn(float *array_tar, const int size);
+void negate_vn_vn(float *array_tar, const float *array_src, const int size);
+void mul_vn_fl(float *array, const int size, const float f);
+void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f);
+void add_vn_vn(float *array_tar, const float *array_src, const int size);
+void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size);
+void sub_vn_vn(float *array_tar, const float *array_src, const int size);
+void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size);
+void fill_vni(int *array_tar, const int size, const int val);
+void fill_vn(float *array_tar, const int size, const float val);
#ifdef __cplusplus
}
#endif
-#endif /* BLI_MATH_VECTOR */
+#endif /* BLI_MATH_VECTOR_H */