/** * @RDE_HEADER@ * Helper functions related to CoordinateTranslation * $Id$ * $HeadURL$ * $Author$ */ #pragma once // Own #include "situation_map_export.h" #include // Qt #include #include // ESRI //---------------------------------------------------------------------------- namespace SituationMap { namespace MathUtils { /** @brief Rotate a 2 dimensional point @param p point to rotate @param center center point of rotation @param sinA sinus of rotation angle @param cosA cosinus of rotation angle */ QPointF SITUATIONMAP_EXPORT rotate(const QPointF &p, const QPointF ¢er, qreal sinA, qreal cosA); /** @brief Rotate a 2 dimensional point @param p point to rotate @param center center point of rotation @param phi rotation angle in rad */ QPointF SITUATIONMAP_EXPORT rotate(const QPointF &p, const QPointF ¢er, qreal phi); /** * @brief Get math angle in radiant from orientation vector * @param oVec orientation vector, must be normalized to length 1 * @return mathematical angle in rad */ qreal SITUATIONMAP_EXPORT getMathAngle(const QPointF &oVec); /** * @brief Get math angle in radiant from sinus and cosinus * @param sinPhi sinus of angle, is equal to y component of orientation vector * @param cosPhi cosinus of angle, is equal to x component of orientation vector * @return mathematical angle in rad */ qreal SITUATIONMAP_EXPORT getMathAngle(qreal sinPhi, qreal cosPhi); double SITUATIONMAP_EXPORT getAngleDegreeNorth(const QPointF &p1, const QPointF &p2); /** * @brief Get North angle from Math angle * @param mathematical orientated angle in degree * @return north (0° = 12h) orientated angle in degree */ qreal SITUATIONMAP_EXPORT getAngleDegree2North(qreal angleDeg); /** * @brief Get North angle from Math angle * @param mathematical orientated angle in degree * @return math (0° = 3h) orientated angle in degree */ qreal SITUATIONMAP_EXPORT getAngleDegree2Math(qreal angleDeg); /** * @brief Get the position on a given line (for positioning a text) * @param p1 startPoint of line * @param p2 endPoint of line * @param position_0_to_1 value from 0.0 up to 1.0. * 0.0 -> 0% -> startPoint * 0.5 -> 50% -> middle between startPoint and endPoint * 1.0 -> 100% -> endPoint * @return position between start and end. */ QPointF SITUATIONMAP_EXPORT getPointOnLine(const QPointF &p1, const QPointF &p2, double position_0_to_1); Point3D SITUATIONMAP_EXPORT getPointOnLine(const Point3D &p1, const Point3D &p2, double position_0_to_1); /** * @brief getCircleSectorPolygon * @param centerPoint [geo coordinates] * @param radius [m] * @param rotationAngleDeg (orientation of segment) * @param centralAngleDeg * @return polygon describing the circle sector */ QPolygonF SITUATIONMAP_EXPORT getCircleSectorPolygon(const QPointF ¢erPoint, qreal radius, double rotationAngleDeg, double centralAngleDeg); /** * @brief Rotate a point around with another point as center. * @param pToBeRotated Point to be rotated * @param center Center * @param angleDegree Angle in degree (clockwise). */ void SITUATIONMAP_EXPORT rotatePoint(QPointF &pToBeRotated, const QPointF ¢er, double angleDegree); QList SITUATIONMAP_EXPORT mineFieldCenterLineToOutline(const QList ¢erLine, double width); } // namespace MathUtils } // namespace SituationMap