2024-04-20 22:27:45 +02:00
|
|
|
from src.object import Object
|
|
|
|
|
from src.vertex import Vertex
|
2024-04-09 17:24:02 +02:00
|
|
|
|
|
|
|
|
class ObjectBuilder:
|
2024-04-20 22:27:45 +02:00
|
|
|
__vertices: list[Vertex]
|
|
|
|
|
__lines: list[(Vertex, Vertex)]
|
2024-04-09 17:24:02 +02:00
|
|
|
|
|
|
|
|
def __init__(self):
|
2024-04-20 22:27:45 +02:00
|
|
|
self.__vertices = []
|
|
|
|
|
self.__lines = []
|
2024-04-09 17:24:02 +02:00
|
|
|
|
|
|
|
|
def add_vertex(self, x: int, y: int, z: int) -> Vertex:
|
|
|
|
|
v = Vertex(x, y, z)
|
2024-04-20 22:27:45 +02:00
|
|
|
self.__vertices.append(v)
|
2024-04-09 17:24:02 +02:00
|
|
|
return v
|
|
|
|
|
|
|
|
|
|
def add_vertices_connection(self, vertex1: Vertex, vertex2: Vertex):
|
2024-04-20 22:27:45 +02:00
|
|
|
self.__lines.append((vertex1, vertex2))
|
2024-04-09 17:24:02 +02:00
|
|
|
|
|
|
|
|
def build(self) -> Object:
|
2024-04-20 22:27:45 +02:00
|
|
|
return Object(self.__vertices, self.__lines)
|