Geometrics#

Class to manage general operations on a track

circle1 = Geometrics.fitCircle(trace2)
circle1.plot()
circle2 = Geometrics.minCircle(trace2)
circle2.plot()
class tracklib.algo.Geometrics.Circle(center, radius)[source]#

A circle is defined by a center point with a radius

moncircle = Geometrics.Circle(ENUCoords(3.55, 48.2), 3)
__init__(center, radius)[source]#

Constructs a circle by defining the center and the radius.

Parameters#

centerCoords

The center of the circle

radiusfloat

The radius of the circle

plot(sym='r-', append=<module 'matplotlib.pyplot' from '/home/marie-dominique/.pyenv/versions/3.9.1/lib/python3.9/site-packages/matplotlib/pyplot.py'>)[source]#

Draw the circle

contains(point)[source]#

Returns true if the point is in the cercle, false otherwise.

Parameters#

point: ENUCoords

The point to test

Return#

type: bool

select(track)[source]#

TODO

Parameters#

trackTYPE

DESCRIPTION.

Returns#

tTYPE

DESCRIPTION.

copy()[source]#

TODO

translate(dx, dy)[source]#

TODO

class tracklib.algo.Geometrics.Rectangle(pmin, pmax)[source]#

A rectangle is defined by two points

ll = ENUCoords(Xmin, Ymin)
ur = ENUCoords(Xmax, Ymax)
bbox = Geometrics.Rectangle(ll, ur)
__init__(pmin, pmax)[source]#

Construct a rectangle from two points.

Parameters#

pminENUCoords

first point, for example the left lower point of the rectangle

pmaxENUCoords

second point, for example the right upper point of the rectangle

plot(sym='r-')[source]#

Draw the rectangle

contains(point)[source]#

Returns true if the point is in the rectangle, false otherwise.

Parameters#

point: ENUCoords

The point to test

Return#

type: bool

select(track)[source]#

TODO

Parameters#

trackTYPE

DESCRIPTION.

Returns#

tTYPE

DESCRIPTION.

copy()[source]#

TODO

translate(dx, dy)[source]#

TODO

rotate(theta)[source]#

TODO

scale(h)[source]#

TODO

class tracklib.algo.Geometrics.Polygon(X, Y)[source]#

A polygon is defined by two list of

ll = ENUCoords(Xmin, Ymin)
ur = ENUCoords(Xmax, Ymax)
bbox = Geometrics.Rectangle(ll, ur)
__init__(X, Y)[source]#
plot(sym='r-')[source]#

TODO

contains(point)[source]#

TODO

select(track)[source]#

TODO

Parameters#

trackTYPE

DESCRIPTION.

Returns#

tTYPE

DESCRIPTION.

copy()[source]#

TODO

translate(dx, dy)[source]#

TODO

rotate(theta)[source]#

TODO

scale(h)[source]#

TODO

area()[source]#

TODO

centroid()[source]#

Returns#

centerarray[2]

DESCRIPTION.

isStarShaped()[source]#

TODO

starShapedRatio(resolution=1, inf=1000.0)[source]#

TODO

signature()[source]#

TODO

tracklib.algo.Geometrics.boundingShape(track, mode=0)[source]#

TODO

tracklib.algo.Geometrics.__convexHull(T)[source]#

TODO

Finds the convex hull of a set of coordinates, returned as a list of x an y coordinates : [x1, y1, x2, y2,…] Computation is performed with Jarvis march algorithm with O(n^2) time complexity. It may be needed to resample track if computation is too long.

tracklib.algo.Geometrics.convexHull(track)[source]#

TODO

Finds the convex hull of a track, returned as a list of x an y coordinates : [x1, y1, x2, y2,…] Computation is performed with Jarvis march algorithm with O(n^2) time complexity. It may be needed to resample track if computation is too long.

tracklib.algo.Geometrics.diameter(track)[source]#

TODO

Finds longest distance between points on track The two selected points are returned in a vector along with the minimal distance : [min_dist, idx_p1, idx_p2]. Exhaustive search in O(n^2) time complexity

tracklib.algo.Geometrics.__circle(p1, p2=None, p3=None)[source]#

TODO

Finds circle through 1, 2 or 3 points Returns Circle(C, R)

tracklib.algo.Geometrics.__welzl(C)[source]#

Finds minimal bounding circle with Welzl’s algorithm

tracklib.algo.Geometrics.plotPolygon(P, color=[1, 0, 0, 1])[source]#

Function to plot a polygon from a vector: R = [x1,y1,x2,y2,x3,y3,…x1,y1] Needs to call plt.show() after this function

tracklib.algo.Geometrics.minCircle(track)[source]#

Finds minimal bounding circle with Welzl’s recursive algorithm in O(n) complexity. Output is given as a list [p, R], where p is a Coords object defining circle center and R is its radius. Due to recursion limits, only tracks with fewer than 800 points can be processed

tracklib.algo.Geometrics.minCircleMatrix(track)[source]#

TODO

Computes matrix of all min circles in a track. M[i,j] gives the radius of the min circle enclosing points in track from obs i to obs j (included)

tracklib.algo.Geometrics.fitCircle(track, iter_max=100, epsilon=1e-10)[source]#

TODO

tracklib.algo.Geometrics.__mbr(COORDS)[source]#

TODO

tracklib.algo.Geometrics.minimumBoundingRectangle(track)[source]#

TODO