DGtal  1.5.beta
testConvexHull2DThickness.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "ConfigTest.h"
#include "DGtalCatch.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/geometry/tools/Hull2DHelpers.h"
#include "DGtal/geometry/tools/determinant/InHalfPlaneBySimple3x3Matrix.h"
Include dependency graph for testConvexHull2DThickness.cpp:

Go to the source code of this file.

Typedefs

typedef InHalfPlaneBySimple3x3Matrix< Point, DGtal::int64_tFunctor
 

Functions

ch add (Point(0, 0))
 
ch add (Point(1, 0))
 
ch add (Point(1, 1))
 
 SECTION ("Testing computation of horizontal/vertical thickness of ConvexHull2D")
 
 SECTION ("Testing computation of euclidean thickness of ConvexHull2D")
 
ch add (Point(104.0, 54.2))
 
ch add (Point(104.2, 53.2))
 
ch add (Point(103.2, 53.4))
 
ch add (Point(103.3, 52.3))
 
ch add (Point(102.3, 52.3))
 
ch add (Point(102.2, 51.0))
 
ch add (Point(102.2, 50.2))
 
ch add (Point(101.0, 50.0))
 
ch add (Point(101.0, 49.1))
 
ch add (Point(101.2, 48.2))
 
ch add (Point(100.0, 48.2))
 
ch add (Point(100.4, 47.4))
 
 CAPTURE (thicknessHV)
 
 CAPTURE (thicknessE)
 
 SECTION ("Testing antipodal points of ConvexHull2D")
 
ch reverse ()
 
 CAPTURE (thicknessEb)
 
 SECTION ("Testing same antipodal points after hull reversing ")
 

Variables

DGtal::MelkmanConvexHull< Point, Functorch
 
Point pHV
 
Point qHV
 
Point sHV
 
Point pE
 
Point qE
 
Point sE
 
double thicknessHV
 
double thicknessEucl
 
const double thicknessE
 
const double thicknessEb
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Bertrand Kerautret (kerau.nosp@m.tre@.nosp@m.loria.nosp@m..fr ) LORIA (CNRS, UMR 7503), University of Nancy, France
Date
2015/10/16

Functions for testing class ConvexHull2D-catch.

This file is part of the DGtal library.

Definition in file testConvexHull2DThickness.cpp.

Typedef Documentation

◆ Functor

typedef InHalfPlaneBySimple3x3Matrix<Point, double> Functor
Initial value:
{
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
MyPointD Point
Definition: testClone2.cpp:383

Definition at line 52 of file testConvexHull2DThickness.cpp.

Function Documentation

◆ add() [1/15]

ch add ( Point(0, 0)  )

◆ add() [2/15]

ch add ( Point(1, 0)  )

◆ add() [3/15]

ch add ( Point(1, 1)  )

◆ add() [4/15]

ch add ( Point(100.0, 48.2)  )

◆ add() [5/15]

ch add ( Point(100.4, 47.4)  )

◆ add() [6/15]

ch add ( Point(101.0, 49.1)  )

◆ add() [7/15]

ch add ( Point(101.0, 50.0)  )

◆ add() [8/15]

ch add ( Point(101.2, 48.2)  )

◆ add() [9/15]

ch add ( Point(102.2, 50.2)  )

◆ add() [10/15]

ch add ( Point(102.2, 51.0)  )

◆ add() [11/15]

ch add ( Point(102.3, 52.3)  )

◆ add() [12/15]

ch add ( Point(103.2, 53.4)  )

◆ add() [13/15]

ch add ( Point(103.3, 52.3)  )

◆ add() [14/15]

ch add ( Point(104.0, 54.2)  )

◆ add() [15/15]

ch add ( Point(104.2, 53.2)  )

◆ CAPTURE() [1/3]

CAPTURE ( thicknessE  )

◆ CAPTURE() [2/3]

CAPTURE ( thicknessEb  )

◆ CAPTURE() [3/3]

CAPTURE ( thicknessHV  )

◆ reverse()

ch reverse ( )

◆ SECTION() [1/4]

SECTION ( "Testing antipodal points of ConvexHull2D"  )

Definition at line 120 of file testConvexHull2DThickness.cpp.

121  {
122  REQUIRE( pHV == Point(101.2, 48.2) );
123  REQUIRE( qHV == Point(104.2, 53.2) );
124  REQUIRE( sHV == Point(102.3, 52.3) );
125  }
REQUIRE(domain.isInside(aPoint))

References pHV, qHV, REQUIRE(), and sHV.

◆ SECTION() [2/4]

SECTION ( "Testing computation of euclidean thickness of ConvexHull2D"  )

Definition at line 78 of file testConvexHull2DThickness.cpp.

79  {
80  REQUIRE( thicknessEucl == Approx(std::sqrt(2.0)/2.0) );
81  REQUIRE( pE == Point(1,1) );
82  REQUIRE( qE==Point(0,0) );
83  REQUIRE( sE==Point(1,0) );
84  }
double thicknessEucl

References pE, qE, REQUIRE(), sE, and thicknessEucl.

◆ SECTION() [3/4]

SECTION ( "Testing computation of horizontal/vertical thickness of ConvexHull2D"  )

Definition at line 69 of file testConvexHull2DThickness.cpp.

70  {
71  REQUIRE( thicknessHV == 1.0 );
72  REQUIRE( pHV == Point(0,0) );
73  REQUIRE( qHV==Point(1,0) );
74  REQUIRE( sHV==Point(1,1) );
75  }
double thicknessHV

References pHV, qHV, REQUIRE(), sHV, and thicknessHV.

◆ SECTION() [4/4]

SECTION ( "Testing same antipodal points after hull reversing "  )

Definition at line 140 of file testConvexHull2DThickness.cpp.

141  {
142  REQUIRE( pE == Point(101.2, 48.2) );
143  REQUIRE( qE == Point(104.2, 53.2) );
144  REQUIRE( sE == Point(102.3, 52.3) );
145  }

References pE, qE, REQUIRE(), and sE.

Variable Documentation

◆ ch

◆ pE

Point pE

Definition at line 58 of file testConvexHull2DThickness.cpp.

Referenced by SECTION().

◆ pHV

Point pHV

Definition at line 58 of file testConvexHull2DThickness.cpp.

Referenced by SECTION().

◆ qE

Point qE

Definition at line 58 of file testConvexHull2DThickness.cpp.

Referenced by SECTION().

◆ qHV

Point qHV

Definition at line 58 of file testConvexHull2DThickness.cpp.

Referenced by SECTION().

◆ sE

Point sE

Definition at line 58 of file testConvexHull2DThickness.cpp.

Referenced by SECTION().

◆ sHV

Point sHV

Definition at line 58 of file testConvexHull2DThickness.cpp.

Referenced by SECTION().

◆ thicknessE

const double thicknessE
Initial value:
pE, qE, sE)
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::MelkmanConvexHull< Point, Functor > ch

Definition at line 113 of file testConvexHull2DThickness.cpp.

◆ thicknessEb

const double thicknessEb

◆ thicknessEucl

double thicknessEucl

◆ thicknessHV

const double thicknessHV