Skip to content

Commit

Permalink
Created the CompositeMesh class
Browse files Browse the repository at this point in the history
Created a new class that allows you to combine multiple meshes
  • Loading branch information
JoeBell committed Mar 3, 2025
1 parent b1516ee commit b1a383f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Raytrace/CompositeMesh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import numpy as np
from Raytrace.TriangleMesh import TriangleMesh, Ray

class CompositeMesh(TriangleMesh):
meshes: list[TriangleMesh]
def __init__(self, meshes:list[TriangleMesh]) -> None:
self.meshes = meshes
self.triangles = np.concatenate([mesh.triangles for mesh in self.meshes])
def raytrace(self, ray:Ray) -> float:
distances = [mesh.raytrace(ray) for mesh in self.meshes]
return min(distances, default = np.inf)

0 comments on commit b1a383f

Please sign in to comment.