[gl2ps] Nan filtering?

David Lonie david.lonie at kitware.com
Fri May 10 14:27:27 CEST 2013


After a good night's sleep and a peek at the OpenGL specification,
this patch may not be needed. The spec states:

Any representable floating-point value is legal as input to a GL
command that requires floating-point data. The result of providing a
value that is not a floating point number to such a command is
unspecified, but must not lead to GL interruption or termination. In
IEEE arithmetic, for example, providing a negative zero or a
denormalized number to a GL command yields predictable results, while
providing a NaN or an infinity yields unspecified results.

We may not want to add the overhead of explicitly checking each
coordinate for Nan, when passing Nans in is a user error. GL2PS does
adhere to the standard -- it does not crash or terminate, and rather
gracefully passes the Nans through to the output.

Feel free to reject this patch, I'm on the fence about it as it.

Dave

On Thu, May 9, 2013 at 5:14 PM, David Lonie <david.lonie at kitware.com> wrote:
> This bit is also needed to get this working on windows.
>
> diff --git a/ThirdParty/gl2ps/vtkgl2ps/gl2ps.c
> b/ThirdParty/gl2ps/vtkgl2ps/gl2ps.c
> index 6c98d81..d256bde 100644
> --- a/ThirdParty/gl2ps/vtkgl2ps/gl2ps.c
> +++ b/ThirdParty/gl2ps/vtkgl2ps/gl2ps.c
> @@ -55,6 +55,10 @@
>  #include <vtk_png.h>
>  #endif
>
> +#ifdef _MSC_VER
> +#define isfinite _finite
> +#endif
> +
>  /*********************************************************************
>   *
>   * Private definitions, data structures and prototypes
>
> On Thu, May 9, 2013 at 4:57 PM, David Lonie <david.lonie at kitware.com> wrote:
>> Hi list,
>>
>> We've run into an issue exporting plots that contain Nan values.
>> OpenGL seems to handle these gracefully on most implementations by
>> discarding the primitive and moving on. The attached patch does the
>> same for GL2PS.
>>
>> Can this be included in the next release?
>>
>> Thanks,
>>
>> Dave