I am working on a 3d rendering engine using only the standard libraries and tkinter, but I've hit a snag when trying to define a function that merges the class that it is a part of with another instance of the class.
The code
class VertexCloud:
def __init__(self, seed: Vertex = Vertex(Point(0, 0, 0), Point(0, 0, 0))):
vertecies.append(seed)
#...
#merge two vertex clouds
def merge(vc: VertexCloud = VertexCloud(Vertex(Point(0, 0, 0), Point(0, 0, 0)))):
for vertex in vc.verticies:
verticies.append(vertex)
returns this error:
Traceback (most recent call last):
...
File"<Path>/ThreeDFamilies.py", line 126, in VertexCloud
def merge(vc: VertexCloud = VertexCloud(Vertex(Point(0, 0, 0), Point(0, 0, 0)))):
NameError: name 'VertexCloud' is not defined
My only ideas of how to fix this are to either declare the class ahead of time (preferred), or define the function outside of the class. Unfortunately - although I am proficient in other languages - this is my first major project in python, so I don't have a full understanding of how this would work syntactically.
Any help would be much appreciated!