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
- 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
- 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)
- 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.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