Closed danoan closed 3 years ago
In line 98 of file DGtal/shapes/parametric/NGon2D.ih, the variable angle uses itself in its definition
const double angle = t - myPhi + (angle < 0.0 ? NGON2D_2_PI : 0.);
I suggest to rewrite as
double angle = t - myPhi; angle = (angle < 0.0) ? angle + NGON2D_2_PI : angle;
A consequence of this error can be materialized by digitizing a triangle
#include <DGtal/helpers/StdDefs.h> #include <DGtal/io/boards/Board2D.h> #include <DGtal/shapes/GaussDigitizer.h> #include <DGtal/shapes/Shapes.h> #include <DGtal/shapes/parametric/NGon2D.h> int main(int argc, char* argv[]) { using namespace DGtal::Z2i; typedef DGtal::NGon2D<Space> Shape; double PI = 3.14159265359; Shape shape(0,0,20,3,PI/2); DGtal::GaussDigitizer<Space, Shape> gd; double h =0.5; gd.attach(shape); gd.init(shape.getLowerBound(), shape.getUpperBound(), h); Domain domain(gd.getDomain().lowerBound(), gd.getDomain().upperBound()); DigitalSet output(domain); DGtal::Shapes<Domain>::digitalShaper(output, gd); DGtal::Board2D board; board << output; board.saveSVG("triangle.svg"); return 0; }
Fixed in #1541
In line 98 of file DGtal/shapes/parametric/NGon2D.ih, the variable angle uses itself in its definition
I suggest to rewrite as
A consequence of this error can be materialized by digitizing a triangle