geometry

Base module for geometric abstractions

The geometry module 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.circle_intersect(circle1, circle2, tol=0.0)

Get the intersections of two circles.

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

Parameters:
  • circle1 (tuple[float, float, float]) – first circle

  • circle2 (tuple[float, float, float]) – second circle

  • tol (float) – distance under which two points are considered equal (Default value = 0.0)

Returns:

the intersections of two circles

Return type:

tuple[int] | tuple[int, float] | tuple[int, float, float]

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 abscissa axis

  • ori – origin point (Default value = (0)).

pylinkage.geometry.dist_builtin(point1, point2)

Euclidian distance between two 2D points.

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

Parameters:
  • point1

  • point2

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

Intersection of two arbitrary objects.

The input objects should be points or circles.

Parameters:
  • obj_1 (tuple[float, float] | tuple[float, float, float]) – First point or circle

  • obj_2 (tuple[float, float] | tuple[float, float, float]) – Second point or circle

  • tol (float) – absolute tolerance to use if provided. (Default value = 0.0)

Returns:

The intersection found, if any

Return type:

tuple[float, float] | tuple[float, float, float] | None

pylinkage.geometry.norm(vec)
Parameters:

vec

pylinkage.geometry.sqr_dist(point1, point2)

Square of the distance between two points.

Faster than dist.

Parameters:
  • point1

  • point2