(self, name, v=None, vn=None, vt=None, f=None,)
| 2 | |
| 3 | class Mesh: |
| 4 | def __init__(self, name, v=None, vn=None, vt=None, f=None,) -> None: |
| 5 | import math |
| 6 | self.sqrt = math.sqrt |
| 7 | self.sin = lambda x: math.sin(x * math.pi / 180) |
| 8 | self.cos = lambda x: math.cos(x * math.pi / 180) |
| 9 | self.name = name |
| 10 | self.v = [] if v == None else v |
| 11 | self.vn = [] if vn == None else vn |
| 12 | self.vt = [] if vt == None else vt |
| 13 | self.f = [] if f == None else f |
| 14 | if self.v != []: |
| 15 | def relative_v_calculation(v): |
| 16 | return (v[0] - self.center[0], v[1] - self.center[1], v[2] - self.center[2]) |
| 17 | self.center = list(map(sum, (zip(*self.v)))) |
| 18 | self.center = [self.center[i] / len(self.v) for i in range(3)] |
| 19 | self.relative_v = map(relative_v_calculation, self.v) |
| 20 | |
| 21 | |
| 22 | def load_obj(filename, meshes, directory=".") -> dict: |
nothing calls this directly
no outgoing calls
no test coverage detected