File: pcl_painter2D_demo.cpp

package info (click to toggle)
pcl 1.8.0%2Bdfsg1-4%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 141,092 kB
  • sloc: cpp: 515,897; xml: 28,792; ansic: 13,844; python: 539; lisp: 93; makefile: 85; sh: 27
file content (50 lines) | stat: -rw-r--r-- 1,085 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* \author Kripasindhu Sarkar */

#include <iostream>
#include <map>
#include <vector>
#include <pcl/visualization/pcl_painter2D.h>
//----------------------------------------------------------------------------

int main (int argc, char * argv [])
{
  pcl::visualization::PCLPainter2D *painter = new pcl::visualization::PCLPainter2D();
  
  int winw = 800, winh = 600;
  painter->setWindowSize (winw, winh);
  int xpos = 0;
  int r = winw;
  int R = 50;
  int inc = 5;
  int noc = winw/R;
  
  while (1)
  {
    //draw noc no of circles
    for (int i = 0; i < noc; i++)
    {
      if (i % 2) 
        painter->setBrushColor (0, 0, 0, 200);
      else
        painter->setBrushColor (255, 255, 255, 200);
      
      int rad = r - i*R;
      if (rad < 0) { rad = winw + rad;}
      
      painter->addCircle (winw/2, winh/2, rad);
    }
    
    r -= inc;
    if (r < winw-R) r = winw + R;

    painter->setBrushColor (255,0,0,100);
    painter->addRect ((xpos += inc) % winw, 100, 100, 100);

    //display
    painter->spinOnce ();
    painter->clearFigures ();
  }


  return 0;
}