homog2d library
Functions
showcase17.cpp File Reference

Generates a moving segment and its orthogonal segments and points. More...

#include "../../homog2d.hpp"
Include dependency graph for showcase17.cpp:

Functions

int main (int, const char **)
 

Detailed Description

Generates a moving segment and its orthogonal segments and points.

Function Documentation

◆ main()

int main ( int  ,
const char **   
)
11 {
12  auto nbim = 30; // nb images
13  auto k = 60;
14  auto x1 = 120.;
15  auto y1 = 120.;
16  auto org_x2 = 130;
17  auto org_y2 = 130;
18 
19  std::array<img::Color,4> vcol;
20  vcol[0]=img::Color(0,250,125);
21  vcol[1]=img::Color(0,125,250);
22  vcol[2]=img::Color(125,0,250);
23  vcol[3]=img::Color(250,0,125);
24 
25  auto fl = [&](int i) // lambda
26  {
27  return img::DrawParams().setPointStyle(img::PtStyle::Dot).setColor( vcol[i] );
28  };
29  std::function<img::DrawParams(int)> style(fl);
30 
31  for( int i=0; i<nbim; i++ )
32  {
33  auto angle = i*360./nbim;
34  auto angle_r2 = 1.0*angle * M_PI / 180.;
35 
36  auto x2 = org_x2+std::cos(angle_r2)*k;
37  auto y2 = org_y2+std::sin(angle_r2)*k;
38  Segment s( x1, y1, x2, y2 );
39 
40  img::Image<img::SvgImage> im( 280, 250 );
41  s.draw( im, img::DrawParams().setColor(250,25,0).setThickness(2) );
42  auto osegs = s.getOrthogSegs();
43  auto opts = s.getOrthogPts();
44  if( i<nbim/2 )
45  draw( im, osegs, style );
46  else
47  draw( im, opts, style );
48 
49  std::ostringstream ossa;
50  ossa << "showcase17_" << std::setfill('0') << std::setw(2) <<i << ".svg";
51  im.write( ossa.str() );
52  }
53 }
void draw(Data &data)
Definition: precision_test_opencv.cpp:184
#define M_PI
Definition: homog2d.hpp:235
Draw parameters, independent of back-end library.
Definition: homog2d.hpp:514
Color type , see DrawParams.
Definition: homog2d.hpp:432
HOMOG2D_INUMTYPE angle(const Ellipse_< FPT > &ell)
Return angle of ellipse (free function)
Definition: homog2d.hpp:10993
img::Image< img::SvgImage > im(300, 400)
DrawParams & setPointStyle(PtStyle ps)
Definition: homog2d.hpp:585
Opaque data structure, will hold the image type, depending on back-end library. This type is the one ...
Definition: homog2d.hpp:712
A line segment, oriented (OSegment_) or not (Segment_). Holds the two points.
Definition: homog2d.hpp:366
DrawParams & setColor(uint8_t r, uint8_t g, uint8_t b)
Definition: homog2d.hpp:605
Here is the call graph for this function: