37#include "DGtal/base/Common.h"
38#include "DGtal/kernel/PointVector.h"
39#include "DGtal/shapes/fromPoints/CircleFrom3Points.h"
40#include "DGtal/shapes/fromPoints/CircleFrom2Points.h"
42#include "DGtal/io/boards/Board2D.h"
44#include "ConfigTest.h"
59template <
typename Coordinate>
60bool testCircleFrom3Points()
63 trace.beginBlock(
"Simple test for CircleFrom3Points");
71 trace.info() << c << endl;
77 trace.info() << c << endl;
83 trace.info() << c << endl;
88 if ( (cx != 5.0)||(cy != 0.0) )
90 trace.emphase() <<
"error in returned center" << endl;
91 trace.info() <<
"(" << cx <<
"," << cy <<
") " << endl;
92 trace.info() <<
"instead of (5,0)" << endl;
98 trace.info() << c << endl;
104 board <<
SetMode(o.className(),
"Grid") << o;
107 trace.info() <<
"arc drawing" << endl;
118 board.
saveEPS(
"arcDisplay.eps");
127template <
typename Coordinate>
128bool testCircleFrom2Points()
131 trace.beginBlock(
"Simple test for CircleFrom2Points");
140 trace.info() << c << endl;
155int main(
int argc,
char** argv )
157 trace.beginBlock (
"Testing shapes from points" );
158 trace.info() <<
"Args:";
159 for (
int i = 0; i < argc; ++i )
160 trace.info() <<
" " << argv[ i ];
161 trace.info() << endl;
164 bool res = testCircleFrom3Points<int>()
165 && testCircleFrom3Points<double>()
166 && testCircleFrom3Points<BigInteger>()
167 && testCircleFrom2Points<int>()
171 trace.emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Aim: Represents a circle that passes through a given point and that is thus uniquely defined by two o...
Aim: Represents a circle uniquely defined by three 2D points and that is able to return for any given...
void getParameters(double &cx, double &cy, double &rr) const
Distance signedDistance(const Point &aP) const
std::string className() const
void init(const Point &aFirstPoint, const Point &aSecondPoint, const Point &aThirdPoint)
Aim: Implements basic operations that will be used in Point and Vector classes.
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
DGtal is the top-level namespace which contains all DGtal functions and types.
static void draw(DGtal::Board2D &board, const DGtal::DiscreteExteriorCalculus< dimEmbedded, dimAmbient, TLinearAlgebraBackend, TInteger > &calculus)
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....