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


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

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

Ausgabe / output:
Das Volumen beträgt §m V = l*b*h §i = §m nf(V, 1) §o m³
Twice the volume is §m nf(2*V, 1) §o m³

Das Objekt ist §m if (l>b) antwort="länger als breit"; else {antwort = "breiter als lang";} §n§m antwort §o.
The object is rather §m if (h>b) answer="high"; else {answer = "wide";} §n§m answer §o.

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

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

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

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