homog2d library
Functions
showcase5.cpp File Reference

Generates moving ellipse and bounding boxes. More...

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

Functions

int main (int, const char **)
 

Detailed Description

Generates moving ellipse and bounding boxes.

Function Documentation

◆ main()

int main ( int  ,
const char **   
)
13 {
14  auto nbim = 30; // nb images
15  auto Hdraw = Homogr().setScale(20).addTranslation(10,20);
16 
17  auto kx=2.5;
18  auto ky=0.9;
19  auto x0 = 4.8;
20  auto y0 = 3.5;
21 
22  for( int i=0; i<nbim; i++ )
23  {
24  auto angle = i*360./nbim;
25  auto angle_r = angle * M_PI / 180.;
26 
27 
28  auto x1 = x0+std::cos(angle_r)*kx;
29  auto y1 = y0+std::sin(angle_r)*ky;
30  auto ell = Ellipse( x1, y1, 2.5, 1., angle_r ) ;
31 
32 // std::cout << i << ": angle=" << angle << " ell=" << ell << "\n";
33 
34  auto ell2 = Hdraw * ell;
35 
36  img::Image<img::SvgImage> im( 250, 200 );
37  ell2.getCenter().draw( im, img::DrawParams().setColor(0,250,0) );
38  auto lines = ell2.getAxisLines();
39  lines.first.draw( im );
40  lines.second.draw( im );
41 
42  getBB(ell2).draw( im, img::DrawParams().setColor(0,250,0) );
43  getOBB(ell2).draw( im, img::DrawParams().setColor(0,0,250) );
44  ell2.draw( im, img::DrawParams().setColor(250,0,0) );
45  std::ostringstream ossa;
46  ossa << "showcase5_" << std::setfill('0') << std::setw(2) <<i << ".svg";
47  im.write( ossa.str() );
48  }
49 }
Homogr_< HOMOG2D_INUMTYPE > Homogr
Default homography (3x3 matrix) type, uses double as numerical type.
Definition: homog2d.hpp:12382
CPolyline_< FPT > getOBB(const Ellipse_< FPT > &ell)
Returns Bounding Box of Ellipse_ (free function)
Definition: homog2d.hpp:9965
Ellipse_< HOMOG2D_INUMTYPE > Ellipse
Default ellipse type.
Definition: homog2d.hpp:12402
#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
Ellipse ell
Definition: homog2d_test.cpp:4037
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
FRect_< HOMOG2D_INUMTYPE > getBB(const T &t)
Return Bounding Box of primitive or container holding primitives (free function)
Definition: homog2d.hpp:10312
Here is the call graph for this function: