Quantum GIS API Documentation
1.8
|
00001 /*************************************************************************** 00002 MathUtils.h - description 00003 ------------------- 00004 copyright : (C) 2004 by Marco Hugentobler 00005 email : [email protected] 00006 ***************************************************************************/ 00007 00008 /*************************************************************************** 00009 * * 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; either version 2 of the License, or * 00013 * (at your option) any later version. * 00014 * * 00015 ***************************************************************************/ 00016 00017 #ifndef MATHUTILS_H 00018 #define MATHUTILS_H 00019 00020 #include <cmath> 00021 #include "Vector3D.h" 00022 #include "Point3D.h" 00023 00024 00025 namespace MathUtils 00026 { 00028 bool ANALYSIS_EXPORT calcBarycentricCoordinates( double x, double y, Point3D* p1, Point3D* p2, Point3D* p3, Point3D* result ); 00029 bool ANALYSIS_EXPORT BarycentricToXY( double u, double v, double w, Point3D* p1, Point3D* p2, Point3D* p3, Point3D* result ); 00031 double ANALYSIS_EXPORT calcBernsteinPoly( int n, int i, double t ); 00033 double ANALYSIS_EXPORT cFDerBernsteinPoly( int n, int i, double t ); 00035 double ANALYSIS_EXPORT calcCubicHermitePoly( int n, int i, double t ); 00037 double ANALYSIS_EXPORT cFDerCubicHermitePoly( int n, int i, double t ); 00039 bool ANALYSIS_EXPORT circumcenter( Point3D* p1, Point3D* p2, Point3D* p3, Point3D* result ); 00041 double ANALYSIS_EXPORT distPointFromLine( Point3D* thepoint, Point3D* p1, Point3D* p2 ); 00043 int ANALYSIS_EXPORT faculty( int n ); 00045 bool ANALYSIS_EXPORT inCircle( Point3D* testp, Point3D* p1, Point3D* p2, Point3D* p3 ); 00047 bool ANALYSIS_EXPORT inDiametral( Point3D* p1, Point3D* p2, Point3D* point ); 00049 double ANALYSIS_EXPORT leftOf( Point3D* thepoint, Point3D* p1, Point3D* p2 ); 00051 bool ANALYSIS_EXPORT lineIntersection( Point3D* p1, Point3D* p2, Point3D* p3, Point3D* p4 ); 00053 bool ANALYSIS_EXPORT lineIntersection( Point3D* p1, Point3D* p2, Point3D* p3, Point3D* p4, Point3D* intersection_point ); 00055 int ANALYSIS_EXPORT lower( int n, int i ); 00057 double ANALYSIS_EXPORT max( double x, double y ); 00059 double ANALYSIS_EXPORT min( double x, double y ); 00061 double ANALYSIS_EXPORT power( double a, int b );//calculates a power b 00063 double ANALYSIS_EXPORT triArea( Point3D* pa, Point3D* pb, Point3D* pc ); 00065 bool ANALYSIS_EXPORT derVec( const Vector3D* v1, const Vector3D* v2, Vector3D* result, double x, double y ); 00067 double ANALYSIS_EXPORT crossVec( Point3D* first, Vector3D* vec1, Point3D* second, Vector3D* vec2 ); 00069 bool ANALYSIS_EXPORT normalLeft( Vector3D* v1, Vector3D* result, double length ); 00071 bool ANALYSIS_EXPORT normalRight( Vector3D* v1, Vector3D* result, double length ); 00073 void ANALYSIS_EXPORT normalFromPoints( Point3D* p1, Point3D* p2, Point3D* p3, Vector3D* vec ); 00075 bool ANALYSIS_EXPORT pointInsideTriangle( double x, double y, Point3D* p1, Point3D* p2, Point3D* p3 ); 00077 bool ANALYSIS_EXPORT normalMinDistance( Vector3D* tangent, Vector3D* target, Vector3D* result ); 00079 double ANALYSIS_EXPORT planeTest( Point3D* test, Point3D* pt1, Point3D* pt2, Point3D* pt3 ); 00081 double ANALYSIS_EXPORT angle( Point3D* p1, Point3D* p2, Point3D* p3, Point3D* p4 ); 00082 } 00083 00084 #endif