geometry

Base module for geometric abstractions

The geometry modules provides general geometry functions.

It is used extensively, so each function should be highly optimized.

Created on Wed May 5 17:34:45 2021.

@author: HugoFara

pylinkage.geometry.bounding_box(locus)

Compute the bounding box of a locus.

Parameters

locus (list[tuple[float]]) – A list of point or any iterable with the same structure.

Returns

Bounding box as (y_min, x_max, y_max, x_min).

Return type

tuple[float]

pylinkage.geometry.circle_intersect(circle1, circle2, tol=0.0)

Return the intersections between two circles.

Transcription of a Matt Woodhead program, method provided by Paul Bourke, 1997. http://paulbourke.net/geometry/circlesphere/.

Parameters
  • circle1 (first circle, sequence of (abscisse, ordinate, radius)) –

  • circle2 (second circle, sequence of (abscisse, ordinate, radius)) –

  • tol (distance under which two points are considered equal.) –

pylinkage.geometry.cyl_to_cart(radius, theta, ori=(0, 0))

Convert polar coordinates into cartesian.

Parameters
  • radius (distance from ori) –

  • theta (angle is the angle starting from abscisses axis) –

  • ori (origin point.) –

pylinkage.geometry.dist_builtin(point1, point2)

Euclidian distance between two 2D points.

Legacy built-in unoptimized equivalent of math.dist in Python 3.8.

pylinkage.geometry.intersection(obj_1, obj_2, tol=0.0)

Return intersection between two objects (points or circles).

Return nothing of no intersection. tol: absolute tolerance to use if provided.

pylinkage.geometry.norm(vec)

Return the norm of a 2-dimensional vector.

pylinkage.geometry.sqr_dist(point1, point2)

Square of the distance between two points.

Faster than dist.