Files
InvokeAI/invokeai/backend/util/build_line.py
2024-09-20 01:01:37 +00:00

7 lines
263 B
Python

from typing import Callable
def build_line(x1: float, y1: float, x2: float, y2: float) -> Callable[[float], float]:
"""Build a linear function given two points on the line (x1, y1) and (x2, y2)."""
return lambda x: (y2 - y1) / (x2 - x1) * (x - x1) + y1