Skip to content

Commit 829d91e

Browse files
committed
added IS_NAN crossplatform macro
1 parent 72405e9 commit 829d91e

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

include/qwt3d_types.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
#if defined(Q_OS_WIN)
1212
#include <windows.h>
13+
14+
#define IS_NAN(x) _isnan(x)
15+
#else
16+
#define IS_NAN(x) isnan(x)
1317
#endif
1418

1519
#include "qwt3d_portability.h"
@@ -240,7 +244,7 @@ struct QWT3D_EXPORT Triple
240244
//! \since 0.3.2
241245
bool isValid() const
242246
{
243-
return !_isnan(x) && !_isnan(y) && !_isnan(z);
247+
return !IS_NAN(x) && !IS_NAN(y) && !IS_NAN(z);
244248
}
245249

246250
//! \since 0.3.2

include/qwt3d_volumeplot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct Voxel
3131

3232
bool isValid() const
3333
{
34-
return !_isnan(x) && !_isnan(y) && !_isnan(z);
34+
return !IS_NAN(x) && !IS_NAN(y) && !IS_NAN(z);
3535
}
3636

3737
float x,y,z;

src/qwt3d_enrichment_std.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void Dot::drawEnd()
160160

161161
void Dot::draw(Qwt3D::Triple const& pos)
162162
{
163-
if (!_isnan(pos.z))
163+
if (!IS_NAN(pos.z))
164164
{
165165
RGBA rgba = plot_p->dataColor()->rgba(pos);
166166
glColor4d(rgba.r,rgba.g,rgba.b,rgba.a);

src/qwt3d_gridplot.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void GridPlot::CVertexProcessor::processVertex(bool& stripStarted, int i, int j,
161161
{
162162
const Triple& v = m_data->vertices[j][i];
163163

164-
if (_isnan(v.z))
164+
if (IS_NAN(v.z))
165165
{
166166
if (stripStarted){
167167
stripStarted = false;
@@ -202,7 +202,7 @@ void GridPlot::CVertexProcessor::processLineStripVertex(bool& stripStarted, int
202202
{
203203
const Triple& v = m_data->vertices[j][i];
204204

205-
if (_isnan(v.z))
205+
if (IS_NAN(v.z))
206206
{
207207
if (stripStarted){
208208
stripStarted = false;
@@ -355,7 +355,7 @@ void GridPlot::readIn(GridData& gdata, Triple** data, unsigned int columns, unsi
355355
if (val.y < range.minVertex.y)
356356
range.minVertex.y = val.y;
357357

358-
if (!_isnan(val.z))
358+
if (!IS_NAN(val.z))
359359
{
360360
if (val.z < range.minVertex.z)
361361
range.minVertex.z = val.z;
@@ -393,7 +393,7 @@ void GridPlot::readIn(GridData& gdata, double** data, unsigned int columns, unsi
393393
gdata_ij.y = miny + j*dy;
394394
gdata_ij.z = val;
395395

396-
if (!_isnan(val))
396+
if (!IS_NAN(val))
397397
{
398398
if (val > tmax)
399399
tmax = val;
@@ -454,7 +454,7 @@ void GridPlot::calcNormals(GridData& gdata)
454454
n.reset();
455455

456456
const Triple& vert_ij = gdata.vertices[i][j];
457-
if (_isnan(vert_ij.z))
457+
if (IS_NAN(vert_ij.z))
458458
{
459459
continue;
460460
}
@@ -464,7 +464,7 @@ void GridPlot::calcNormals(GridData& gdata)
464464
const Triple& vert_ip1_j = gdata.vertices[i+1][j];
465465
const Triple& vert_i_jp1 = gdata.vertices[i][j+1];
466466

467-
if (!_isnan(vert_i_jp1.z) && !_isnan(vert_i_jp1.z))
467+
if (!IS_NAN(vert_i_jp1.z) && !IS_NAN(vert_i_jp1.z))
468468
{
469469
u = vert_ip1_j - vert_ij;
470470
v = vert_i_jp1 - vert_ij;
@@ -478,7 +478,7 @@ void GridPlot::calcNormals(GridData& gdata)
478478
const Triple& vert_i_jp1 = gdata.vertices[i][j+1];
479479
const Triple& vert_im1_j = gdata.vertices[i-1][j];
480480

481-
if (!_isnan(vert_i_jp1.z) && !_isnan(vert_im1_j.z))
481+
if (!IS_NAN(vert_i_jp1.z) && !IS_NAN(vert_im1_j.z))
482482
{
483483
u = vert_i_jp1 - vert_ij;
484484
v = vert_im1_j - vert_ij;
@@ -492,7 +492,7 @@ void GridPlot::calcNormals(GridData& gdata)
492492
const Triple& vert_i_jm1 = gdata.vertices[i][j-1];
493493
const Triple& vert_im1_j = gdata.vertices[i-1][j];
494494

495-
if (!_isnan(vert_im1_j.z) && !_isnan(vert_i_jm1.z))
495+
if (!IS_NAN(vert_im1_j.z) && !IS_NAN(vert_i_jm1.z))
496496
{
497497
u = vert_im1_j - vert_ij;
498498
v = vert_i_jm1 - vert_ij;
@@ -506,7 +506,7 @@ void GridPlot::calcNormals(GridData& gdata)
506506
const Triple& vert_i_jm1 = gdata.vertices[i][j-1];
507507
const Triple& vert_ip1_j = gdata.vertices[i+1][j];
508508

509-
if (!_isnan(vert_i_jm1.z) && !_isnan(vert_ip1_j.z))
509+
if (!IS_NAN(vert_i_jm1.z) && !IS_NAN(vert_ip1_j.z))
510510
{
511511
u = vert_i_jm1 - vert_ij;
512512
v = vert_ip1_j - vert_ij;
@@ -973,7 +973,7 @@ void GridPlot::processVertex(const Triple& vert1, const Triple& norm1,
973973
{
974974
static Triple lastVertex;
975975

976-
if (_isnan(vert1.z))
976+
if (IS_NAN(vert1.z))
977977
{
978978
if (stripStarted){
979979
stripStarted = false;
@@ -1006,7 +1006,7 @@ void GridPlot::processVertex(const Triple& vert1, const Triple& norm1,
10061006

10071007
void GridPlot::processLineLoopVertex(const Triple& vert1, bool& stripStarted) const
10081008
{
1009-
if (_isnan(vert1.z))
1009+
if (IS_NAN(vert1.z))
10101010
{
10111011
if (stripStarted){
10121012
stripStarted = false;
@@ -1025,7 +1025,7 @@ void GridPlot::processLineLoopVertex(const Triple& vert1, bool& stripStarted) co
10251025

10261026
void GridPlot::processLineStripVertex(const Triple& vert1, bool& stripStarted) const
10271027
{
1028-
if (_isnan(vert1.z))
1028+
if (IS_NAN(vert1.z))
10291029
{
10301030
if (stripStarted){
10311031
stripStarted = false;

0 commit comments

Comments
 (0)