Created
May 26, 2022 11:40
-
-
Save MartinThoma/f78794ee6a64747c20a52b2d7fcdd56a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataclasses import dataclass | |
@dataclass | |
class Point: | |
x: float | |
y: float | |
@dataclass | |
class Line: | |
p1: Point | |
p2: Point | |
def position(self, p: float) -> Point: | |
return Point( | |
self.p1.x + (self.p2.x - self.p1.x) * p, | |
self.p1.y + (self.p2.y - self.p1.y) * p, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment