pal::GeomFunction class

Contents

Public static functions

static auto computeLineIntersection(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double* x, double* y) -> bool
Compute the point where two lines intersect.
static auto containsCandidate(const GEOSPreparedGeometry* geom, double x, double y, double width, double height, double alpha) -> bool
Returns true if a GEOS prepared geometry totally contains a label candidate.
static auto convexHullId(int* id, const double* x, const double* y, int n, int*& cHull) -> int
Compute the convex hull in O(n·log(n))
static auto isSegIntersects(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) -> bool
Returns true if the two segments intersect.
static auto reorderPolygon(int nbPoints, double* x, double* y) -> int
Reorder points to have cross prod ((x,y)[i], (x,y)[i+1), point) > 0 when point is outside.

Function documentation

static bool pal::GeomFunction::computeLineIntersection(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double* x, double* y)

Compute the point where two lines intersect.

Returns true if the lines intersect, or false if the lines are parallel

static bool pal::GeomFunction::containsCandidate(const GEOSPreparedGeometry* geom, double x, double y, double width, double height, double alpha)

Returns true if a GEOS prepared geometry totally contains a label candidate.

Parameters
geom GEOS prepared geometry
x candidate x
y candidate y
width candidate width
height candidate height
alpha candidate angle
Returns true if candidate is totally contained

static int pal::GeomFunction::convexHullId(int* id, const double* x, const double* y, int n, int*& cHull)

Compute the convex hull in O(n·log(n))

Parameters
id set of point (i.e. point no 0 is (x,y) = x[id[0]],y[id[0]])
x x coordinates
y y coordinates
n Size of subset (vector id)
cHull returns the point id (id of id's vector...) whom are parts of the convex hull
Returns convexHull's size