neoscore.core.math_helpers

General math helper tools.

neoscore.core.math_helpers.interpolate(line_start: Point, line_end: Point, x: Unit) Unit[source]

Calculate the value of a line defined by two points at a given x pos.

neoscore.core.math_helpers.is_power_of_2(value: int) bool[source]

Check if a number is a power of 2.

neoscore.core.math_helpers.point_angle(point: Point) float[source]

Calculate the angle from the positive X axis to a point in radians.

The returned angle goes positive clockwise and is between pi and -pi.

Combine with the Python stdlib function math.degrees() to get the angle in degrees.

neoscore.core.math_helpers.dist(p1: Tuple[float, float], p2: Tuple[float, float]) float[source]

Find the Euclidean distance between two 2D float tuples.

In the future this function and signature may be modified to support neoscore unit-points as well.