[gs-cvs] rev 7171 - trunk/gs/src

alexcher at ghostscript.com alexcher at ghostscript.com
Tue Nov 7 07:55:45 PST 2006


Author: alexcher
Date: 2006-11-07 07:55:45 -0800 (Tue, 07 Nov 2006)
New Revision: 7171

Modified:
   trunk/gs/src/gspath1.c
Log:
Use standard vector product formula to decide whether the 2 tangent lines
in arct operator are collinear. Fix CET 11-03.

DIFFERENCES:
None


Modified: trunk/gs/src/gspath1.c
===================================================================
--- trunk/gs/src/gspath1.c	2006-11-07 12:52:11 UTC (rev 7170)
+++ trunk/gs/src/gspath1.c	2006-11-07 15:55:45 UTC (rev 7171)
@@ -303,7 +303,7 @@
     if (code < 0)
 	return code;
     {	
-        double dx0, dy0, dx2, dy2, sql0, sql2, num, denom;
+        double dx0, dy0, dx2, dy2, sql0, sql2;
         
         /* Now we have to compute the tangent points. */
 	/* Basically, the idea is to compute the tangent */
@@ -319,17 +319,17 @@
         if (sql0 == 0. || sql2 == 0.)
             return_error(gs_error_undefinedresult); /* for CET 11-04 */
 
-	/* Compute the distance from p1 to the tangent points. */
-	/* This is the only messy part. */
-	num = dy0 * dx2 - dy2 * dx0;
-	denom = sqrt(sql0 * sql2) - (dx0 * dx2 + dy0 * dy2);
-
 	/* Check for collinear points. */
-	if (denom == 0) {
+	if (dx0*dy2 == dy0*dx2) {
 	    code = gs_lineto(pgs, ax1, ay1);
 	    xt0 = xt2 = ax1;
 	    yt0 = yt2 = ay1;
 	} else {		/* not collinear */
+	    /* Compute the distance from p1 to the tangent points. */
+	    /* This is the only messy part. */
+	    double num = dy0 * dx2 - dy2 * dx0;
+	    double denom = sqrt(sql0 * sql2) - (dx0 * dx2 + dy0 * dy2);
+
 	    double dist = fabs(arad * num / denom);
 	    double l0 = dist / sqrt(sql0), l2 = dist / sqrt(sql2);
 	    arc_curve_params_t arc;



More information about the gs-cvs mailing list