mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Merge pull request #5074 from nyalldawson/cleanup
Remove some redundant and unused MathUtils methods
This commit is contained in:
commit
5e945461fe
@ -220,22 +220,7 @@ double MathUtils::distPointFromLine( QgsPoint *thepoint, QgsPoint *p1, QgsPoint
|
||||
|
||||
int MathUtils::faculty( int n )
|
||||
{
|
||||
if ( n < 0 )//Is faculty also defined for negative integers?
|
||||
{
|
||||
QgsDebugMsg( "Error, faculty of a negative integer requested!" );
|
||||
return 0;
|
||||
}
|
||||
int i;
|
||||
int result = n;
|
||||
|
||||
if ( n == 0 || n == 1 )
|
||||
{return 1;}//faculty of 0 is 1!
|
||||
|
||||
for ( i = n - 1; i >= 2; i-- )
|
||||
{
|
||||
result *= i;
|
||||
}
|
||||
return result;
|
||||
return std::tgamma( n + 1 );
|
||||
}
|
||||
|
||||
bool MathUtils::inCircle( QgsPoint *testp, QgsPoint *p1, QgsPoint *p2, QgsPoint *p3 )
|
||||
@ -431,59 +416,6 @@ int MathUtils::lower( int n, int i )
|
||||
}
|
||||
}
|
||||
|
||||
double MathUtils::max( double x, double y )
|
||||
{
|
||||
if ( x > y )
|
||||
{
|
||||
return x;
|
||||
}
|
||||
else if ( y > x )
|
||||
{
|
||||
return y;
|
||||
}
|
||||
else//if both are equal
|
||||
{
|
||||
return x;
|
||||
}
|
||||
}
|
||||
double MathUtils::min( double x, double y )
|
||||
{
|
||||
if ( x < y )
|
||||
{
|
||||
return x;
|
||||
}
|
||||
else if ( y < x )
|
||||
{
|
||||
return y;
|
||||
}
|
||||
else//if both are equal
|
||||
{
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
double MathUtils::power( double a, int b )
|
||||
{
|
||||
if ( b == 0 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
double tmp = a;
|
||||
for ( int i = 2; i <= std::abs( b ); i++ )
|
||||
{
|
||||
|
||||
a *= tmp;
|
||||
}
|
||||
if ( b > 0 )
|
||||
{
|
||||
return a;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( 1.0 / a );
|
||||
}
|
||||
}
|
||||
|
||||
double MathUtils::triArea( QgsPoint *pa, QgsPoint *pb, QgsPoint *pc )
|
||||
{
|
||||
if ( pa && pb && pc )
|
||||
|
@ -54,12 +54,6 @@ namespace MathUtils
|
||||
bool ANALYSIS_EXPORT lineIntersection( QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4, QgsPoint *intersection_point );
|
||||
//! Lower function
|
||||
int ANALYSIS_EXPORT lower( int n, int i );
|
||||
//! Returns the maximum of two doubles or the first argument if both are equal
|
||||
double ANALYSIS_EXPORT max( double x, double y );
|
||||
//! Returns the minimum of two doubles or the first argument if both are equal
|
||||
double ANALYSIS_EXPORT min( double x, double y );
|
||||
//! Power function for integer coefficients
|
||||
double ANALYSIS_EXPORT power( double a, int b );//calculates a power b
|
||||
//! 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
|
||||
double ANALYSIS_EXPORT triArea( QgsPoint *pa, QgsPoint *pb, QgsPoint *pc );
|
||||
//! 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'
|
||||
|
Loading…
x
Reference in New Issue
Block a user