homog2d library
Functions
showcase11.cpp File Reference

Generates a moving segment, its supporting line, and its two parallel segments. More...

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

Functions

int main (int, const char **)
 

Detailed Description

Generates a moving segment, its supporting line, and its two parallel segments.

Function Documentation

◆ main()

int main ( int  ,
const char **   
)
11 {
12  auto nbim = 30; // nb images
13 
14  auto kx1 = 78;
15  auto ky1 = 30;
16  auto kx2 = 43;
17  auto ky2 = 49;
18 
19  auto org_x1 = 100;
20  auto org_y1 = 50;
21  auto org_x2 = 120;
22  auto org_y2 = 200;
23  for( int i=0; i<nbim; i++ )
24  {
25  auto angle = i*360./nbim;
26  auto angle_r1 = angle * M_PI / 180.;
27  auto angle_r2 = 1.5*angle * M_PI / 180.;
28 
29  auto x1 = org_x1+std::cos(angle_r1)*kx1;
30  auto y1 = org_y1+std::sin(angle_r1)*ky1;
31 
32  auto x2 = org_x2+std::cos(angle_r2)*kx2;
33  auto y2 = org_y2+std::sin(angle_r2)*ky2;
34  Segment s( x1, y1, x2, y2 );
35  auto bis = s.getBisector();
36 
37  img::Image<img::SvgImage> im( 280, 250 );
38  s.getLine().draw( im, img::DrawParams().setColor(200,200,200) );
39  s.draw( im, img::DrawParams().setColor(250,25,0) );
40  auto psegs = s.getParallelSegs( 35 );
41  draw( im, psegs.first, img::DrawParams().setColor(150,50,0) );
42  draw( im, psegs.second, img::DrawParams().setColor(50,150,0) );
43  bis.draw( im, img::DrawParams().setColor(0,50,250) );
44  std::ostringstream ossa;
45  ossa << "showcase11_" << std::setfill('0') << std::setw(2) <<i << ".svg";
46  im.write( ossa.str() );
47  }
48 }
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
HOMOG2D_INUMTYPE angle(const Ellipse_< FPT > &ell)
Return angle of ellipse (free function)
Definition: homog2d.hpp:10993
img::Image< img::SvgImage > im(300, 400)
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: