59 lines
2.6 KiB
Python
59 lines
2.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Export authored aircraft silhouettes; run gen_models.py after editing."""
|
|
import math
|
|
import gen_models as g
|
|
from pilot_models import export
|
|
|
|
|
|
def lancet():
|
|
# Keep the former fuselage length, two X-wing stations and propeller origin.
|
|
p = g.ogive(-16, -10, 2.0, "lancet", 4) + g.oct_z(-10, 20, 2.0, "lancet")
|
|
p += [g.B(-1.2, 5.2, -14, 1.2, 6.4, -9, "bare_lamp"),
|
|
g.B(-0.8, 5.05, -13.4, 0.8, 5.2, -10, "dark_metal"),
|
|
g.B(-0.8, 9.9, -6, 0.8, 10.1, 5, "dark_metal")]
|
|
# Individual short diagonal panels approximate swept wings while keeping the
|
|
# former maximum span. Each piece rotates around its own centre.
|
|
for z0, z1, span in [(-5, 1, 13), (12, 18, 11)]:
|
|
for sign_x in (-1, 1):
|
|
for sign_y in (-1, 1):
|
|
angle = 45 * sign_x * sign_y
|
|
for i in range(4):
|
|
lo, hi = span * i / 4, span * (i + 1) / 4
|
|
mid = (lo + hi) / (2 * math.sqrt(2))
|
|
half = (hi - lo) / 2 + .08
|
|
sweep = (i / 4) * 2.0
|
|
p.append(g.B(sign_x * mid - half, 8 + sign_y * mid - .22, z0 + sweep,
|
|
sign_x * mid + half, 8 + sign_y * mid + .22, z1 - .5 * sweep,
|
|
"lancet", rot=("z", angle)))
|
|
p += g.oct_z(20, 24, 1.5, "dark_metal")
|
|
p += [g.B(-5, 7.85, 24, 5, 8.15, 24.5, "prop"),
|
|
g.B(-.15, 3, 24, .15, 13, 24.5, "prop")]
|
|
return p
|
|
|
|
|
|
def kh101():
|
|
# Retain the existing low body, underbody pod and tail locations. Sweep the
|
|
# deployed wings in short panels and add restrained seams to the housing.
|
|
p = g.ogive(-16, -8, 2.9, "kh101", 4) + g.oct_z(-8, 27, 2.9, "kh101")
|
|
p = [dict(e, **{"from": [e["from"][0], e["from"][1] - .5, e["from"][2]],
|
|
"to": [e["to"][0], e["to"][1] - .5, e["to"][2]]}) for e in p]
|
|
for i in range(6):
|
|
x0 = 2.5 + i * 3
|
|
x1 = min(20.5, x0 + 3.05)
|
|
p += g.both(g.B(x0, 6.9, 2 + i * .65, x1, 7.5, 11 - i * .12,
|
|
"kh101", {"down": "kh101_belly"}))
|
|
p += [g.B(-.4, 10, 20, .4, 16, 28, "kh101")] + g.both(g.B(1.5, 6.9, 22, 8, 7.4, 28, "kh101"))
|
|
p += [g.B(-1.9, 3.2, 12, 1.9, 5.4, 26, "dark_metal"),
|
|
g.B(-1.6, 3.5, 11.4, 1.6, 5.1, 12, "bare_nozzle"),
|
|
g.B(-1.5, 3.6, 26, 1.5, 5, 28, "bare_nozzle"),
|
|
g.B(-1.1, 3.9, 28, 1.1, 4.7, 28.4, "glow_ember"),
|
|
g.B(-1, 10, -2, 1, 10.6, 10, "dark_metal")]
|
|
return p
|
|
|
|
|
|
if __name__ == "__main__":
|
|
for name, make in [("lancet", lancet), ("kh101", kh101)]:
|
|
parts = make()
|
|
export(name, parts)
|
|
print(name, len(parts), "elements")
|