[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55951] trunk/blender/source/blender/ blenlib: add 2d length functions for testing pixel coords.
Campbell Barton
ideasman42 at gmail.com
Thu Apr 11 04:23:52 CEST 2013
Revision: 55951
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55951
Author: campbellbarton
Date: 2013-04-11 02:23:45 +0000 (Thu, 11 Apr 2013)
Log Message:
-----------
add 2d length functions for testing pixel coords. len_manhattan_v2_int, len_manhattan_v2v2_int
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_math_vector.h
trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
Modified: trunk/blender/source/blender/blenlib/BLI_math_vector.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_vector.h 2013-04-11 00:23:09 UTC (rev 55950)
+++ trunk/blender/source/blender/blenlib/BLI_math_vector.h 2013-04-11 02:23:45 UTC (rev 55951)
@@ -149,12 +149,14 @@
MINLINE float len_squared_v2(const float v[2]);
MINLINE float len_squared_v3(const float v[3]);
MINLINE float len_manhattan_v2(const float v[2]);
+MINLINE float len_manhattan_v2_int(const int v[2]);
MINLINE float len_manhattan_v3(const float v[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[2], const float b[2]);
MINLINE float len_squared_v3v3(const float a[3], const float b[3]);
MINLINE float len_manhattan_v2v2(const float a[2], const float b[2]);
+MINLINE float len_manhattan_v2v2_int(const int a[2], const int b[2]);
MINLINE float len_manhattan_v3v3(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]);
Modified: trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_vector_inline.c 2013-04-11 00:23:09 UTC (rev 55950)
+++ trunk/blender/source/blender/blenlib/intern/math_vector_inline.c 2013-04-11 02:23:45 UTC (rev 55951)
@@ -594,6 +594,11 @@
return fabsf(v[0]) + fabsf(v[1]);
}
+MINLINE float len_manhattan_v2_int(const int v[2])
+{
+ return ABS(v[0]) + ABS(v[1]);
+}
+
MINLINE float len_manhattan_v3(const float v[3])
{
return fabsf(v[0]) + fabsf(v[1]) + fabsf(v[2]);
@@ -642,6 +647,14 @@
return len_manhattan_v2(d);
}
+MINLINE float len_manhattan_v2v2_int(const int a[2], const int b[2])
+{
+ int d[2];
+
+ sub_v2_v2v2_int(d, b, a);
+ return len_manhattan_v2_int(d);
+}
+
MINLINE float len_manhattan_v3v3(const float a[3], const float b[3])
{
float d[3];
More information about the Bf-blender-cvs
mailing list