Skip to content

Commit 43200ea

Browse files
committed
Remove some redundant and unused MathUtils methods
1 parent 07a570f commit 43200ea

File tree

2 files changed

+1
-75
lines changed

2 files changed

+1
-75
lines changed

src/analysis/interpolation/MathUtils.cc

+1-69
Original file line numberDiff line numberDiff line change
@@ -220,22 +220,7 @@ double MathUtils::distPointFromLine( QgsPoint *thepoint, QgsPoint *p1, QgsPoint
220220

221221
int MathUtils::faculty( int n )
222222
{
223-
if ( n < 0 )//Is faculty also defined for negative integers?
224-
{
225-
QgsDebugMsg( "Error, faculty of a negative integer requested!" );
226-
return 0;
227-
}
228-
int i;
229-
int result = n;
230-
231-
if ( n == 0 || n == 1 )
232-
{return 1;}//faculty of 0 is 1!
233-
234-
for ( i = n - 1; i >= 2; i-- )
235-
{
236-
result *= i;
237-
}
238-
return result;
223+
return std::tgamma( n + 1 );
239224
}
240225

241226
bool MathUtils::inCircle( QgsPoint *testp, QgsPoint *p1, QgsPoint *p2, QgsPoint *p3 )
@@ -431,59 +416,6 @@ int MathUtils::lower( int n, int i )
431416
}
432417
}
433418

434-
double MathUtils::max( double x, double y )
435-
{
436-
if ( x > y )
437-
{
438-
return x;
439-
}
440-
else if ( y > x )
441-
{
442-
return y;
443-
}
444-
else//if both are equal
445-
{
446-
return x;
447-
}
448-
}
449-
double MathUtils::min( double x, double y )
450-
{
451-
if ( x < y )
452-
{
453-
return x;
454-
}
455-
else if ( y < x )
456-
{
457-
return y;
458-
}
459-
else//if both are equal
460-
{
461-
return x;
462-
}
463-
}
464-
465-
double MathUtils::power( double a, int b )
466-
{
467-
if ( b == 0 )
468-
{
469-
return 1;
470-
}
471-
double tmp = a;
472-
for ( int i = 2; i <= std::abs( b ); i++ )
473-
{
474-
475-
a *= tmp;
476-
}
477-
if ( b > 0 )
478-
{
479-
return a;
480-
}
481-
else
482-
{
483-
return ( 1.0 / a );
484-
}
485-
}
486-
487419
double MathUtils::triArea( QgsPoint *pa, QgsPoint *pb, QgsPoint *pc )
488420
{
489421
if ( pa && pb && pc )

src/analysis/interpolation/MathUtils.h

-6
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ namespace MathUtils
5454
bool ANALYSIS_EXPORT lineIntersection( QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4, QgsPoint *intersection_point );
5555
//! Lower function
5656
int ANALYSIS_EXPORT lower( int n, int i );
57-
//! Returns the maximum of two doubles or the first argument if both are equal
58-
double ANALYSIS_EXPORT max( double x, double y );
59-
//! Returns the minimum of two doubles or the first argument if both are equal
60-
double ANALYSIS_EXPORT min( double x, double y );
61-
//! Power function for integer coefficients
62-
double ANALYSIS_EXPORT power( double a, int b );//calculates a power b
6357
//! Returns the area of a triangle. If the points are ordered counterclockwise, the value will be positiv. If they are ordered clockwise, the value will be negativ
6458
double ANALYSIS_EXPORT triArea( QgsPoint *pa, QgsPoint *pb, QgsPoint *pc );
6559
//! Calculates the z-component of a vector with coordinates 'x' and 'y'which is in the same tangent plane as the tangent vectors 'v1' and 'v2'. The result is assigned to 'result'

0 commit comments

Comments
 (0)