Changed negative recursion level argument to positive

BEZIER_POLY::recursiveBezier() was called with negated 'level'
variable as an argument which is incorrect for an unsigned type.
This commit is contained in:
Maciej Suminski 2018-04-18 10:28:33 +02:00
parent e4feb315d5
commit c960d671cd
2 changed files with 6 additions and 4 deletions

View File

@ -68,7 +68,8 @@ void BEZIER_POLY::GetPoly( std::vector<wxPoint>& aOutput )
} }
void BEZIER_POLY::recursiveBezier( int x1, int y1, int x2, int y2, int x3, int y3, unsigned int level ) void BEZIER_POLY::recursiveBezier( int x1, int y1, int x2, int y2,
int x3, int y3, unsigned int level )
{ {
if( level > recursion_limit ) if( level > recursion_limit )
return; return;
@ -154,11 +155,12 @@ void BEZIER_POLY::recursiveBezier( int x1, int y1, int x2, int y2, int x3, int y
// Continue subdivision // Continue subdivision
//---------------------- //----------------------
recursiveBezier( x1, y1, x12, y12, x123, y123, level + 1 ); recursiveBezier( x1, y1, x12, y12, x123, y123, level + 1 );
recursiveBezier( x123, y123, x23, y23, x3, y3, -(level + 1) ); recursiveBezier( x123, y123, x23, y23, x3, y3, level + 1 );
} }
void BEZIER_POLY::recursiveBezier( int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, unsigned int level ) void BEZIER_POLY::recursiveBezier( int x1, int y1, int x2, int y2,
int x3, int y3, int x4, int y4, unsigned int level )
{ {
if( level > recursion_limit ) if( level > recursion_limit )
return; return;

View File

@ -84,7 +84,7 @@ private:
// Conversion parameters // Conversion parameters
constexpr static double angle_tolerance = 0.0; constexpr static double angle_tolerance = 0.0;
constexpr static double cusp_limit = 0.0; constexpr static double cusp_limit = 0.0;
constexpr static int recursion_limit = 12; constexpr static unsigned int recursion_limit = 12;
constexpr static double approximation_scale = 0.5; // 1 constexpr static double approximation_scale = 0.5; // 1
constexpr static double distance_tolerance_square = ( 0.5 / approximation_scale ) * ( 0.5 / approximation_scale ); constexpr static double distance_tolerance_square = ( 0.5 / approximation_scale ) * ( 0.5 / approximation_scale );