DGtal 1.3.0
Loading...
Searching...
No Matches
Typedefs | Functions | Variables
testShapeMoveCenter.cpp File Reference
#include <iostream>
#include <random>
#include "DGtalCatch.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/parametric/AccFlower2D.h"
#include "DGtal/shapes/parametric/Astroid2D.h"
#include "DGtal/shapes/parametric/Ball2D.h"
#include "DGtal/shapes/parametric/Ellipse2D.h"
#include "DGtal/shapes/parametric/Flower2D.h"
#include "DGtal/shapes/parametric/Lemniscate2D.h"
#include "DGtal/shapes/parametric/NGon2D.h"
#include "DGtal/shapes/implicit/ImplicitBall.h"
#include "DGtal/shapes/implicit/ImplicitHyperCube.h"
#include "DGtal/shapes/implicit/ImplicitNorm1Ball.h"
#include "DGtal/shapes/implicit/ImplicitRoundedHyperCube.h"

Go to the source code of this file.

Typedefs

typedef Z2i::Space Space
 
typedef Z2i::Point Point
 
typedef Z2i::RealPoint RealPoint
 
typedef AccFlower2D< SpaceAccFlower
 
typedef Astroid2D< SpaceAstroid
 
typedef Ball2D< SpaceBall
 
typedef Ellipse2D< SpaceEllipse
 
typedef Flower2D< SpaceFlower
 
typedef Lemniscate2D< SpaceLemniscate
 
typedef NGon2D< SpaceNGon
 
typedef ImplicitBall< SpaceBallImplicit
 
typedef ImplicitHyperCube< SpaceHyperCubeImplicit
 
typedef ImplicitNorm1Ball< SpaceNorm1BallImplicit
 
typedef ImplicitRoundedHyperCube< SpaceRoundedHyperCubeImplicit
 

Functions

template<typename Shape >
Shape createShape (const RealPoint &center, const RealPoint &radii)
 
template<>
AccFlower createShape (const RealPoint &center, const RealPoint &radii)
 
template<>
Astroid createShape (const RealPoint &center, const RealPoint &radii)
 
template<>
Ball createShape (const RealPoint &center, const RealPoint &radii)
 
template<>
Ellipse createShape (const RealPoint &center, const RealPoint &radii)
 
template<>
Flower createShape (const RealPoint &center, const RealPoint &radii)
 
template<>
Lemniscate createShape (const RealPoint &center, const RealPoint &radii)
 
template<>
NGon createShape (const RealPoint &center, const RealPoint &radii)
 
template<>
BallImplicit createShape (const RealPoint &center, const RealPoint &radii)
 
template<>
HyperCubeImplicit createShape (const RealPoint &center, const RealPoint &radii)
 
template<>
Norm1BallImplicit createShape (const RealPoint &center, const RealPoint &radii)
 
template<>
RoundedHyperCubeImplicit createShape (const RealPoint &center, const RealPoint &radii)
 
std::uniform_real_distribution< double > unif (-1000000., 1000000.)
 
 TEMPLATE_TEST_CASE ("Star shapes", "move() method", AccFlower, Astroid, Ball, Ellipse, Flower, Lemniscate, NGon, BallImplicit, HyperCubeImplicit, Norm1BallImplicit, RoundedHyperCubeImplicit)
 

Variables

std::default_random_engine re
 

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
Adrien Krähenbühl (krahe.nosp@m.nbuh.nosp@m.l@uni.nosp@m.stra.nosp@m..fr ) Laboratoire ICube, UMR 7357, Université de Strasbourg, France
Date
2019/07/08

Functions for testing the moveTo() method of star shapes.

This file is part of the DGtal library.

Definition in file testShapeMoveCenter.cpp.

Typedef Documentation

◆ AccFlower

Definition at line 56 of file testShapeMoveCenter.cpp.

◆ Astroid

Definition at line 57 of file testShapeMoveCenter.cpp.

◆ Ball

typedef Ball2D<Space> Ball
Examples
dec/exampleHeatLaplace.cpp.

Definition at line 58 of file testShapeMoveCenter.cpp.

◆ BallImplicit

Definition at line 64 of file testShapeMoveCenter.cpp.

◆ Ellipse

Definition at line 59 of file testShapeMoveCenter.cpp.

◆ Flower

typedef Flower2D<Space> Flower

Definition at line 60 of file testShapeMoveCenter.cpp.

◆ HyperCubeImplicit

Definition at line 65 of file testShapeMoveCenter.cpp.

◆ Lemniscate

Definition at line 61 of file testShapeMoveCenter.cpp.

◆ NGon

typedef NGon2D<Space> NGon

Definition at line 62 of file testShapeMoveCenter.cpp.

◆ Norm1BallImplicit

Definition at line 66 of file testShapeMoveCenter.cpp.

◆ Point

typedef Z2i::Point Point

Definition at line 53 of file testShapeMoveCenter.cpp.

◆ RealPoint

Definition at line 54 of file testShapeMoveCenter.cpp.

◆ RoundedHyperCubeImplicit

Definition at line 67 of file testShapeMoveCenter.cpp.

◆ Space

typedef Z2i::Space Space

Definition at line 52 of file testShapeMoveCenter.cpp.

Function Documentation

◆ createShape() [1/12]

template<typename Shape >
Shape createShape ( const RealPoint center,
const RealPoint radii 
)

◆ createShape() [2/12]

template<>
AccFlower createShape ( const RealPoint center,
const RealPoint radii 
)

Definition at line 73 of file testShapeMoveCenter.cpp.

74{
75 return AccFlower( center, radii[0], radii[1], 12, 2. );
76}
AccFlower2D< Space > AccFlower

◆ createShape() [3/12]

template<>
Astroid createShape ( const RealPoint center,
const RealPoint radii 
)

Definition at line 79 of file testShapeMoveCenter.cpp.

80{
81 return Astroid( center, radii[0], radii[1] );
82}
Astroid2D< Space > Astroid

◆ createShape() [4/12]

template<>
Ball createShape ( const RealPoint center,
const RealPoint radii 
)

Definition at line 85 of file testShapeMoveCenter.cpp.

86{
87 return Ball( center, radii[0] );
88}
Ball2D< Space > Ball

◆ createShape() [5/12]

template<>
Ellipse createShape ( const RealPoint center,
const RealPoint radii 
)

Definition at line 91 of file testShapeMoveCenter.cpp.

92{
93 return Ellipse( center, radii[0], radii[1], 2. );
94}
Ellipse2D< Space > Ellipse

◆ createShape() [6/12]

template<>
Flower createShape ( const RealPoint center,
const RealPoint radii 
)

Definition at line 97 of file testShapeMoveCenter.cpp.

98{
99 return Flower( center, radii[0], radii[1], 5, 2. );
100}
Flower2D< Space > Flower

◆ createShape() [7/12]

template<>
Lemniscate createShape ( const RealPoint center,
const RealPoint radii 
)

Definition at line 103 of file testShapeMoveCenter.cpp.

104{
105 return Lemniscate( center, radii[0] );
106}
Lemniscate2D< Space > Lemniscate

◆ createShape() [8/12]

template<>
NGon createShape ( const RealPoint center,
const RealPoint radii 
)

Definition at line 109 of file testShapeMoveCenter.cpp.

110{
111 return NGon( center, radii[0], 20, 2. );
112}
NGon2D< Space > NGon

◆ createShape() [9/12]

template<>
BallImplicit createShape ( const RealPoint center,
const RealPoint radii 
)

Definition at line 115 of file testShapeMoveCenter.cpp.

116{
117 return BallImplicit( center, radii[0] );
118}
ImplicitBall< Space > BallImplicit

◆ createShape() [10/12]

template<>
HyperCubeImplicit createShape ( const RealPoint center,
const RealPoint radii 
)

Definition at line 121 of file testShapeMoveCenter.cpp.

122{
123 return HyperCubeImplicit( center, radii[0] );
124}
ImplicitHyperCube< Space > HyperCubeImplicit

◆ createShape() [11/12]

template<>
Norm1BallImplicit createShape ( const RealPoint center,
const RealPoint radii 
)

Definition at line 127 of file testShapeMoveCenter.cpp.

128{
129 return Norm1BallImplicit( center, radii[0] );
130}
ImplicitNorm1Ball< Space > Norm1BallImplicit

◆ createShape() [12/12]

template<>
RoundedHyperCubeImplicit createShape ( const RealPoint center,
const RealPoint radii 
)

Definition at line 133 of file testShapeMoveCenter.cpp.

134{
135 return RoundedHyperCubeImplicit( center, radii[0], 3. );
136}
ImplicitRoundedHyperCube< Space > RoundedHyperCubeImplicit

◆ TEMPLATE_TEST_CASE()

TEMPLATE_TEST_CASE ( "Star shapes"  ,
"move() method"  ,
AccFlower  ,
Astroid  ,
Ball  ,
Ellipse  ,
Flower  ,
Lemniscate  ,
NGon  ,
BallImplicit  ,
HyperCubeImplicit  ,
Norm1BallImplicit  ,
RoundedHyperCubeImplicit   
)

Definition at line 141 of file testShapeMoveCenter.cpp.

144{
145 const double centerX = unif(re);
146 const double centerY = unif(re);
147 const double radiusX = unif(re);
148 const double radiusY = unif(re);
149
150 TestType shape = createShape<TestType>( RealPoint(centerX, centerY), RealPoint(radiusX, radiusY) );
151
152 SECTION("Center coordinates")
153 {
154 REQUIRE( shape.center() == RealPoint(centerX, centerY) );
155 }
156
157 SECTION("Change center position")
158 {
159 const double newCenterX = unif(re);
160 const double newCenterY = unif(re);
161
162 shape.moveTo( RealPoint( newCenterX, newCenterY ) );
163
164 REQUIRE( shape.center() == RealPoint( newCenterX, newCenterY ) );
165 }
166}
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
std::default_random_engine re
std::uniform_real_distribution< double > unif(-1000000., 1000000.)
Z2i::RealPoint RealPoint
SECTION("Testing constant forward iterators")
REQUIRE(domain.isInside(aPoint))

References re, REQUIRE(), SECTION(), and unif().

◆ unif()

std::uniform_real_distribution< double > unif ( 1000000.,
1000000.   
)

Variable Documentation

◆ re

std::default_random_engine re