QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MathUtils.h
Go to the documentation of this file.
1 /***************************************************************************
2  MathUtils.h - description
3  -------------------
4  copyright : (C) 2004 by Marco Hugentobler
5  email : [email protected]
6  ***************************************************************************/
7 
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef MATHUTILS_H
18 #define MATHUTILS_H
19 
20 #include <cmath>
21 #include "Vector3D.h"
22 #include "Point3D.h"
23 
24 
25 namespace MathUtils
26 {
28  bool ANALYSIS_EXPORT calcBarycentricCoordinates( double x, double y, Point3D* p1, Point3D* p2, Point3D* p3, Point3D* result );
29  bool ANALYSIS_EXPORT BarycentricToXY( double u, double v, double w, Point3D* p1, Point3D* p2, Point3D* p3, Point3D* result );
31  double ANALYSIS_EXPORT calcBernsteinPoly( int n, int i, double t );
33  double ANALYSIS_EXPORT cFDerBernsteinPoly( int n, int i, double t );
35  double ANALYSIS_EXPORT calcCubicHermitePoly( int n, int i, double t );
37  double ANALYSIS_EXPORT cFDerCubicHermitePoly( int n, int i, double t );
39  bool ANALYSIS_EXPORT circumcenter( Point3D* p1, Point3D* p2, Point3D* p3, Point3D* result );
41  double ANALYSIS_EXPORT distPointFromLine( Point3D* thepoint, Point3D* p1, Point3D* p2 );
43  int ANALYSIS_EXPORT faculty( int n );
45  bool ANALYSIS_EXPORT inCircle( Point3D* testp, Point3D* p1, Point3D* p2, Point3D* p3 );
47  bool ANALYSIS_EXPORT inDiametral( Point3D* p1, Point3D* p2, Point3D* point );
49  double ANALYSIS_EXPORT leftOf( Point3D* thepoint, Point3D* p1, Point3D* p2 );
51  bool ANALYSIS_EXPORT lineIntersection( Point3D* p1, Point3D* p2, Point3D* p3, Point3D* p4 );
53  bool ANALYSIS_EXPORT lineIntersection( Point3D* p1, Point3D* p2, Point3D* p3, Point3D* p4, Point3D* intersection_point );
55  int ANALYSIS_EXPORT lower( int n, int i );
57  double ANALYSIS_EXPORT max( double x, double y );
59  double ANALYSIS_EXPORT min( double x, double y );
61  double ANALYSIS_EXPORT power( double a, int b );//calculates a power b
63  double ANALYSIS_EXPORT triArea( Point3D* pa, Point3D* pb, Point3D* pc );
65  bool ANALYSIS_EXPORT derVec( const Vector3D* v1, const Vector3D* v2, Vector3D* result, double x, double y );
67  double ANALYSIS_EXPORT crossVec( Point3D* first, Vector3D* vec1, Point3D* second, Vector3D* vec2 );
69  bool ANALYSIS_EXPORT normalLeft( Vector3D* v1, Vector3D* result, double length );
71  bool ANALYSIS_EXPORT normalRight( Vector3D* v1, Vector3D* result, double length );
73  void ANALYSIS_EXPORT normalFromPoints( Point3D* p1, Point3D* p2, Point3D* p3, Vector3D* vec );
75  bool ANALYSIS_EXPORT pointInsideTriangle( double x, double y, Point3D* p1, Point3D* p2, Point3D* p3 );
77  bool ANALYSIS_EXPORT normalMinDistance( Vector3D* tangent, Vector3D* target, Vector3D* result );
79  double ANALYSIS_EXPORT planeTest( Point3D* test, Point3D* pt1, Point3D* pt2, Point3D* pt3 );
81  double ANALYSIS_EXPORT angle( Point3D* p1, Point3D* p2, Point3D* p3, Point3D* p4 );
82 }
83 
84 #endif