Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

util_math.h

Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #ifndef _UTIL_MATH_H
00008 #define _UTIL_MATH_H
00009 
00010 #if defined(_MSC_VER)
00011 #define _USE_MATH_DEFINES
00012 #endif
00013 #include <cmath>
00014 #include <vector>
00015 
00016 #include <QString>
00017 #include <QPolygon>
00018 #include <QList>
00019 #include <QPainterPath>
00020 
00021 #include "scribusapi.h"
00022 
00023 class FPoint;
00024 class FPointArray;
00025 
00026 
00030 bool SCRIBUS_API compareDouble(double a, double b);
00031 FPoint SCRIBUS_API getMaxClipF(FPointArray* Clip);
00032 FPoint SCRIBUS_API getMinClipF(FPointArray* Clip);
00033 inline double SCRIBUS_API xy2Deg(double x, double y);
00034 FPoint SCRIBUS_API projectPointOnLine(FPoint p, QPointF lineStart, QPointF lineEnd);
00035 QPolygon SCRIBUS_API FlattenPath(const FPointArray& ina, QList<uint> &Segs);
00036 QList<QPainterPath> SCRIBUS_API decomposePath(QPainterPath &path);
00037 QPolygon SCRIBUS_API RegularPolygon(double w, double h, uint c, bool star, double factor, double rota);
00038 FPointArray SCRIBUS_API RegularPolygonF(double w, double h, uint c, bool star, double factor, double rota);
00039 uint SCRIBUS_API getDouble(QString in, bool raw);
00040 inline double SCRIBUS_API sind(double);
00041 inline double SCRIBUS_API cosd(double);
00042 inline double SCRIBUS_API square(double);
00043 inline double SCRIBUS_API distance(double, double);
00050 double SCRIBUS_API constrainAngle(double angle, double constrain);
00057 double SCRIBUS_API getRotationFromMatrix(QMatrix& matrix, double def);
00058 
00059 
00060 // IMPLEMENTATION
00061 
00062 inline double square(double x)
00063 {
00064     return x*x;
00065 }
00066 
00067 inline double distance(double x, double y)
00068 {
00069     return sqrt(x*x + y*y);
00070 }
00071 
00072 inline double xy2Deg(double x, double y)
00073 {
00074     return atan2(y,x) * (180.0/M_PI);
00075 }
00076 
00077 inline double sind(double alpha)
00078 {
00079     return sin(alpha / (180.0/M_PI));
00080 }
00081 
00082 inline double cosd(double alpha)
00083 {
00084     return cos(alpha / (180.0/M_PI));
00085 }
00086 
00087 #endif
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.