addTriangle method
Implementation
void addTriangle(Triangle triangle){
bounds ??= Box3();
bounds!.min.x = Math.min(Math.min(bounds!.min.x, triangle.a.x), Math.min(triangle.b.x, triangle.c.x ));
bounds!.min.y = Math.min(Math.min(bounds!.min.y, triangle.a.y), Math.min(triangle.b.y, triangle.c.y ));
bounds!.min.z = Math.min(Math.min(bounds!.min.z, triangle.a.z), Math.min(triangle.b.z, triangle.c.z ));
bounds!.max.x = Math.max(Math.max(bounds!.max.x, triangle.a.x), Math.max(triangle.b.x, triangle.c.x ));
bounds!.max.y = Math.max(Math.max(bounds!.max.y, triangle.a.y), Math.max(triangle.b.y, triangle.c.y ));
bounds!.max.z = Math.max(Math.max(bounds!.max.z, triangle.a.z), Math.max(triangle.b.z, triangle.c.z ));
triangles.add(triangle);
}