homog2d library
Functions
showcase2b.cpp File Reference

Generates area of union of two rectangles. More...

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

Functions

int main (int, const char **)
 

Detailed Description

Generates area of union of two rectangles.

Function Documentation

◆ main()

int main ( int  ,
const char **   
)
13 {
14  int n=30;
15  auto im_w = 350;
16  auto im_h = 180;
18 
19  FRect r1(40,30, 130,90 );
20  FRect r2(160,45, 210,150 );
21 
22  auto color_red = DrawParams().setColor(200,20,20);
23  auto color_green = DrawParams().setColor(20,220,20);
24  int mul = 1;
25  for( int i=0; i<n; i++ )
26  {
27  imgb.clear();
28  getBB(r1,r2).draw( imgb, DrawParams().setColor(200,200,200) );
29 
30  r1.draw( imgb, color_green );
31  r2.draw( imgb, color_green );
32 
33 #if 0 // either way is the same
34  auto b = r1.unionArea(r2);
35 #else
36  auto b = r1|r2;
37 #endif
38 
39  b.draw( imgb, color_red );
40  imgb.drawText( "IoU=" + std::to_string( IoU(r1,r2) ), Point2d (20,20) );
41 
42  if( (i+1)%10 == 0 )
43  {
44  mul = mul*-1;
45  r1.translate(0,30);
46  }
47 
48  std::ostringstream ossb;
49  ossb << "showcase2b_" << std::setfill('0') << std::setw(2) <<i << ".svg";
50  imgb.write( ossb.str() );
51 
52  r1.translate( mul*20,0);
53  }
54 
55 }
HOMOG2D_INUMTYPE IoU(const FRect_< FPT1 > &r1, const FRect_< FPT2 > &r2)
Intersection area over Union area (free function)
Definition: homog2d.hpp:9856
auto im_w
Definition: showcase19.cpp:14
Draw parameters, independent of back-end library.
Definition: homog2d.hpp:514
auto im_h
Definition: showcase19.cpp:13
A Flat Rectangle, modeled by its two opposite points.
Definition: homog2d.hpp:379
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
DrawParams & setColor(uint8_t r, uint8_t g, uint8_t b)
Definition: homog2d.hpp:605
DrawParams color_red
Definition: showcase1.cpp:11
Base class, will be instanciated as Point2d_ or Line2d_.
Definition: homog2d.hpp:365
Here is the call graph for this function: