[gs-cvs] rev 7154 - trunk/gs/src
alexcher at ghostscript.com
alexcher at ghostscript.com
Fri Nov 3 11:20:58 PST 2006
Author: alexcher
Date: 2006-11-03 11:20:58 -0800 (Fri, 03 Nov 2006)
New Revision: 7154
Modified:
trunk/gs/src/gspath1.c
Log:
Make arcto and arct operators throw undefinedresult when the start point
or the end point is the same as the center making calculation of the
tangent impossible. Fix CET 11-04.ps.
DIFFERENCES:
None
Modified: trunk/gs/src/gspath1.c
===================================================================
--- trunk/gs/src/gspath1.c 2006-11-03 06:28:15 UTC (rev 7153)
+++ trunk/gs/src/gspath1.c 2006-11-03 19:20:58 UTC (rev 7154)
@@ -302,21 +302,27 @@
if (code < 0)
return code;
- { /* Now we have to compute the tangent points. */
+ {
+ double dx0, dy0, dx2, dy2, sql0, sql2, num, denom;
+
+ /* Now we have to compute the tangent points. */
/* Basically, the idea is to compute the tangent */
/* of the bisector by using tan(x+y) and tan(z/2) */
/* formulas, without ever using any trig. */
- double dx0 = ax0 - ax1, dy0 = ay0 - ay1;
- double dx2 = ax2 - ax1, dy2 = ay2 - ay1;
+ dx0 = ax0 - ax1; dy0 = ay0 - ay1;
+ dx2 = ax2 - ax1; dy2 = ay2 - ay1;
/* Compute the squared lengths from p1 to p0 and p2. */
- double sql0 = dx0 * dx0 + dy0 * dy0;
- double sql2 = dx2 * dx2 + dy2 * dy2;
+ sql0 = dx0 * dx0 + dy0 * dy0;
+ sql2 = dx2 * dx2 + dy2 * dy2;
+ 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. */
- double num = dy0 * dx2 - dy2 * dx0;
- double denom = sqrt(sql0 * sql2) - (dx0 * dx2 + dy0 * dy2);
+ num = dy0 * dx2 - dy2 * dx0;
+ denom = sqrt(sql0 * sql2) - (dx0 * dx2 + dy0 * dy2);
/* Check for collinear points. */
if (denom == 0) {
More information about the gs-cvs
mailing list