[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48902] trunk/blender/source/blender: add is_quad_convex_v2(), SET_UINT_IN_POINTER, GET_UINT_FROM_POINTER macros & some minor edits.
Campbell Barton
ideasman42 at gmail.com
Sat Jul 14 02:34:00 CEST 2012
Revision: 48902
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48902
Author: campbellbarton
Date: 2012-07-14 00:33:58 +0000 (Sat, 14 Jul 2012)
Log Message:
-----------
add is_quad_convex_v2(), SET_UINT_IN_POINTER, GET_UINT_FROM_POINTER macros & some minor edits.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_math_geom.h
trunk/blender/source/blender/blenlib/BLI_utildefines.h
trunk/blender/source/blender/blenlib/intern/math_geom.c
trunk/blender/source/blender/blenlib/intern/rct.c
trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
Modified: trunk/blender/source/blender/blenlib/BLI_math_geom.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_geom.h 2012-07-13 23:42:40 UTC (rev 48901)
+++ trunk/blender/source/blender/blenlib/BLI_math_geom.h 2012-07-14 00:33:58 UTC (rev 48902)
@@ -55,6 +55,7 @@
float area_poly_v3(int nr, float verts[][3], const float normal[3]);
int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]);
+int is_quad_convex_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2]);
/********************************* Distance **********************************/
Modified: trunk/blender/source/blender/blenlib/BLI_utildefines.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_utildefines.h 2012-07-13 23:42:40 UTC (rev 48901)
+++ trunk/blender/source/blender/blenlib/BLI_utildefines.h 2012-07-14 00:33:58 UTC (rev 48902)
@@ -232,6 +232,10 @@
#define SET_INT_IN_POINTER(i) ((void *)(intptr_t)(i))
#define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i))
+#define SET_UINT_IN_POINTER(i) ((void *)(uintptr_t)(i))
+#define GET_UINT_FROM_POINTER(i) ((unsigned int)(uintptr_t)(i))
+
+
/* Macro to convert a value to string in the preprocessor
* STRINGIFY_ARG: gives the argument as a string
* STRINGIFY_APPEND: appends any argument 'b' onto the string argument 'a',
Modified: trunk/blender/source/blender/blenlib/intern/math_geom.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_geom.c 2012-07-13 23:42:40 UTC (rev 48901)
+++ trunk/blender/source/blender/blenlib/intern/math_geom.c 2012-07-14 00:33:58 UTC (rev 48902)
@@ -3278,3 +3278,10 @@
/* linetests, the 2 diagonals have to instersect to be convex */
return (isect_line_line_v2(vec[0], vec[2], vec[1], vec[3]) > 0) ? TRUE : FALSE;
}
+
+int is_quad_convex_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
+{
+ /* linetests, the 2 diagonals have to instersect to be convex */
+ return (isect_line_line_v2(v1, v3, v2, v4) > 0) ? TRUE : FALSE;
+}
+
Modified: trunk/blender/source/blender/blenlib/intern/rct.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/rct.c 2012-07-13 23:42:40 UTC (rev 48901)
+++ trunk/blender/source/blender/blenlib/intern/rct.c 2012-07-14 00:33:58 UTC (rev 48902)
@@ -41,6 +41,13 @@
#include "DNA_vec_types.h"
#include "BLI_rect.h"
+/**
+ * Determine if a rect is empty. An empty
+ * rect is one with a zero (or negative)
+ * width or height.
+ *
+ * \return True if \a rect is empty.
+ */
int BLI_rcti_is_empty(const rcti *rect)
{
return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c 2012-07-13 23:42:40 UTC (rev 48901)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c 2012-07-14 00:33:58 UTC (rev 48902)
@@ -560,14 +560,14 @@
* ps->bucketRect[x + (y*ps->buckets_y)] */
/* please explain?
- * projCoSS[0] - ps->screenMin[0] : zero origin
- * ... / ps->screen_width : range from 0.0 to 1.0
- * ... * ps->buckets_x : use as a bucket index
+ * projCoSS[0] - ps->screenMin[0] : zero origin
+ * ... / ps->screen_width : range from 0.0 to 1.0
+ * ... * ps->buckets_x : use as a bucket index
*
* Second multiplication does similar but for vertical offset
*/
- return ( (int)(((projCoSS[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x)) +
- ( ( (int)(((projCoSS[1] - ps->screenMin[1]) / ps->screen_height) * ps->buckets_y)) * ps->buckets_x);
+ return ( (int)(((projCoSS[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x)) +
+ (((int)(((projCoSS[1] - ps->screenMin[1]) / ps->screen_height) * ps->buckets_y)) * ps->buckets_x);
}
static int project_bucket_offset_safe(const ProjPaintState *ps, const float projCoSS[2])
More information about the Bf-blender-cvs
mailing list