midpoint

Contents

midpoint#

zeroheliumkit.src.utils.midpoint(p1: Point, p2: Point, alpha: float = 0.5) Point[source]#

Calculates the midpoint between two points.

Parameters:
  • p1 (Point) – The first point.

  • p2 (Point) – The second point.

  • alpha (float, optional) – The weight of the ‘mid’ point in the calculation. Defaults to 0.5.

Returns:

The midpoint between p1 and p2, weighted by alpha.

Return type:

Point

Example

>>> p1 = Point(0, 0)
>>> p2 = Point(2, 4)
>>> result = midpoint(p1, p2)
>>> print(result)
    POINT (1.0 2.0)