99 lines
3.0 KiB
Python
99 lines
3.0 KiB
Python
|
|
from matrix import Vector, Matrix, pi
|
|
|
|
hull_length = 559 - 18
|
|
y_xlate = -18 - (559-18)/2
|
|
hull_port_side = [
|
|
Vector(80, 18),
|
|
Vector(71, 21),
|
|
Vector(60, 27),
|
|
Vector(54, 34),
|
|
Vector(28, 120),
|
|
Vector(14, 180),
|
|
Vector(9, 218),
|
|
Vector(7, 261),
|
|
Vector(8, 288),
|
|
Vector(11, 328),
|
|
Vector(18, 367),
|
|
Vector(29, 414),
|
|
Vector(51, 479),
|
|
Vector(78, 542),
|
|
Vector(85, 559)
|
|
]
|
|
|
|
hull_port_side = Vector(-86, y_xlate).translate(hull_port_side)
|
|
hull_starboard_side = Matrix(-1, 0, 0, 1).multiply(hull_port_side)
|
|
hull_starboard_side.reverse()
|
|
hull = hull_port_side + hull_starboard_side
|
|
|
|
hull_detail_port_side = [
|
|
Vector(54, 34),
|
|
Vector(65, 32),
|
|
Vector(76, 30)
|
|
]
|
|
hull_detail_port_side = Vector(-86, y_xlate).translate(hull_detail_port_side)
|
|
hull_detail_starboard_side = Matrix(-1, 0, 0, 1).multiply(hull_detail_port_side)
|
|
hull_detail_starboard_side.reverse()
|
|
hull_detail = hull_detail_port_side + hull_detail_starboard_side
|
|
|
|
stick_port_side = [
|
|
Vector(86, 77),
|
|
Vector(84, 81),
|
|
Vector(85, 85),
|
|
Vector(86, 133)
|
|
]
|
|
stick_port_side = Vector(-86, y_xlate).translate(stick_port_side)
|
|
stick_starboard_side = Matrix(-1, 0, 0, 1).multiply(stick_port_side)
|
|
stick_starboard_side.reverse()
|
|
stick = stick_port_side + stick_starboard_side[1:-1]
|
|
|
|
cockpit_port_side = [
|
|
Vector(84, 90),
|
|
Vector(59, 89),
|
|
Vector(52, 92),
|
|
Vector(48, 99),
|
|
Vector(44, 113),
|
|
Vector(40, 139),
|
|
Vector(35, 203)
|
|
]
|
|
cockpit_port_side = Vector(-86, y_xlate).translate(cockpit_port_side)
|
|
cockpit_starboard_side = Matrix(-1, 0, 0, 1).multiply(cockpit_port_side)
|
|
cockpit_starboard_side.reverse()
|
|
cockpit = cockpit_port_side + cockpit_starboard_side
|
|
|
|
doghouse_port_side = [
|
|
Vector(37, 203),
|
|
Vector(37, 277),
|
|
Vector(40, 317),
|
|
Vector(46, 356),
|
|
Vector(55, 393),
|
|
Vector(66, 431),
|
|
Vector(68, 435),
|
|
Vector(73, 437),
|
|
Vector(80, 438)
|
|
]
|
|
doghouse_port_side = Vector(-86, y_xlate).translate(doghouse_port_side)
|
|
doghouse_starboard_side = Matrix(-1, 0, 0, 1).multiply(doghouse_port_side)
|
|
doghouse_starboard_side.reverse()
|
|
doghouse = doghouse_port_side + doghouse_starboard_side
|
|
|
|
scale = Matrix.scale(0.8/hull_length)
|
|
|
|
print("val ship_color=Color(0x80, 0x85, 0x88)")
|
|
|
|
ship = scale.multiply(hull + hull_detail + stick + cockpit + doghouse)
|
|
hull_trace = list(range(0, len(hull))) + [ 0 ]
|
|
hull_detail_trace = list(map(lambda x : x + len(hull), range(0, len(hull_detail))))
|
|
stick_trace = list(map(lambda x: x + len(hull) + len(hull_detail), list(range(0, len(stick))) + [0]))
|
|
cockpit_trace = list(map(lambda x: x + len(hull) + len(hull_detail) + len(stick),
|
|
list(range(0, len(cockpit))) + [ 0 ]))
|
|
doghouse_trace = list(map(lambda x: x + len(hull) + len(hull_detail) + len(stick) + len(cockpit),
|
|
list(range(0, len(doghouse)))))
|
|
traces = [hull_trace, hull_detail_trace, stick_trace, cockpit_trace, doghouse_trace]
|
|
|
|
print("val ship = Design(listOf({}), listOf({}))".format(
|
|
", ".join(map(lambda v: "Vector({}F, {}F)".format(v.x, v.y), ship)),
|
|
",\n ".join(map(lambda t: "Design.Trace(listOf({}), 2.0F, ship_color)".format(
|
|
", ".join(map(str, t))), traces))
|
|
))
|