[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33608] trunk/blender/source/blender: isect_seg_seg_v2_point was modifying the value of line vectors passed.
Campbell Barton
ideasman42 at gmail.com
Sun Dec 12 02:36:10 CET 2010
Revision: 33608
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33608
Author: campbellbarton
Date: 2010-12-12 02:36:10 +0100 (Sun, 12 Dec 2010)
Log Message:
-----------
isect_seg_seg_v2_point was modifying the value of line vectors passed.
this could be confusing later on, now swap the pointers rather then changing their values.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_math_geom.h
trunk/blender/source/blender/blenlib/intern/math_geom.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 2010-12-12 01:33:12 UTC (rev 33607)
+++ trunk/blender/source/blender/blenlib/BLI_math_geom.h 2010-12-12 01:36:10 UTC (rev 33608)
@@ -71,9 +71,9 @@
#define ISECT_LINE_LINE_EXACT 1
#define ISECT_LINE_LINE_CROSS 2
-int isect_line_line_v2(float a1[2], float a2[2], float b1[2], float b2[2]);
-int isect_line_line_v2_short(short a1[2], short a2[2], short b1[2], short b2[2]);
-int isect_seg_seg_v2_point(float v1[2], float v2[2], float v3[2], float v4[2], float vi[2]);
+int isect_line_line_v2(const float a1[2], const float a2[2], const float b1[2], const float b2[2]);
+int isect_line_line_v2_short(const short a1[2], const short a2[2], const short b1[2], const short b2[2]);
+int isect_seg_seg_v2_point(const float *v1, const float *v2, const float *v3, const float *v4, float vi[2]);
/* Returns the number of point of interests
* 0 - lines are colinear
Modified: trunk/blender/source/blender/blenlib/intern/math_geom.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_geom.c 2010-12-12 01:33:12 UTC (rev 33607)
+++ trunk/blender/source/blender/blenlib/intern/math_geom.c 2010-12-12 01:36:10 UTC (rev 33608)
@@ -233,7 +233,7 @@
/******************************* Intersection ********************************/
/* intersect Line-Line, shorts */
-int isect_line_line_v2_short(short *v1, short *v2, short *v3, short *v4)
+int isect_line_line_v2_short(const short *v1, const short *v2, const short *v3, const short *v4)
{
/* return:
-1: colliniar
@@ -258,7 +258,7 @@
}
/* intersect Line-Line, floats */
-int isect_line_line_v2(float *v1, float *v2, float *v3, float *v4)
+int isect_line_line_v2(const float *v1, const float *v2, const float *v3, const float *v4)
{
/* return:
-1: colliniar
@@ -285,7 +285,7 @@
/* get intersection point of two 2D segments and return intersection type:
-1: colliniar
1: intersection */
-int isect_seg_seg_v2_point(float v1[2], float v2[2], float v3[2], float v4[2], float vi[2])
+int isect_seg_seg_v2_point(const float *v1, const float *v2, const float *v3, const float *v4, float vi[2])
{
float a1, a2, b1, b2, c1, c2, d;
float u, v;
@@ -309,10 +309,8 @@
if(len_v2v2(v1, v2)==0.0f) {
if(len_v2v2(v3, v4)>eps) {
/* use non-point segment as basis */
- SWAP(float, v1[0], v3[0]);
- SWAP(float, v1[1], v3[1]);
- SWAP(float, v2[0], v4[0]);
- SWAP(float, v2[1], v4[1]);
+ SWAP(const float *, v1, v3);
+ SWAP(const float *, v2, v4);
} else { /* both of segments are points */
if(equals_v2v2(v1, v3)) { /* points are equal */
copy_v2_v2(vi, v1);
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c 2010-12-12 01:33:12 UTC (rev 33607)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c 2010-12-12 01:36:10 UTC (rev 33608)
@@ -163,17 +163,17 @@
#define PROJ_DEBUG_WINCLIP 1
/* projectFaceSeamFlags options */
-//#define PROJ_FACE_IGNORE 1<<0 /* When the face is hidden, backfacing or occluded */
-//#define PROJ_FACE_INIT 1<<1 /* When we have initialized the faces data */
-#define PROJ_FACE_SEAM1 1<<0 /* If this face has a seam on any of its edges */
-#define PROJ_FACE_SEAM2 1<<1
-#define PROJ_FACE_SEAM3 1<<2
-#define PROJ_FACE_SEAM4 1<<3
+//#define PROJ_FACE_IGNORE (1<<0) /* When the face is hidden, backfacing or occluded */
+//#define PROJ_FACE_INIT (1<<1) /* When we have initialized the faces data */
+#define PROJ_FACE_SEAM1 (1<<0) /* If this face has a seam on any of its edges */
+#define PROJ_FACE_SEAM2 (1<<1)
+#define PROJ_FACE_SEAM3 (1<<2)
+#define PROJ_FACE_SEAM4 (1<<3)
-#define PROJ_FACE_NOSEAM1 1<<4
-#define PROJ_FACE_NOSEAM2 1<<5
-#define PROJ_FACE_NOSEAM3 1<<6
-#define PROJ_FACE_NOSEAM4 1<<7
+#define PROJ_FACE_NOSEAM1 (1<<4)
+#define PROJ_FACE_NOSEAM2 (1<<5)
+#define PROJ_FACE_NOSEAM3 (1<<6)
+#define PROJ_FACE_NOSEAM4 (1<<7)
#define PROJ_SRC_VIEW 1
#define PROJ_SRC_IMAGE_CAM 2
@@ -189,8 +189,8 @@
#define PROJ_FACE_SCALE_SEAM 0.99f
#define PROJ_BUCKET_NULL 0
-#define PROJ_BUCKET_INIT 1<<0
-// #define PROJ_BUCKET_CLONE_INIT 1<<1
+#define PROJ_BUCKET_INIT (1<<0)
+// #define PROJ_BUCKET_CLONE_INIT (1<<1)
/* used for testing doubles, if a point is on a line etc */
#define PROJ_GEOM_TOLERANCE 0.00075f
More information about the Bf-blender-cvs
mailing list