-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathshowcase16.cpp
38 lines (31 loc) · 995 Bytes
/
showcase16.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
\file
\brief a point and a moving line, show side of point relatively to line
*/
//#define HOMOG2D_DEBUGMODE
#include "../../homog2d.hpp"
using namespace h2d;
int main( int, const char** )
{
auto nbim = 25; // nb images
auto imsize = 300;
Homogr Hr( 2.*M_PI/nbim ); // set up rotation
Homogr HT1( imsize/2, imsize/2 ); // centered on image center
Homogr HT2( -imsize/2, -imsize/2 );
Homogr H = HT1 * Hr * HT2;
// std::cout << "H=" << H << '\n';
Point2d pt0( imsize/2, 80 );
Line2d li( 20,20, 100,100);
img::Image<img::SvgImage> im( imsize*2,imsize-100 );
for( int i=0; i<nbim; i++ )
{
im.clear();
pt0.draw( im, img::DrawParams().setColor(0,0,250) );
li.draw( im, img::DrawParams().setThickness(2).setColor(250,0,0) );
im.drawText( "side=" + std::to_string( side( pt0, li) ), Point2d(50,50), img::DrawParams() );
li = H * li;
std::ostringstream oss;
oss << "showcase16_" << std::setfill('0') << std::setw(2) << i << ".svg";
im.write( oss.str() );
}
}