8#include "Kanoop/kanoopcommon.h"
48 static Angle angle(
const QPointF& p1,
const QPointF& vertex,
const QPointF& p2);
56 static double distance(
const QPointF& p1,
const QPointF& p2);
87 static Point getPoint(
const QPointF& from,
double bearing,
double distance);
121 static QPointF
move(
const QPointF& point,
double bearing,
double distance);
130 static QPointF
rotate(
const QPointF& point,
const QPointF& centroid,
double angle);
139 static bool arePointsEqual(
const QPointF& p1,
const QPointF& p2,
int precision = 0);
145 static inline bool isPointLeftOf(
const QPointF& point,
const QPointF& other)
147 return point.x() < other.x();
155 return point.x() > other.x();
161 static inline bool isPointAbove(
const QPointF& point,
const QPointF& other)
163 return point.y() < other.y();
169 static inline bool isPointBelow(
const QPointF& point,
const QPointF& other)
171 return point.y() > other.y();
177 static inline bool isRectLeftOf(
const QRectF& rect,
const QPointF& other)
179 return rect.x() + rect.width() < other.x();
187 return rect.x() > other.x();
193 static inline bool isRectAbove(
const QRectF& rect,
const QPointF& other)
195 return rect.y() + rect.height() < other.y();
201 static inline bool isRectBelow(
const QRectF& rect,
const QPointF& other)
203 return rect.y() > other.y();
209 static inline bool isRectLeftOf(
const QRectF& rect,
const QRectF& other)
211 return other.x() < rect.x();
219 return other.x() > rect.x() + rect.width();
225 static inline bool isRectAbove(
const QRectF& rect,
const QRectF& other)
227 return other.y() < rect.y();
233 static inline bool isRectBelow(
const QRectF& rect,
const QRectF& other)
235 return other.y() > rect.y() + rect.height();
285 static const int Precision = 6;
291 static QString roundedString(
double value,
int precision);
293 static double roundedDouble(
double value,
int precision);
A compass bearing angle measured in degrees, with wraparound arithmetic.
Represents a 2D circle with centre and radius, supporting geometric queries.
Static helper methods for 2D (flat / Cartesian) geometric computations.
static bool isRectAbove(const QRectF &rect, const QRectF &other)
Test whether other is above rect.
static QPointF rotate(const QPointF &point, const QPointF ¢roid, double angle)
Rotate a point around a centroid by an angle.
static bool isRectLeftOf(const QRectF &rect, const QRectF &other)
Test whether other is to the left of rect.
static void getLineABC(const Line &line, double &a, double &b, double &c)
Compute the A, B, C coefficients of the line equation Ax + By + C = 0.
static double angularDifference(const Line &l1, const Line &l2)
Compute the absolute angular difference between two lines.
static double distance(const QPointF &p1, const QPointF &p2)
Compute the Euclidean distance between two points.
static bool isPointLeftOf(const QPointF &point, const QPointF &other)
Test whether point is to the left of other (smaller X).
static QPointF intersection(const Line &l1, const Line &l2)
Compute the intersection point of two lines.
static bool isPointBelow(const QPointF &point, const QPointF &other)
Test whether point is below other (larger Y).
static bool isPointRightOf(const QPointF &point, const QPointF &other)
Test whether point is to the right of other (larger X).
static bool isRectRightOf(const QRectF &rect, const QRectF &other)
Test whether other is to the right of rect.
static bool isPointAbove(const QPointF &point, const QPointF &other)
Test whether point is above other (smaller Y).
static bool isRectBelow(const QRectF &rect, const QPointF &other)
Test whether rect's top edge is below other.
static Angle angle(const Line &l1, const Line &l2)
Compute the angle between two lines as an Angle object.
static Geo::SpatialRelationship relationTo(const QRectF &origin, const QRectF &other)
Determine the spatial relationship between two rectangles.
static bool isInCircle(const QPointF &point, const Circle &circle)
Test whether a point lies within a circle.
static double degrees(double angle)
Convert radians to degrees.
static QPointF move(const QPointF &point, double bearing, double distance)
Move a point by a given bearing and distance.
static Geo::SpatialRelationship relationTo(const QRectF &origin, const QPointF &other)
Determine the spatial relationship of a point relative to a rectangle.
static Geo::SpatialRelationship relationTo(const QPointF &origin, const QPointF &other)
Determine the spatial relationship of a point relative to an origin point.
static double vectorAngle(const Line &l1, const Line &l2)
Compute the signed vector angle between two lines.
static Angle angle(const QPointF &p1, const QPointF &vertex, const QPointF &p2)
Compute the angle at a vertex formed by two rays.
static Geo::SpatialRelationship relationTo(const QPointF &origin, const QRectF &other)
Determine the spatial relationship of a rectangle relative to an origin point.
static bool isRectAbove(const QRectF &rect, const QPointF &other)
Test whether rect's bottom edge is above other.
static double radians(double angle)
Convert degrees to radians.
static QString makePointString(const QPoint &p)
Format an integer point as a comma-separated string.
static bool isRectRightOf(const QRectF &rect, const QPointF &other)
Test whether rect's left edge is right of other.
static QString makePointString(const QPointF &p)
Format a floating-point point as a comma-separated string.
static Point getPoint(const QPointF &from, double bearing, double distance)
Compute a point at a given bearing and distance from a source point.
static bool isRectBelow(const QRectF &rect, const QRectF &other)
Test whether other is below rect.
static bool isRectLeftOf(const QRectF &rect, const QPointF &other)
Test whether rect's right edge is left of other.
static bool arePointsEqual(const QPointF &p1, const QPointF &p2, int precision=0)
Test whether two points are equal within a given precision.
Represents a 2D line segment between two Point endpoints.
A 2D floating-point point extending QPointF with movement and spatial query methods.
SpatialRelationship
Spatial relationship between two geometric objects.