mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-01 08:25:16 -05:00
7 lines
263 B
Python
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
|