util_math.h File Reference
#include <cmath>#include <vector>#include <QString>#include <QPolygon>#include <QList>#include <QPainterPath>#include "scribusapi.h"


Go to the source code of this file.
Functions | |
| bool SCRIBUS_API | compareDouble (double a, double b) |
| Compare double values by pre-multiplying by 10000 and converting to long if possible. If premultiplication does not allow to store result in a long value, perform a standard comparison. | |
| FPoint SCRIBUS_API | getMaxClipF (FPointArray *Clip) |
| FPoint SCRIBUS_API | getMinClipF (FPointArray *Clip) |
| double SCRIBUS_API | xy2Deg (double x, double y) |
| FPoint SCRIBUS_API | projectPointOnLine (FPoint p, QPointF lineStart, QPointF lineEnd) |
| QPolygon SCRIBUS_API | FlattenPath (const FPointArray &ina, QList< uint > &Segs) |
| QList< QPainterPath > SCRIBUS_API | decomposePath (QPainterPath &path) |
| QPolygon SCRIBUS_API | RegularPolygon (double w, double h, uint c, bool star, double factor, double rota) |
| FPointArray SCRIBUS_API | RegularPolygonF (double w, double h, uint c, bool star, double factor, double rota) |
| uint SCRIBUS_API | getDouble (QString in, bool raw) |
| double SCRIBUS_API | sind (double) |
| double SCRIBUS_API | cosd (double) |
| double SCRIBUS_API | square (double) |
| double SCRIBUS_API | distance (double, double) |
| double SCRIBUS_API | constrainAngle (double angle, double constrain) |
| Constrains an angle of rotation to 45 degree intervals Will make code simpler and reduce interval or provide as a parameter. | |
| double SCRIBUS_API | getRotationFromMatrix (QMatrix &matrix, double def) |
| Get the rotation angle (in radian) from a transformation matrix Will make code simpler and reduce interval or provide as a parameter. | |
Function Documentation
| bool SCRIBUS_API compareDouble | ( | double | a, | |
| double | b | |||
| ) |
Compare double values by pre-multiplying by 10000 and converting to long if possible. If premultiplication does not allow to store result in a long value, perform a standard comparison.
Definition at line 299 of file util_math.cpp.
| double SCRIBUS_API constrainAngle | ( | double | angle, | |
| double | constrain | |||
| ) |
Constrains an angle of rotation to 45 degree intervals Will make code simpler and reduce interval or provide as a parameter.
- Parameters:
-
double angle Angle in degrees double contrain value in degrees
- Return values:
-
double Constrained angle
Definition at line 311 of file util_math.cpp.
Referenced by LineMove::adjustBounds(), LegacyMode::mouseMoveEvent(), and LegacyMode::mouseReleaseEvent().
| double cosd | ( | double | alpha | ) | [inline] |
Definition at line 82 of file util_math.h.
References M_PI.
Referenced by LineMove::setRotation(), and PrefsManager::WritePref().
| QList<QPainterPath> SCRIBUS_API decomposePath | ( | QPainterPath & | path | ) |
Definition at line 169 of file util_math.cpp.
Referenced by ScPageOutput::DrawItem_PathText(), and PageItem_PathText::DrawObj_Item().
| double distance | ( | double | x, | |
| double | y | |||
| ) | [inline] |
Definition at line 67 of file util_math.h.
| QPolygon SCRIBUS_API FlattenPath | ( | const FPointArray & | ina, | |
| QList< uint > & | Segs | |||
| ) |
Definition at line 225 of file util_math.cpp.
References FPointArray::point(), FPointArray::size(), FPoint::x(), and FPoint::y().
Referenced by ScribusDoc::AdjustItemSize(), PageItem::convertClip(), ScribusDoc::convertItemTo(), ScPreview::createPreview(), OODPlug::finishNodeParsing(), Serializer::importCollection(), itemShape(), ScribusDoc::MirrorPolyH(), ScribusDoc::MirrorPolyV(), LegacyMode::mousePressEvent(), CreateMode::mousePressEvent(), NodeEditContext::moveClipPoint(), SVGPlug::parseGroup(), OODPlug::parseGroup(), SVGPlug::parseImage(), OODPlug::parseLine(), EPSPlug::parseOutput(), OODPlug::parsePath(), OODPlug::parsePolygon(), OODPlug::parsePolyline(), AIPlug::processData(), AIPlug::processRaster(), and PageItem::SetFrameShape().
| uint SCRIBUS_API getDouble | ( | QString | in, | |
| bool | raw | |||
| ) |
Definition at line 76 of file util_math.cpp.
Referenced by ScImgDataLoader_PS::parseData(), PSLib::PS_image(), and PSLib::PS_ImageData().
| FPoint SCRIBUS_API getMaxClipF | ( | FPointArray * | Clip | ) |
Definition at line 258 of file util_math.cpp.
References FPointArray::point(), FPoint::setXY(), FPointArray::size(), FPoint::x(), and FPoint::y().
Referenced by ScribusDoc::AdjustItemSize(), StencilReader::createObjects(), WMFImport::finishCmdParsing(), SVGPlug::finishNode(), OODPlug::finishNodeParsing(), FontSample(), ScribusDoc::MirrorPolyH(), ScribusDoc::MirrorPolyV(), LegacyMode::mouseReleaseEvent(), FreehandMode::mouseReleaseEvent(), CreateMode::mouseReleaseEvent(), SVGPlug::parseCircle(), SVGPlug::parseEllipse(), StencilReader::parseGroup(), StencilReader::parseGroupProperties(), OODPlug::parseLine(), EPSPlug::parseOutput(), OODPlug::parsePath(), OODPlug::parsePolygon(), OODPlug::parsePolyline(), SVGPlug::parseRect(), PDFLibCore::PDF_Begin_Doc(), AIPlug::processData(), and ScribusView::TransformPoly().
| FPoint SCRIBUS_API getMinClipF | ( | FPointArray * | Clip | ) |
Definition at line 278 of file util_math.cpp.
References FPointArray::point(), FPoint::setXY(), FPointArray::size(), FPoint::x(), and FPoint::y().
Referenced by ScribusDoc::AdjustItemSize(), StencilReader::createObjects(), ExtImageProps::ExtImageProps(), ScribusDoc::MirrorPolyH(), ScribusDoc::MirrorPolyV(), LegacyMode::mousePressEvent(), BezierMode::mousePressEvent(), LegacyMode::mouseReleaseEvent(), FreehandMode::mouseReleaseEvent(), BezierMode::mouseReleaseEvent(), CreateMode::mouseReleaseEvent(), StencilReader::parseGroup(), StencilReader::parseGroupProperties(), PDFLibCore::PDF_Begin_Doc(), ArrowChooser::rebuildList(), scribus_bezierline(), scribus_polygon(), scribus_polyline(), and ScribusView::TransformPoly().
| double SCRIBUS_API getRotationFromMatrix | ( | QMatrix & | matrix, | |
| double | def | |||
| ) |
Get the rotation angle (in radian) from a transformation matrix Will make code simpler and reduce interval or provide as a parameter.
- Parameters:
-
matrix the transformation matrix def the value that should be return if matrix is not a rotation matrix
- Return values:
-
double the rotation angle
Definition at line 323 of file util_math.cpp.
References value.
Referenced by AIPlug::processData(), and AIPlug::processRaster().
| QPolygon SCRIBUS_API RegularPolygon | ( | double | w, | |
| double | h, | |||
| uint | c, | |||
| bool | star, | |||
| double | factor, | |||
| double | rota | |||
| ) |
Definition at line 111 of file util_math.cpp.
References M_PI.
Referenced by PolygonWidget::UpdatePreView().
| FPointArray SCRIBUS_API RegularPolygonF | ( | double | w, | |
| double | h, | |||
| uint | c, | |||
| bool | star, | |||
| double | factor, | |||
| double | rota | |||
| ) |
Definition at line 140 of file util_math.cpp.
References M_PI, and FPointArray::setPoint().
Referenced by LegacyMode::mousePressEvent(), CreateMode::mousePressEvent(), LegacyMode::mouseReleaseEvent(), and CreateMode::mouseReleaseEvent().
| double sind | ( | double | alpha | ) | [inline] |
| double square | ( | double | x | ) | [inline] |
Definition at line 62 of file util_math.h.
| double xy2Deg | ( | double | x, | |
| double | y | |||
| ) | [inline] |
Definition at line 72 of file util_math.h.
References M_PI.
Referenced by ScPreview::createPreview(), LegacyMode::mouseMoveEvent(), LegacyMode::mousePressEvent(), LegacyMode::mouseReleaseEvent(), ScribusDoc::MoveSizeItem(), LineMove::rotation(), scribus_newline(), and MeasurementsMode::showValues().
