Skip to main content
`Ctrl`+`K`

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

  A circle is defined by a center point with a radius

      moncircle = Geometrics.Circle(ENUCoords(3.55, 48.2), 3)

  __init__(center, radius)

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

    Draw the circle

  contains(point)

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

    ## Parameters

    point: ENUCoords

      The point to test

    ## Return

    type: bool

  select(track)

    TODO

    ## Parameters

    trackTYPE

      DESCRIPTION.

    ## Returns

    tTYPE

      DESCRIPTION.

  copy()

    TODO

  translate(dx, dy)

    TODO

class tracklib.algo.Geometrics.Rectangle(pmin, pmax)

  A rectangle is defined by two points

      ll = ENUCoords(Xmin, Ymin)
      ur = ENUCoords(Xmax, Ymax)
      bbox = Geometrics.Rectangle(ll, ur)

  __init__(pmin, pmax)

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

    Draw the rectangle

  contains(point)

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

    ## Parameters

    point: ENUCoords

      The point to test

    ## Return

    type: bool

  select(track)

    TODO

    ## Parameters

    trackTYPE

      DESCRIPTION.

    ## Returns

    tTYPE

      DESCRIPTION.

  copy()

    TODO

  translate(dx, dy)

    TODO

  rotate(theta)

    TODO

  scale(h)

    TODO

class tracklib.algo.Geometrics.Polygon(X, Y)

  A polygon is defined by two list of

      ll = ENUCoords(Xmin, Ymin)
      ur = ENUCoords(Xmax, Ymax)
      bbox = Geometrics.Rectangle(ll, ur)

  __init__(X, Y)
  plot(sym='r-')

    TODO

  contains(point)

    TODO

  select(track)

    TODO

    ## Parameters

    trackTYPE

      DESCRIPTION.

    ## Returns

    tTYPE

      DESCRIPTION.

  copy()

    TODO

  translate(dx, dy)

    TODO

  rotate(theta)

    TODO

  scale(h)

    TODO

  area()

    TODO

  centroid()

    ## Returns

    centerarray[2]

      DESCRIPTION.

  isStarShaped()

    TODO

  starShapedRatio(resolution=1, inf=1000.0)

    TODO

  signature()

    TODO

tracklib.algo.Geometrics.boundingShape(track, mode=0)

  TODO

tracklib.algo.Geometrics.__convexHull(T)

  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)

  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)

  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)

  TODO

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

tracklib.algo.Geometrics.__welzl(C)

  Finds minimal bounding circle with Welzl’s algorithm

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

  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)

  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)

  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)

  TODO

tracklib.algo.Geometrics.__mbr(COORDS)

  TODO

tracklib.algo.Geometrics.minimumBoundingRectangle(track)

  TODO