homog2d library
Functions
showcase18.cpp File Reference

Generates a parallelogram from 2 fixed point and a rotating one. More...

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

Functions

int main (int, const char **)
 

Detailed Description

Generates a parallelogram from 2 fixed point and a rotating one.

Function Documentation

◆ main()

int main ( int  ,
const char **   
)
12 {
13  auto nbim = 25; // nb images
14  auto Hdraw = Homogr().setScale(30).addTranslation(10,10);
15 
16  auto x0 = 3.;
17  auto y0 = 2.;
18  auto k=1.8;
19 
20  Point2d p1( 1, 4 );
21  Point2d p2( 3, 5 );
22 
23  for( int i=0; i<nbim; i++ )
24  {
25  auto angle = i*360./nbim;
26  auto angle_r = angle * M_PI / 180.;
27  auto x1 = std::cos(angle_r)*k;
28  auto y1 = std::sin(angle_r)*k;
29 
30  Point2d p0( x1+x0, y1+y0);
31  CPolyline pol1, pol2, pol3;
32  pol1.setParallelogram( p1, p2, p0 );
33  pol2.setParallelogram( p1, p0, p2 );
34  pol3.setParallelogram( p2, p1, p0 );
35 
36  Image<img::SvgImage> im1( 250, 200 );
37  (Hdraw * pol1).draw( im1, DrawParams().setPointStyle( PtStyle::Diam ).setColor( 250,25,20 ) );
38  (Hdraw * pol2).draw( im1, DrawParams().setPointStyle( PtStyle::Diam ).setColor( 25,250,20 ) );
39  (Hdraw * pol3).draw( im1, DrawParams().setPointStyle( PtStyle::Diam ).setColor( 25,25,250 ) );
40 
41  auto drawparams = DrawParams().setPointStyle( PtStyle::Diam ).setColor( 20,0,250 );
42  (Hdraw * p0).draw(im1, drawparams );
43  (Hdraw * p1).draw(im1, drawparams );
44  (Hdraw * p2).draw(im1, drawparams );
45 
46  std::ostringstream ossa;
47  ossa << "showcase18_" << std::setfill('0') << std::setw(2) << i << ".svg";
48  im1.write( ossa.str() );
49  }
50 }
Homogr_< HOMOG2D_INUMTYPE > Homogr
Default homography (3x3 matrix) type, uses double as numerical type.
Definition: homog2d.hpp:12382
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
void setParallelogram(const Point2d_< FPT1 > &pt1, const Point2d_< FPT2 > &pt2, const Point2d_< FPT3 > &pt3)
Build a parallelogram (4 points) from 3 points.
Definition: homog2d.hpp:6765
HOMOG2D_INUMTYPE angle(const Ellipse_< FPT > &ell)
Return angle of ellipse (free function)
Definition: homog2d.hpp:10993
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
DrawParams & setColor(uint8_t r, uint8_t g, uint8_t b)
Definition: homog2d.hpp:605
Polyline, will be instanciated either as OPolyline_ (open polyline) or CPolyline_.
Definition: homog2d.hpp:364
Base class, will be instanciated as Point2d_ or Line2d_.
Definition: homog2d.hpp:365
Here is the call graph for this function: