DGtal  1.2.0
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"
Include dependency graph for testShapeMoveCenter.cpp:

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)
 
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/2]

template<typename Shape >
Shape 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() [2/2]

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 }

◆ TEMPLATE_TEST_CASE()

TEMPLATE_TEST_CASE ( "Star shapes"  ,
"move() method"  ,
AccFlower  ,
Astroid  ,
Ball  ,
Ellipse  ,
Flower  ,
Lemniscate  ,
NGon  ,
BallImplicit  ,
HyperCubeImplicit  ,
Norm1BallImplicit  ,
RoundedHyperCubeImplicit   
)
Examples
doc-examples/exampleCatch.cpp.

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 }
Space::RealPoint RealPoint
Definition: StdDefs.h:97
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