16 #include "DGtal/helpers/StdDefs.h"
17 #include "DGtal/arithmetic/LatticePolytope2D.h"
18 #include "DGtal/io/boards/Board2D.h"
19 #include "DGtal/shapes/Shapes.h"
24 using namespace DGtal;
28 void usage(
int,
char** argv )
30 std::cerr <<
"Usage: " << argv[ 0 ] <<
" <a> <b> <c>" << std::endl;
31 std::cerr <<
"\t - Cuts a square by ax+by <= c. Displays everything in files "
32 <<
"lower-integer-convex-hull*.eps" << std::endl;
38 int main(
int argc,
char** argv )
54 cip.push_front(
Point( -10, 10 ) );
55 cip.push_front(
Point( 10, 10 ) );
56 cip.push_front(
Point( 10, -10 ) );
57 Domain domain = cip.boundingBoxDomain();
63 board.saveEPS(
"lower-integer-convex-hull.eps" );
67 int a = atoi( argv[ 1 ] );
68 int b = atoi( argv[ 2 ] );
69 int c = atoi( argv[ 3 ] );
73 HalfSpace hs(
Vector( a, b ), c );
85 board.saveEPS(
"lower-integer-convex-hull-cut.eps" );
89 std::cout <<
"Number of vertices = " << cip.size() << std::endl;
90 std::cout <<
"Area = " << (((double)cip.twiceArea())/2.0) << std::endl;
91 std::cout <<
"Number of interior points = " << cip.numberInteriorPoints() << std::endl;
92 std::cout <<
"Number of boundary points = " << cip.numberBoundaryPoints() << std::endl;