From: <and...@us...> - 2009-02-24 13:08:43
|
Revision: 9602 http://plplot.svn.sourceforge.net/plplot/?rev=9602&view=rev Author: andrewross Date: 2009-02-24 13:08:40 +0000 (Tue, 24 Feb 2009) Log Message: ----------- Add support for handling NaN and +/-Inf values when plotting lines. Physical coordinates are of type PLINT and so we cannot directly use NaN / Inf values. Instead, coordinate transformations plP_wcpc[xy] map NaN and Inf to PLINT_MIN which is the smallest (most negative) number when can be held in a PLINT. This will never by used for "real" physical coordinates). Adding support at this level means that the only other change is that the low-level clipping routine will not attempt to draw any line segment where any of the physical coordinates have a value of PLINT_MIN. Modified Paths: -------------- trunk/include/plplot.h trunk/src/plcvt.c trunk/src/plline.c Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2009-02-24 11:43:06 UTC (rev 9601) +++ trunk/include/plplot.h 2009-02-24 13:08:40 UTC (rev 9602) @@ -161,11 +161,13 @@ typedef uint32_t PLUINT; typedef int32_t PLINT; typedef int64_t PLINT64; +#define PLINT_MIN INT32_MIN #else /* A reasonable back-up in case stdint.h does not exist on the platform. */ typedef unsigned int PLUINT; typedef int PLINT; typedef __int64 PLINT64; +#define PLINT_MIN -2147483648 /* typedef unsigned int PLUINT; typedef int PLINT; Modified: trunk/src/plcvt.c =================================================================== --- trunk/src/plcvt.c 2009-02-24 11:43:06 UTC (rev 9601) +++ trunk/src/plcvt.c 2009-02-24 13:08:40 UTC (rev 9602) @@ -64,6 +64,7 @@ PLINT plP_wcpcx(PLFLT x) { + if (!finite(x)) return PLINT_MIN; return (ROUND(plsc->wpxoff + plsc->wpxscl * x)); } @@ -72,6 +73,7 @@ PLINT plP_wcpcy(PLFLT y) { + if (!finite(y)) return PLINT_MIN; return (ROUND(plsc->wpyoff + plsc->wpyscl * y)); } Modified: trunk/src/plline.c =================================================================== --- trunk/src/plline.c 2009-02-24 11:43:06 UTC (rev 9601) +++ trunk/src/plline.c 2009-02-24 13:08:40 UTC (rev 9602) @@ -1076,6 +1076,11 @@ (*p_y1 >= ymax && *p_y2 >= ymax)) return 1; +/* If one of the coordinates is not finite then return with an error */ + if ( (*p_x1 == PLINT_MIN) || (*p_y1 == PLINT_MIN) || + (*p_x2 == PLINT_MIN) || (*p_y2 == PLINT_MIN) ) + return 1; + flipx = 0; flipy = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |