~ubuntu-branches/ubuntu/saucy/pyqwt3d/saucy-proposed

« back to all changes in this revision

Viewing changes to qwtplot3d-0.2.7/src/qwt3d_gridplot.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gudjon I. Gudjonsson
  • Date: 2009-11-07 12:54:42 UTC
  • mfrom: (3.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20091107125442-92kgp0l7lessmiwo
Tags: 0.1.7~cvs20090625-2
* Change sip4 dependencies to >=4.9
* Add binary dependency on python-sip4 >=4.9
* Bump standards version to 3.8.3, no changes needed
* Add README.source file

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#if defined(_MSC_VER) /* MSVC Compiler */
2
 
#pragma warning ( disable : 4305 )
3
 
#pragma warning ( disable : 4786 )
4
 
#endif
5
 
 
6
 
#include "qwt3d_surfaceplot.h"
7
 
#include "qwt3d_enrichment_std.h"
8
 
 
9
 
using namespace std;
10
 
using namespace Qwt3D;
11
 
 
12
 
 
13
 
 
14
 
void SurfacePlot::createDataG()
15
 
{
16
 
  createFloorData();
17
 
  
18
 
  if (plotStyle() == NOPLOT)
19
 
    return;
20
 
 
21
 
  int i, j;
22
 
  RGBA col;
23
 
  int step = resolution();
24
 
 
25
 
  if (plotStyle() == Qwt3D::POINTS)
26
 
  {
27
 
    createPoints();
28
 
    return;
29
 
  }
30
 
  else if (plotStyle() == Qwt3D::USER)
31
 
  {
32
 
    if (userplotstyle_p)
33
 
      createEnrichment(*userplotstyle_p);
34
 
    return;
35
 
  }
36
 
 
37
 
  setDeviceLineWidth(meshLineWidth());
38
 
  
39
 
  GLStateBewarer sb(GL_POLYGON_OFFSET_FILL,true);
40
 
  setDevicePolygonOffset(polygonOffset(),1.0);
41
 
 
42
 
  GLStateBewarer sb2(GL_LINE_SMOOTH, smoothDataMesh());
43
 
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
44
 
 
45
 
 
46
 
  int lastcol =  actualDataG_->columns();
47
 
  int lastrow =  actualDataG_->rows(); 
48
 
 
49
 
  if (plotStyle() != WIREFRAME)
50
 
  {
51
 
    glPolygonMode(GL_FRONT_AND_BACK, GL_QUADS);
52
 
    
53
 
    bool hl = (plotStyle() == HIDDENLINE);
54
 
    if (hl)
55
 
    {
56
 
      col = backgroundRGBAColor();
57
 
      glColor4d(col.r, col.g, col.b, col.a);
58
 
    }
59
 
 
60
 
    for (i = 0; i < lastcol - step; i += step) 
61
 
    {
62
 
      glBegin(GL_TRIANGLE_STRIP);
63
 
        setColorFromVertexG(i, 0, hl);
64
 
        glNormal3dv(actualDataG_->normals[i][0]);
65
 
        glVertex3dv(actualDataG_->vertices[i][0]);
66
 
          
67
 
        setColorFromVertexG(i+step, 0, hl);
68
 
        glNormal3dv(actualDataG_->normals[i+step][0]);
69
 
        glVertex3dv(actualDataG_->vertices[i+step][0]);
70
 
 
71
 
        for (j = 0; j < lastrow - step; j += step) 
72
 
        {       
73
 
          setColorFromVertexG(i,j+step, hl);
74
 
          glNormal3dv(actualDataG_->normals[i][j+step]);
75
 
          glVertex3dv(actualDataG_->vertices[i][j+step]);
76
 
 
77
 
          setColorFromVertexG(i+step, j+step, hl);
78
 
          glNormal3dv(actualDataG_->normals[i+step][j+step]);
79
 
          glVertex3dv(actualDataG_->vertices[i+step][j+step]);
80
 
        }
81
 
      glEnd();
82
 
    }
83
 
  }
84
 
 
85
 
  if (plotStyle() == FILLEDMESH || plotStyle() == WIREFRAME || plotStyle() == HIDDENLINE)
86
 
  {
87
 
    glColor4d(meshColor().r, meshColor().g, meshColor().b, meshColor().a);    
88
 
 
89
 
    if (step < actualDataG_->columns() && step < actualDataG_->rows())
90
 
    {
91
 
      glBegin(GL_LINE_LOOP);
92
 
        for (i = 0; i < actualDataG_->columns() - step; i += step) 
93
 
          glVertex3dv(actualDataG_->vertices[i][0]);    
94
 
        for (j = 0; j < actualDataG_->rows() - step; j += step) 
95
 
          glVertex3dv(actualDataG_->vertices[i][j]);            
96
 
        for (; i >= 0; i -= step) 
97
 
          glVertex3dv(actualDataG_->vertices[i][j]);      
98
 
        for (; j >= 0; j -= step) 
99
 
          glVertex3dv(actualDataG_->vertices[0][j]);      
100
 
      glEnd();
101
 
    }
102
 
 
103
 
    // weaving
104
 
    for (i = step; i < actualDataG_->columns() - step; i += step) 
105
 
    {   
106
 
      glBegin(GL_LINE_STRIP);
107
 
        for (j = 0; j < actualDataG_->rows(); j += step) 
108
 
          glVertex3dv(actualDataG_->vertices[i][j]);      
109
 
      glEnd();
110
 
    }
111
 
    for (j = step; j < actualDataG_->rows() - step; j += step) 
112
 
    {   
113
 
      glBegin(GL_LINE_STRIP);
114
 
        for (i = 0; i < actualDataG_->columns(); i += step) 
115
 
          glVertex3dv(actualDataG_->vertices[i][j]);      
116
 
      glEnd();
117
 
    }
118
 
  }
119
 
}
120
 
 
121
 
void SurfacePlot::setColorFromVertexG(int ix, int iy, bool skip)
122
 
{
123
 
  if (skip)
124
 
    return;
125
 
 
126
 
  RGBA col = (*datacolor_p)(
127
 
    actualDataG_->vertices[ix][iy][0],
128
 
    actualDataG_->vertices[ix][iy][1],
129
 
    actualDataG_->vertices[ix][iy][2]);
130
 
    
131
 
  glColor4d(col.r, col.g, col.b, col.a);
132
 
}
133
 
 
134
 
 
135
 
void SurfacePlot::createNormalsG()
136
 
{
137
 
  if (!normals() || actualDataG_->empty())
138
 
    return;
139
 
 
140
 
  Arrow arrow;
141
 
  arrow.setQuality(normalQuality());
142
 
 
143
 
  Triple basev, topv, norm; 
144
 
  
145
 
  int step = resolution();
146
 
 
147
 
  double diag = (actualDataG_->hull().maxVertex-actualDataG_->hull().minVertex).length() * normalLength();
148
 
 
149
 
  arrow.assign(*this);
150
 
  arrow.drawBegin();
151
 
  for (int i = 0; i <= actualDataG_->columns() - step; i += step) 
152
 
  {
153
 
    for (int j = 0; j <= actualDataG_->rows() - step; j += step) 
154
 
    {
155
 
      basev = Triple(actualDataG_->vertices[i][j][0],actualDataG_->vertices[i][j][1],actualDataG_->vertices[i][j][2]);
156
 
      topv = Triple(actualDataG_->vertices[i][j][0]+actualDataG_->normals[i][j][0],
157
 
               actualDataG_->vertices[i][j][1]+actualDataG_->normals[i][j][1],
158
 
               actualDataG_->vertices[i][j][2]+actualDataG_->normals[i][j][2]); 
159
 
      
160
 
      norm = topv-basev;
161
 
      norm.normalize();
162
 
      norm  *= diag;
163
 
 
164
 
      arrow.setTop(basev+norm);
165
 
      arrow.setColor((*datacolor_p)(basev.x,basev.y,basev.z));
166
 
      arrow.draw(basev);
167
 
    }
168
 
  }
169
 
  arrow.drawEnd();
170
 
}
171
 
 
172
 
void SurfacePlot::readIn(GridData& gdata, Triple** data, unsigned int columns, unsigned int rows)
173
 
{
174
 
  gdata.setSize(columns,rows);
175
 
  
176
 
  ParallelEpiped range(Triple(DBL_MAX,DBL_MAX,DBL_MAX),Triple(-DBL_MAX,-DBL_MAX,-DBL_MAX));
177
 
 
178
 
  /* fill out the vertex array for the mesh. */
179
 
  for (unsigned i = 0; i != columns; ++i) 
180
 
  {
181
 
    for (unsigned j = 0; j != rows; ++j) 
182
 
    {
183
 
      gdata.vertices[i][j][0] = data[i][j].x; 
184
 
      gdata.vertices[i][j][1] = data[i][j].y;
185
 
      gdata.vertices[i][j][2] = data[i][j].z;
186
 
 
187
 
      if (data[i][j].x > range.maxVertex.x)
188
 
        range.maxVertex.x = data[i][j].x;
189
 
      if (data[i][j].y > range.maxVertex.y)
190
 
        range.maxVertex.y = data[i][j].y;
191
 
      if (data[i][j].z > range.maxVertex.z)
192
 
        range.maxVertex.z = data[i][j].z;
193
 
      if (data[i][j].x < range.minVertex.x)
194
 
        range.minVertex.x = data[i][j].x;
195
 
      if (data[i][j].y < range.minVertex.y)
196
 
        range.minVertex.y = data[i][j].y;
197
 
      if (data[i][j].z < range.minVertex.z)
198
 
        range.minVertex.z = data[i][j].z;
199
 
    }
200
 
  }
201
 
  gdata.setHull(range);
202
 
}
203
 
 
204
 
 
205
 
void SurfacePlot::readIn(GridData& gdata, double** data, unsigned int columns, unsigned int rows
206
 
            , double minx, double maxx, double miny, double maxy)
207
 
{
208
 
  gdata.setPeriodic(false,false);
209
 
  gdata.setSize(columns,rows);
210
 
  
211
 
  double dx = (maxx - minx) / (gdata.columns() - 1);
212
 
  double dy = (maxy - miny) / (gdata.rows() - 1);
213
 
 
214
 
  double tmin = DBL_MAX;
215
 
  double tmax = -DBL_MAX;
216
 
 
217
 
  /* fill out the vertex array for the mesh. */
218
 
  for (unsigned i = 0; i != columns; ++i) 
219
 
  {
220
 
    for (unsigned j = 0; j != rows; ++j) 
221
 
    {
222
 
      gdata.vertices[i][j][0] = minx + i*dx;
223
 
      gdata.vertices[i][j][1] = miny + j*dy;
224
 
      gdata.vertices[i][j][2] = data[i][j];
225
 
 
226
 
      if (data[i][j] > tmax)
227
 
        tmax = data[i][j];
228
 
      if (data[i][j] < tmin)
229
 
        tmin = data[i][j];
230
 
    }
231
 
  }
232
 
  ParallelEpiped hull = 
233
 
  ParallelEpiped(
234
 
                    Triple( 
235
 
                            gdata.vertices[0][0][0], 
236
 
                            gdata.vertices[0][0][1], 
237
 
                            tmin
238
 
                          ), 
239
 
                    Triple(
240
 
                            gdata.vertices[gdata.columns()-1][gdata.rows()-1][0], 
241
 
                            gdata.vertices[gdata.columns()-1][gdata.rows()-1][1], 
242
 
                            tmax
243
 
                          )
244
 
                  );
245
 
 
246
 
  gdata.setHull(hull);
247
 
}
248
 
 
249
 
 
250
 
void SurfacePlot::calcNormals(GridData& gdata)
251
 
{
252
 
  
253
 
  unsigned int rows = gdata.rows();
254
 
  unsigned int columns = gdata.columns();
255
 
  
256
 
  // normals
257
 
    
258
 
  Triple u, v, n;  // for cross product
259
 
 
260
 
  for (unsigned i = 0; i != columns; ++i) 
261
 
  {
262
 
    for (unsigned j = 0; j != rows; ++j) 
263
 
    {
264
 
      n = Triple(0,0,0);
265
 
      
266
 
      
267
 
      if (i<columns-1 && j<rows-1) 
268
 
      {
269
 
        /*  get two vectors to cross */      
270
 
        u = Triple(
271
 
                    gdata.vertices[i+1][j][0] - gdata.vertices[i][j][0],
272
 
                    gdata.vertices[i+1][j][1] - gdata.vertices[i][j][1],
273
 
                    gdata.vertices[i+1][j][2] - gdata.vertices[i][j][2]
274
 
                  );
275
 
 
276
 
        v = Triple(
277
 
                    gdata.vertices[i][j+1][0] - gdata.vertices[i][j][0],
278
 
                    gdata.vertices[i][j+1][1] - gdata.vertices[i][j][1],
279
 
                    gdata.vertices[i][j+1][2] - gdata.vertices[i][j][2]
280
 
                  );
281
 
        /* get the normalized cross product */ 
282
 
        n += normalizedcross(u,v); // right hand system here !
283
 
      }
284
 
 
285
 
      if (i>0 && j<rows-1) 
286
 
      {
287
 
        u = Triple(
288
 
                    gdata.vertices[i][j+1][0] - gdata.vertices[i][j][0],
289
 
                    gdata.vertices[i][j+1][1] - gdata.vertices[i][j][1],
290
 
                    gdata.vertices[i][j+1][2] - gdata.vertices[i][j][2]
291
 
                  );
292
 
        v = Triple(
293
 
                    gdata.vertices[i-1][j][0] - gdata.vertices[i][j][0],
294
 
                    gdata.vertices[i-1][j][1] - gdata.vertices[i][j][1],
295
 
                    gdata.vertices[i-1][j][2] - gdata.vertices[i][j][2]
296
 
                  );
297
 
        n += normalizedcross(u,v); 
298
 
      }
299
 
 
300
 
      if (i>0 && j>0) 
301
 
      {
302
 
        u = Triple(
303
 
                    gdata.vertices[i-1][j][0] - gdata.vertices[i][j][0],
304
 
                    gdata.vertices[i-1][j][1] - gdata.vertices[i][j][1],
305
 
                    gdata.vertices[i-1][j][2] - gdata.vertices[i][j][2]
306
 
                  );
307
 
 
308
 
        v = Triple(
309
 
                    gdata.vertices[i][j-1][0] - gdata.vertices[i][j][0],
310
 
                    gdata.vertices[i][j-1][1] - gdata.vertices[i][j][1],
311
 
                    gdata.vertices[i][j-1][2] - gdata.vertices[i][j][2]
312
 
                  );
313
 
        n += normalizedcross(u,v); 
314
 
      }
315
 
 
316
 
      if (i<columns-1 && j>0) 
317
 
      {
318
 
        u = Triple(
319
 
                    gdata.vertices[i][j-1][0] - gdata.vertices[i][j][0],
320
 
                    gdata.vertices[i][j-1][1] - gdata.vertices[i][j][1],
321
 
                    gdata.vertices[i][j-1][2] - gdata.vertices[i][j][2]
322
 
                  );
323
 
 
324
 
        v = Triple(
325
 
                    gdata.vertices[i+1][j][0] - gdata.vertices[i][j][0],
326
 
                    gdata.vertices[i+1][j][1] - gdata.vertices[i][j][1],
327
 
                    gdata.vertices[i+1][j][2] - gdata.vertices[i][j][2]
328
 
                  );
329
 
        n += normalizedcross(u,v);
330
 
      }
331
 
      n.normalize();
332
 
 
333
 
      gdata.normals[i][j][0] = n.x;
334
 
      gdata.normals[i][j][1] = n.y;
335
 
      gdata.normals[i][j][2] = n.z;
336
 
    }    
337
 
  } 
338
 
}
339
 
 
340
 
 
341
 
void SurfacePlot::sewPeriodic(GridData& gdata)
342
 
{
343
 
  // sewing 
344
 
   
345
 
  Triple n;
346
 
  
347
 
  unsigned int columns = gdata.columns();
348
 
  unsigned int rows = gdata.rows();
349
 
  
350
 
  if (gdata.uperiodic())
351
 
  {
352
 
    for (unsigned i = 0; i != columns; ++i) 
353
 
    {
354
 
      n = Triple(
355
 
                  gdata.normals[i][0][0] + gdata.normals[i][rows-1][0],
356
 
                  gdata.normals[i][0][1] + gdata.normals[i][rows-1][1],
357
 
                  gdata.normals[i][0][2] + gdata.normals[i][rows-1][2]
358
 
                );
359
 
 
360
 
      n.normalize();        
361
 
      gdata.normals[i][0][0] = gdata.normals[i][rows-1][0] = n.x;
362
 
      gdata.normals[i][0][1] = gdata.normals[i][rows-1][1] = n.y;
363
 
      gdata.normals[i][0][2] = gdata.normals[i][rows-1][2] = n.z;
364
 
    }
365
 
  }
366
 
  if (gdata.vperiodic())
367
 
  {
368
 
    for (unsigned j = 0; j != rows; ++j) 
369
 
    {
370
 
      n = Triple(
371
 
                  gdata.normals[0][j][0] + gdata.normals[columns-1][j][0],
372
 
                  gdata.normals[0][j][1] + gdata.normals[columns-1][j][1],
373
 
                  gdata.normals[0][j][2] + gdata.normals[columns-1][j][2]
374
 
                );
375
 
 
376
 
      n.normalize();        
377
 
      gdata.normals[0][j][0] = gdata.normals[columns-1][j][0] = n.x;
378
 
      gdata.normals[0][j][1] = gdata.normals[columns-1][j][1] = n.y;
379
 
      gdata.normals[0][j][2] = gdata.normals[columns-1][j][2] = n.z;
380
 
    }
381
 
  }
382
 
}
383
 
 
384
 
/*!
385
 
  Convert user grid data to internal vertex structure.
386
 
  See also NativeReader::read() and Function::create()
387
 
*/
388
 
bool SurfacePlot::loadFromData(Triple** data, unsigned int columns, unsigned int rows, bool uperiodic, bool vperiodic)
389
 
{
390
 
  actualDataC_->clear();
391
 
  actualData_p = actualDataG_;
392
 
 
393
 
  readIn(*actualDataG_, data, columns, rows);
394
 
  calcNormals(*actualDataG_);
395
 
  actualDataG_->setPeriodic(uperiodic,vperiodic);
396
 
  sewPeriodic(*actualDataG_);
397
 
 
398
 
  updateData();
399
 
  updateNormals();
400
 
  createCoordinateSystem();
401
 
 
402
 
  return true;
403
 
404
 
 
405
 
/*! 
406
 
  Convert user grid data to internal vertex structure.
407
 
  See also NativeReader::read() and Function::create()
408
 
*/
409
 
bool SurfacePlot::loadFromData(double** data, unsigned int columns, unsigned int rows
410
 
                                        , double minx, double maxx, double miny, double maxy)
411
 
412
 
  actualDataC_->clear();
413
 
  actualData_p = actualDataG_;
414
 
  
415
 
  actualDataG_->setPeriodic(false,false);
416
 
  actualDataG_->setSize(columns,rows);
417
 
  readIn(*actualDataG_,data,columns,rows,minx,maxx,miny,maxy);
418
 
  calcNormals(*actualDataG_);  
419
 
  
420
 
  updateData();
421
 
  updateNormals();
422
 
  createCoordinateSystem();
423
 
 
424
 
  return true;
425
 
426
 
 
427
 
 
428
 
void SurfacePlot::createFloorDataG()
429
 
{
430
 
  switch (floorStyle())
431
 
  {
432
 
  case FLOORDATA:
433
 
    Data2FloorG();
434
 
    break;
435
 
  case FLOORISO:
436
 
    Isolines2FloorG();
437
 
    break;
438
 
  default:
439
 
    break;
440
 
  }
441
 
}
442
 
 
443
 
void SurfacePlot::Data2FloorG()
444
 
{
445
 
  if (actualData_p->empty())
446
 
    return;
447
 
  
448
 
  int step = resolution();
449
 
 
450
 
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
451
 
  glPolygonMode(GL_FRONT_AND_BACK, GL_QUADS);
452
 
  
453
 
  double zshift = actualData_p->hull().minVertex.z;
454
 
  for (int i = 0; i < actualDataG_->columns() - step; i += step) 
455
 
  {
456
 
    glBegin(GL_TRIANGLE_STRIP);
457
 
      setColorFromVertexG(i, 0);
458
 
      glVertex3d(actualDataG_->vertices[i][0][0], actualDataG_->vertices[i][0][1], zshift);
459
 
      
460
 
      setColorFromVertexG(i+step, 0);
461
 
      glVertex3d(actualDataG_->vertices[i+step][0][0],actualDataG_->vertices[i+step][0][1], zshift);
462
 
      for (int j = 0; j < actualDataG_->rows() - step; j += step) 
463
 
      {
464
 
        setColorFromVertexG(i, j+step);
465
 
        glVertex3d(actualDataG_->vertices[i][j+step][0],actualDataG_->vertices[i][j+step][1], zshift);
466
 
        
467
 
        setColorFromVertexG(i+step, j+step);
468
 
        glVertex3d(actualDataG_->vertices[i+step][j+step][0],actualDataG_->vertices[i+step][j+step][1], zshift);        
469
 
      }
470
 
    glEnd();
471
 
  }
472
 
}
473
 
 
474
 
void SurfacePlot::Isolines2FloorG()
475
 
{
476
 
  if (isolines() <= 0 || actualData_p->empty())
477
 
    return;
478
 
 
479
 
  double count = (actualData_p->hull().maxVertex.z - actualData_p->hull().minVertex.z) / isolines();    
480
 
 
481
 
  RGBA col;
482
 
 
483
 
  int step = resolution();
484
 
 
485
 
  double zshift = actualData_p->hull().minVertex.z;
486
 
  
487
 
  int cols = actualDataG_->columns();
488
 
  int rows = actualDataG_->rows();
489
 
  
490
 
  Triple t[4];
491
 
  vector<Triple> intersection;
492
 
  
493
 
  double lambda = 0;
494
 
  
495
 
  GLStateBewarer sb2(GL_LINE_SMOOTH, false);
496
 
 
497
 
  for (int k = 0; k != isolines(); ++k) 
498
 
  {
499
 
    double val = zshift + k * count;    
500
 
        
501
 
    for (int i = 0; i < cols-step; i += step) 
502
 
    {
503
 
      for (int j = 0; j < rows-step; j += step) 
504
 
      {
505
 
        t[0] =  Triple( actualDataG_->vertices[i][j][0],
506
 
                        actualDataG_->vertices[i][j][1],
507
 
                        actualDataG_->vertices[i][j][2]);
508
 
 
509
 
        col = (*datacolor_p)(t[0].x,t[0].y,t[0].z);
510
 
        glColor4d(col.r, col.g, col.b, col.a);
511
 
//        glColor4d(0,0,0,1);
512
 
        
513
 
        t[1] =  Triple( actualDataG_->vertices[i+step][j][0],
514
 
                        actualDataG_->vertices[i+step][j][1],
515
 
                        actualDataG_->vertices[i+step][j][2]);
516
 
        t[2] =  Triple( actualDataG_->vertices[i+step][j+step][0],
517
 
                        actualDataG_->vertices[i+step][j+step][1],
518
 
                        actualDataG_->vertices[i+step][j+step][2]);
519
 
        t[3] =  Triple( actualDataG_->vertices[i][j+step][0],
520
 
                        actualDataG_->vertices[i][j+step][1],
521
 
                        actualDataG_->vertices[i][j+step][2]);
522
 
 
523
 
        double diff = 0;
524
 
        for (int m = 0; m!=4; ++m)
525
 
        {
526
 
          int mm = (m+1)%4;
527
 
          if ((val>=t[m].z && val<=t[mm].z) || (val>=t[mm].z && val<=t[m].z))
528
 
          {
529
 
            diff = t[mm].z - t[m].z;
530
 
            
531
 
            if (isPracticallyZero(diff)) // degenerated
532
 
            {
533
 
              intersection.push_back(t[m]);
534
 
              intersection.push_back(t[mm]);
535
 
              continue;
536
 
            }
537
 
            
538
 
            lambda =  (val - t[m].z) / diff;
539
 
            intersection.push_back(Triple(t[m].x + lambda * (t[mm].x-t[m].x), t[m].y + lambda * (t[mm].y-t[m].y), val));
540
 
          }
541
 
        }
542
 
        
543
 
        if (!intersection.empty())
544
 
        {
545
 
          if (intersection.size()>2)
546
 
          {
547
 
            glBegin(GL_LINE_STRIP);
548
 
            for (unsigned dd = 0; dd!=intersection.size(); ++dd)
549
 
            {
550
 
              glVertex3d(intersection[dd].x, intersection[dd].y, zshift);
551
 
            }
552
 
            glEnd();
553
 
            glBegin(GL_POINTS);
554
 
              glVertex3d(intersection[0].x,intersection[0].y,zshift);
555
 
            glEnd();
556
 
          }
557
 
          else if (intersection.size() == 2)
558
 
          {
559
 
            glBegin(GL_LINES);
560
 
              glVertex3d(intersection[0].x,intersection[0].y,zshift);
561
 
              glVertex3d(intersection[1].x,intersection[1].y,zshift);
562
 
              
563
 
              // small pixel gap problem (see OpenGL spec.)
564
 
              glVertex3d(intersection[1].x,intersection[1].y,zshift);
565
 
              glVertex3d(intersection[0].x,intersection[0].y,zshift);
566
 
            glEnd();
567
 
          }
568
 
          
569
 
          intersection.clear();
570
 
        }
571
 
      }
572
 
    }
573
 
  }
574
 
}
575
 
 
576
 
 
577
 
 
578
 
/*
579
 
void SurfacePlot::calcLowResolution()
580
 
{
581
 
  if (!actualDataG_)
582
 
    return;
583
 
 
584
 
  int res = resolution();
585
 
  if (res == 1)
586
 
  {
587
 
    lowresData_p = *actualDataG_;
588
 
    return;
589
 
  }
590
 
  
591
 
  GridData const& src = *actualDataG_;
592
 
  result.clear();
593
 
  
594
 
  
595
 
}*/
596