glc_geomtools.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  http://glc-lib.sourceforge.net
00006 
00007  GLC-lib is free software; you can redistribute it and/or modify
00008  it under the terms of the GNU Lesser General Public License as published by
00009  the Free Software Foundation; either version 3 of the License, or
00010  (at your option) any later version.
00011 
00012  GLC-lib is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU Lesser General Public License for more details.
00016 
00017  You should have received a copy of the GNU Lesser General Public License
00018  along with GLC-lib; if not, write to the Free Software
00019  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021 *****************************************************************************/
00022 
00024 
00025 #ifndef GLC_GEOMTOOLS_H_
00026 #define GLC_GEOMTOOLS_H_
00027 
00028 #include <QVector>
00029 #include <QList>
00030 #include <QPointF>
00031 
00032 #include "glc_vector3d.h"
00033 #include "glc_line3d.h"
00034 #include "glc_plane.h"
00035 
00036 #include "../geometry/glc_mesh.h"
00037 
00038 #include "../glc_config.h"
00039 
00040 namespace glc
00041 {
00042         const double defaultPrecision= 0.01;
00043         extern double comparedPrecision;
00045 
00047 
00048 
00049         GLC_LIB_EXPORT bool polygon2DIsConvex(const QList<GLC_Point2d>& vertices);
00050 
00052         GLC_LIB_EXPORT bool polygonIsConvex(QList<GLuint>* pIndexList, const QList<float>& bulkList);
00053 
00055 
00059         GLC_LIB_EXPORT QVector<GLC_Point2d> findIntersection(const GLC_Point2d&, const GLC_Point2d&, const GLC_Point2d&, const GLC_Point2d&);
00060 
00062         GLC_LIB_EXPORT bool isIntersected(const GLC_Point2d&, const GLC_Point2d&, const GLC_Point2d&, const GLC_Point2d&);
00063 
00065         GLC_LIB_EXPORT bool isIntersectedRaySegment(const GLC_Point2d&, const GLC_Vector2d&, const GLC_Point2d&, const GLC_Point2d&);
00066 
00068 
00072         GLC_LIB_EXPORT QVector<double> findIntersection(const double&, const double&, const double&, const double&);
00073 
00075         GLC_LIB_EXPORT bool segmentInCone(const GLC_Point2d&, const GLC_Point2d&, const GLC_Point2d&, const GLC_Point2d&);
00076 
00078         GLC_LIB_EXPORT bool isDiagonal(const QList<GLC_Point2d>&, const int, const int);
00079 
00081         GLC_LIB_EXPORT void triangulate(QList<GLC_Point2d>&, QList<int>&, QList<int>&);
00082 
00084         GLC_LIB_EXPORT bool isCounterclockwiseOrdered(const QList<GLC_Point2d>&);
00085 
00087 
00088         GLC_LIB_EXPORT void triangulatePolygon(QList<GLuint>*, const QList<float>&);
00089 
00091 
00093         GLC_LIB_EXPORT bool lineIntersectPlane(const GLC_Line3d& line, const GLC_Plane& plane, GLC_Point3d* pPoint);
00094 
00096         GLC_LIB_EXPORT GLC_Point3d project(const GLC_Point3d& point, const GLC_Line3d& line);
00097 
00099         inline GLC_Point3d midPoint(const GLC_Point3d& point1, const GLC_Point3d point2)
00100         {return point1 + (point2 - point1) * 0.5;}
00101 
00103         inline GLC_Vector2d perpVector(const GLC_Vector2d& vect)
00104         {return GLC_Vector2d(-vect.getY(), vect.getX());}
00105 
00107         GLC_LIB_EXPORT double pointLineDistance(const GLC_Point3d& point, const GLC_Line3d& line);
00108 
00110         GLC_LIB_EXPORT bool pointsAreCollinear(const GLC_Point3d& p1, const GLC_Point3d& p2, const GLC_Point3d& p3);
00111 
00112         GLC_LIB_EXPORT bool compare(double p1, double p2);
00113 
00114         GLC_LIB_EXPORT bool compareAngle(double p1, double p2);
00115 
00116         GLC_LIB_EXPORT bool compare(const GLC_Vector3d& v1, const GLC_Vector3d& v2);
00117 
00118         GLC_LIB_EXPORT bool compare(const GLC_Vector2d& v1, const GLC_Vector2d& v2);
00119 
00120         GLC_LIB_EXPORT bool compare(const QPointF& v1, const QPointF& v2);
00121 
00123         GLC_LIB_EXPORT bool pointInPolygon(const GLC_Point2d& point, const QList<GLC_Point2d>& polygon);
00124 
00126         GLC_LIB_EXPORT double zeroTo2PIAngle(double angle);
00127 
00129 
00130 };
00131 
00132 #endif /*GLC_GEOMTOOLS_H_*/

SourceForge.net Logo

©2005-2011 Laurent Ribon