LeitLightLightLeitLeidLite/test.py

42 lines
1.4 KiB
Python
Raw Normal View History

2025-02-11 21:48:13 +01:00
#!/usr/bin/env python3
import LeitLightLightLeitLeidLite as l6
rows = l6.rows
# Export 3D model of physical arrangement
sourceStrips = l6.getSourceStrips(rows)
print(sourceStrips)
strips = l6.bakeStrips(sourceStrips)
obj = l6.generateObj(strips)
open("/tmp/strips.obj", "w").write(obj)
obj = l6.generateObj(strips, True)
open("/tmp/strips-bounds.obj", "w").write(obj)
# From behind of plane to above plane
print(l6.debugStrip(l6.clipStripAgainstPlane(l6.testStrip((-10, 0, 0), (10, 0, 0), 21), (0, 0, 0), (1, 0, 0))))
# From above of plane to behind plane
print(l6.debugStrip(l6.clipStripAgainstPlane(l6.testStrip((10, 0, 0), (-10, 0, 0), 21), (0, 0, 0), (1, 0, 0))))
# Parallel above of plane
print(l6.debugStrip(l6.clipStripAgainstPlane(l6.testStrip((10, -10, 0), (10, 10, 0), 21), (0, 0, 0), (1, 0, 0))))
# Parallel behind of plane
print(l6.debugStrip(l6.clipStripAgainstPlane(l6.testStrip((-10, -10, 0), (-10, 10, 0), 21), (0, 0, 0), (1, 0, 0))))
stripsXp = l6.clipStripsAgainstPlane(strips, (100, 0, 0), (1, 0, 0))
obj = l6.generateObj(stripsXp)
open("/tmp/strips-xp.obj", "w").write(obj)
stripsYp = l6.clipStripsAgainstPlane(strips, (0, 50, 0), (0, 1, 0))
obj = l6.generateObj(stripsYp)
open("/tmp/strips-yp.obj", "w").write(obj)
stripsAabb = l6.clipStripsAgainstAabb(strips, (80, 60/2, -100), (120, 140/2, +100))
obj = l6.generateObj(stripsAabb)
open("/tmp/strips-aabb.obj", "w").write(obj)