homog2d library
Functions | Variables
showcase7d.cpp File Reference

shows isInside() for Ellipse More...

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

Functions

template<typename T >
void draw_object (const Ellipse &ell, const T &p, img::DrawParams &dp)
 
int main (int, const char **)
 

Variables

img::Image< img::SvgImageim (280, 220)
 

Detailed Description

shows isInside() for Ellipse

Function Documentation

◆ draw_object()

template<typename T >
void draw_object ( const Ellipse ell,
const T &  p,
img::DrawParams dp 
)
15 {
16 /* auto inter = seg.intersects(p);
17  if( inter() )
18  for( const auto& pt: inter.get() )
19  pt.draw( im, img::DrawParams().setPointStyle( img::PtStyle::Dot ) );
20 */
21 // auto col = col_outside;
22  if( p.isInside( ell ) )
23  dp = dp.setThickness(2);
24  p.draw( im, dp );
25 }
img::Image< img::SvgImage > im(280, 220)
DrawParams & setThickness(uint8_t t)
Definition: homog2d.hpp:600
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  ,
const char **   
)
28 {
29  auto n = 25; // nb images
30 
31  Ellipse ell( 100,70,50,90, 35 * M_PI/180. );
32 
33  FRect rect(15,110,40,150);
34  Circle cir( 170,120, 22 );
35  Segment seg( 50,10, 85,7 );
36  std::vector<Point2d> vpts{
37  { 0, 0 },
38  { 40,12 },
39  { 32,38},
40  { 28,14},
41  { 17,50 },
42  { 9,20 }
43  };
44  CPolyline pol( vpts );
45  pol.translate( 3, 5 );
46 
47  auto col_ell = img::DrawParams().setColor(250,20,20);
48 
49  for( int i=0; i<n; i++ )
50  {
51  im.clear();
52 
53  ell.draw( im, col_ell );
54 /* rect.draw( im, img::DrawParams().setColor(50,250,120) );
55  cir.draw( im, img::DrawParams().setColor(50,120,250) );
56  pol.draw( im, img::DrawParams().setColor(50,180,180) );
57  */
58  draw_object( ell, rect, img::DrawParams().setColor(10,250,120) );
59 // draw_object( ell, cir, img::DrawParams().setColor(10,120,250) );
60  draw_object( ell, pol, img::DrawParams().setColor(10,180,180) );
61  draw_object( ell, seg, img::DrawParams().setColor(180,0,180) );
62 
63  pol.translate( 8, 3) ;
64  cir.translate( -5, -1) ;
65  rect.translate( 9, -6) ;
66  seg.translate( 2, 7) ;
67 
68  std::ostringstream oss;
69  oss << "showcase7d_" << std::setfill('0') << std::setw(2) <<i << ".svg";
70  im.write( oss.str() );
71  }
72 }
A circle.
Definition: homog2d.hpp:378
Segment seg
Definition: homog2d_test.cpp:4033
img::Image< img::SvgImage > im(280, 220)
#define M_PI
Definition: homog2d.hpp:235
CPolyline pol(5, 5u)
FRect rect
Definition: homog2d_test.cpp:4038
void translate(T1 dx, T2 dy)
Translate Segment.
Definition: homog2d.hpp:4992
void translate(TX dx, TY dy)
Translate Polyline using dx, dy.
Definition: homog2d.hpp:6411
Draw parameters, independent of back-end library.
Definition: homog2d.hpp:514
void draw_object(const Ellipse &ell, const T &p, img::DrawParams &dp)
Definition: showcase7d.cpp:14
Ellipse as a conic in matrix form.
Definition: homog2d.hpp:380
Ellipse ell
Definition: homog2d_test.cpp:4037
void draw(img::Image< cv::Mat > &, img::DrawParams dp=img::DrawParams()) const
Draw Ellipse (Opencv implementation)
Definition: homog2d.hpp:11929
A Flat Rectangle, modeled by its two opposite points.
Definition: homog2d.hpp:379
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
Polyline, will be instanciated either as OPolyline_ (open polyline) or CPolyline_.
Definition: homog2d.hpp:364
void translate(TX dx, TY dy)
Translate Circle.
Definition: homog2d.hpp:3366
void translate(TX dx, TY dy)
Translate FRect.
Definition: homog2d.hpp:2810
Circle cir
Definition: homog2d_test.cpp:4036
Here is the call graph for this function:

Variable Documentation

◆ im

img::Image<img::SvgImage> im(280, 220)