StoryCheckTools/graph/DataType.py

51 lines
999 B
Python
Raw Normal View History

2024-07-30 14:30:59 +00:00
from typing import List
class Pos:
def __init__(self, x: float = 0, y: float = 0):
self.x_pos = x
self.y_pos = y
pass
def make_copy(self) -> 'Pos':
return Pos(self.x_pos, self.y_pos)
class Point:
2024-07-31 02:12:34 +00:00
def __init__(self, name:str):
2024-07-30 14:30:59 +00:00
self.point_name = name
pass
def name(self) -> str:
return self.point_name
def make_copy(self) -> 'Point':
2024-07-31 02:12:34 +00:00
return Point(self.point_name)
2024-07-30 14:30:59 +00:00
class Line:
def __init__(self, p0: Point, p1: Point):
self.point_set = [p0, p1]
pass
def points(self) -> List[Point]:
return self.point_set
def make_copy(self) -> 'Line':
return Line(self.points()[0].make_copy(), self.points()[1].make_copy())
class Arrow(Line):
def __init__(self, start: Point, end: Point):
Line.__init__(self, start, end)
pass
def start_point(self):
return self.point_set[0]
def end_point(self):
return self.point_set[1]
pass