homog2d library
Functions
showcase16b.cpp File Reference

random point and a moving vector, show side of point (WIP !!!) More...

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

Functions

int main (int, const char **)
 

Detailed Description

random point and a moving vector, show side of point (WIP !!!)

Function Documentation

◆ main()

int main ( int  ,
const char **   
)
13 {
14  auto nbim = 25; // nb images
15  auto imsize = 300;
16 
17  auto kx1 = 20.;
18  auto ky1 = 55;
19  auto kx2 = 16;
20  auto ky2 = 12.1;
21  auto rot2 = 2.2;
22  auto x0 = imsize/2 - 20;
23  auto y0 = imsize/2 - 50;
24 
25  Point2d pt0( imsize/2, 80 );
26 
27  for( int i=0; i<nbim; i++ )
28  {
29  img::Image<img::SvgImage> im( imsize*2,imsize-100 );
30 
31  auto angle = i * 360. /nbim;
32 // std::cout << "angle=" << angle << '\n';
33 // auto angle = i*360./nbim;
34 
35  auto angle1 = M_PI * angle / 180;
36  auto x1 = std::cos(angle1)*kx1;
37  auto y1 = std::sin(angle1)*ky1;
38 
39  auto angle2 = M_PI * angle * rot2 / 180;
40  auto x2 = std::cos(angle2)*kx2;
41  auto y2 = std::sin(angle2)*ky2;
42 
43  Point2d ptv1( x0+x1, y0+y1 );
44  Point2d ptv2( x0+x2+100, y0+y2 );
45  OSegment v( ptv1, ptv2 );
46 // std::cout << "x1=" << x0+x1 << " y1=" << y0+y1 << " x2=" << x0+x2 << " y2=" << y0+y2 << '\n';
47 
48  v.getLine().draw( im, img::DrawParams().setColor(200,200,200) );
49  v.draw( im, img::DrawParams().setColor(250,0,0).showPoints() );
50 
51  pt0.draw( im, img::DrawParams().setColor(0,0,250) );
52 // li.draw( im, img::DrawParams().setThickness(2).setColor(250,0,0) );
53 
54  im.drawText( std::string("side=") + getString( v.getPointSide(pt0) ), Point2d(50,50), img::DrawParams() );
55 
56 
57  std::ostringstream oss;
58  oss << "showcase16b_" << std::setfill('0') << std::setw(2) << i << ".svg";
59  im.write( oss.str() );
60  }
61 }
#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
Point2d_< HOMOG2D_INUMTYPE > Point2d
Default point type, uses double as numerical type.
Definition: homog2d.hpp:12379
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
const char * getString(PtStyle t)
Definition: homog2d.hpp:496
Base class, will be instanciated as Point2d_ or Line2d_.
Definition: homog2d.hpp:365
Here is the call graph for this function: