[postgis-commits] svn - r3427 - trunk/cunit
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Tue Dec 16 16:22:26 PST 2008
Author: pramsey
Date: 2008-12-16 16:22:26 -0800 (Tue, 16 Dec 2008)
New Revision: 3427
Modified:
trunk/cunit/cu_algorithm.c
Log:
Add some co-linearity tests.
Modified: trunk/cunit/cu_algorithm.c
===================================================================
--- trunk/cunit/cu_algorithm.c 2008-12-17 00:19:27 UTC (rev 3426)
+++ trunk/cunit/cu_algorithm.c 2008-12-17 00:22:26 UTC (rev 3427)
@@ -490,5 +490,42 @@
setPoint4d(pa52, 4, p);
CU_ASSERT( lineCrossingDirection(l51, l52) == LINE_CROSS_LEFT );
+ /* One on-vertices co-linear crossing */
+ p->x = 1.0;
+ p->y = 1.0;
+ setPoint4d(pa52, 0, p);
+ p->x = 0.0;
+ p->y = 1.0;
+ setPoint4d(pa52, 1, p);
+ p->x = 0.0;
+ p->y = 2.0;
+ setPoint4d(pa52, 2, p);
+ p->x = -1.0;
+ p->y = 3.0;
+ setPoint4d(pa52, 3, p);
+ p->x = -1.0;
+ p->y = 4.0;
+ setPoint4d(pa52, 4, p);
+ CU_ASSERT( lineCrossingDirection(l51, l52) == LINE_CROSS_LEFT );
+
+ /* No crossing, but end on a co-linearity. */
+ p->x = 1.0;
+ p->y = 1.0;
+ setPoint4d(pa52, 0, p);
+ p->x = 1.0;
+ p->y = 2.0;
+ setPoint4d(pa52, 1, p);
+ p->x = 1.0;
+ p->y = 3.0;
+ setPoint4d(pa52, 2, p);
+ p->x = 0.0;
+ p->y = 3.0;
+ setPoint4d(pa52, 3, p);
+ p->x = 0.0;
+ p->y = 4.0;
+ setPoint4d(pa52, 4, p);
+ CU_ASSERT( lineCrossingDirection(l51, l52) == LINE_NO_CROSS );
+
+
}
More information about the postgis-commits
mailing list