#! mavscript-beanshell TEMPLATE.txt
# oder / or
#! mavscript --beanshell --init lib/init.bsh TEMPLATE.txt


mavscript-beanshell
-------------------

Eingabe / input:
Länge / length l = 10.30 m
Breite / width b =  2.37 m
Höhe / hight   h =  4.80 m

Ausgabe / output:
Das Volumen beträgt V = l*b*h = 117.2 m³
Twice the volume is 234.3 m³

Das Objekt ist länger als breit.
The object is rather high.

Ein Würfel mit dem selben Volumen 117 m³ hat die Seitenlänge
A cube of that volume has the side length
λ = pow(V, 1./3.) = 4.893379925822716 ≈ 4.89 m.

# Anmerkungen / Notes
# -------------------
# Für die Plots wird jmathplot verwendet.
# The plots are done by jmathplot.

# 2D
plot2D = new Plot2DPanel()
double[] x = {0, l, l, 0, 0}
double[] y = {0, 0, b, b, 0}
plot2D.addLinePlot("Grundriss (verzogen) / Top view (distorted)", BLUE, x, y)
plot2D.addLegend("NORTH")
double[] axismin = {0, 0}; double[] axismax = {15, 5};
plot2D.setFixedBounds(axismin, axismax)
toPNG(plot2D, "out-3-graph2D.png")

# 3D
plot3D = new Plot3DPanel()
double[] zinf = {0, 0, 0, 0, 0}
double[] zsup = {h, h, h, h, h}
plot3D.addLinePlot("sup", RED, x, y, zsup)
plot3D.addLinePlot("inf", BLUE, x, y, zinf)
double[][] vertLine1 = {{0,0,0}, {0,0,h}}; plot3D.addLinePlot("", YELLOW, vertLine1)
double[][] vertLine2 = {{l,0,0}, {l,0,h}}; plot3D.addLinePlot("", YELLOW, vertLine2)
double[][] vertLine3 = {{l,b,0}, {l,b,h}}; plot3D.addLinePlot("", YELLOW, vertLine3)
double[][] vertLine4 = {{0,b,0}, {0,b,h}}; plot3D.addLinePlot("", YELLOW, vertLine4)
toPNG(plot3D, "out-3-graph3D.png")