DGtal 1.3.0
Loading...
Searching...
No Matches
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"
39
40
42
43using namespace std;
44using namespace DGtal;
45
47// Functions for testing class ConvexHull2D
49
50TEST_CASE( "Testing MelkmanConvexHull insertion from front and back using reverse()" )
51{
55
56 // sequence of points splited from test testConvexHull2D_Thickness:
57 // using reverse() should produce the same convex hull.
58
59 ch.add(Point(102.2, 50.2));
60 ch.add(Point(101.0, 50.0));
61 ch.add(Point(101.0, 49.1));
62 ch.add(Point(101.2, 48.2));
63 ch.add(Point(100.0, 48.2));
64 ch.add(Point(100.4, 47.4));
65 ch.reverse();
66 ch.add(Point(102.2, 51.0));
67 ch.add(Point(102.3, 52.3));
68 ch.add(Point(103.3, 52.3));
69 ch.add(Point(103.2, 53.4));
70 ch.add(Point(104.2, 53.2));
71 ch.add(Point(104.0, 54.2));
72
74
77 pHV, qHV, sHV);
78
81 pE, qE, sE);
82
85
86 SECTION("Testing antipodal points of ConvexHull2D")
87 {
88 REQUIRE( pHV == Point(101.2, 48.2) );
89 REQUIRE( qHV == Point(104.2, 53.2) );
90 REQUIRE( sHV == Point(102.3, 52.3) );
91 }
92 SECTION("Testing antipodal points of ConvexHull2D")
93 {
94 REQUIRE( pE == Point(101.2, 48.2) );
95 REQUIRE( qE == Point(104.2, 53.2) );
96 REQUIRE( sE == Point(102.3, 52.3) );
97 }
98 ch.reverse();
99
102 pE, qE, sE);
103
105
106 SECTION("Testing same antipodal points after hull reversing ")
107 {
108 REQUIRE( pE == Point(101.2, 48.2) );
109 REQUIRE( qE == Point(104.2, 53.2) );
110 REQUIRE( sE == Point(102.3, 52.3) );
111 }
112}
113
Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation o...
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.
STL namespace.
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))