DGtal  1.4.beta
testConvexHull2DReverse.cpp
Go to the documentation of this file.
1 
31 #include <iostream>
32 #include "DGtal/base/Common.h"
33 #include "ConfigTest.h"
34 #include "DGtalCatch.h"
35 #include "DGtal/helpers/StdDefs.h"
36 #include "DGtal/geometry/tools/Hull2DHelpers.h"
37 #include "DGtal/geometry/tools/MelkmanConvexHull.h"
38 #include "DGtal/geometry/tools/determinant/InHalfPlaneBySimple3x3Matrix.h"
40 
41 using namespace std;
42 using namespace DGtal;
43 
45 // Functions for testing class ConvexHull2D
47 
48 TEST_CASE( "Testing MelkmanConvexHull insertion from front and back using reverse()" )
49 {
53 
54  // sequence of points splited from test testConvexHull2D_Thickness:
55  // using reverse() should produce the same convex hull.
56 
57  ch.add(Point(102.2, 50.2));
58  ch.add(Point(101.0, 50.0));
59  ch.add(Point(101.0, 49.1));
60  ch.add(Point(101.2, 48.2));
61  ch.add(Point(100.0, 48.2));
62  ch.add(Point(100.4, 47.4));
63  ch.reverse();
64  ch.add(Point(102.2, 51.0));
65  ch.add(Point(102.3, 52.3));
66  ch.add(Point(103.3, 52.3));
67  ch.add(Point(103.2, 53.4));
68  ch.add(Point(104.2, 53.2));
69  ch.add(Point(104.0, 54.2));
70 
72 
75  pHV, qHV, sHV);
76 
79  pE, qE, sE);
80 
83 
84  SECTION("Testing antipodal points of ConvexHull2D")
85  {
86  REQUIRE( pHV == Point(101.2, 48.2) );
87  REQUIRE( qHV == Point(104.2, 53.2) );
88  REQUIRE( sHV == Point(102.3, 52.3) );
89  }
90  SECTION("Testing antipodal points of ConvexHull2D")
91  {
92  REQUIRE( pE == Point(101.2, 48.2) );
93  REQUIRE( qE == Point(104.2, 53.2) );
94  REQUIRE( sE == Point(102.3, 52.3) );
95  }
96  ch.reverse();
97 
100  pE, qE, sE);
101 
103 
104  SECTION("Testing same antipodal points after hull reversing ")
105  {
106  REQUIRE( pE == Point(101.2, 48.2) );
107  REQUIRE( qE == Point(104.2, 53.2) );
108  REQUIRE( sE == Point(102.3, 52.3) );
109  }
110 }
111 
Aim: This class implements the on-line algorithm of Melkman for the computation of the convex hull of...
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
double computeHullThickness(const ForwardIterator &itb, const ForwardIterator &ite, const ThicknessDefinition &def)
Procedure to compute the convex hull thickness given from different definitions (Horizontal/vertical ...
DGtal is the top-level namespace which contains all DGtal functions and types.
MyPointD Point
Definition: testClone2.cpp:383
TEST_CASE("int container traits", "[int][traits]")
const double thicknessEb
DGtal::MelkmanConvexHull< Point, Functor > ch
SECTION("Testing antipodal points of ConvexHull2D")
InHalfPlaneBySimple3x3Matrix< Point, double > Functor
const double thicknessE
CAPTURE(thicknessHV)
const double thicknessHV
REQUIRE(domain.isInside(aPoint))