From 3c1d56246cd48ea81135e9c7afebaf00b841919c Mon Sep 17 00:00:00 2001 From: "Tammo.Weber" Date: Tue, 6 Jan 2026 14:54:02 +0100 Subject: [PATCH] Liniendarstellung GHA2 --- dashboard.py | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/dashboard.py b/dashboard.py index 0fde7fd..4465d22 100644 --- a/dashboard.py +++ b/dashboard.py @@ -131,23 +131,22 @@ def figure_points(fig, points): )) return fig -def figure_lines(fig, lines): +def figure_lines(fig, line, color): """ :param fig: plotly.graph_objects.Figure - :param lines: Linienliste [((x1,y1,z1), (x2,y2,z2), color)] + :param line: Punktliste [[x1,y1,z1], [x2,y2,z2]] + :param color: Farbe :return: plotly.graph_objects.Figure """ - for (p1, p2, color) in lines: - xline = [p1[0], p2[0]] - yline = [p1[1], p2[1]] - zline = [p1[2], p2[2]] - fig.add_trace(go.Scatter3d( - x=xline, y=yline, z=zline, - mode="lines", - line=dict(width=4, color=color), - showlegend=False - )) + + points = np.array(line, dtype=float) + fig.add_trace(go.Scatter3d( + x=points[:, 0], y=points[:, 1], z=points[:, 2], + mode="lines", + line=dict(width=4, color=color), + name="Strecke", showlegend=False + )) return fig @@ -277,7 +276,7 @@ def update_output(n_clicks, ax, ay, b): if ay >= ax or b >= ay or ax <= 0 or ay <= 0 or b <= 0: return html.Span("Eingabe inkorrekt.", style={"color": "red"}) ell = EllipsoidTriaxial(ax, ay, b) - return f"ex = {round(ell.ex, 6)}, ", f"ey = {round(ell.ey, 6)}, ", f"ee = {round(ell.ee, 6)}" + return f"eₓ = {round(ell.ex, 6)}, ", f"eᵧ = {round(ell.ey, 6)}, ", f"eₑ = {round(ell.ee, 6)}" @app.callback( Output("tabs-GHA-out", "children"), @@ -476,11 +475,17 @@ def calc_and_plot(n1, n2, out2 = [] if "numerisch" in method2: - alpha_1, alpha_2, s12 = gha2_num( + alpha_1, alpha_2, s12, beta_arr, lamb_arr = gha2_num( ell, np.deg2rad(float(beta21)), np.deg2rad(float(lamb21)), np.deg2rad(float(beta22)), np.deg2rad(float(lamb22)) ) + geo_line_num = [] + for beta, lamb in zip(beta_arr, lamb_arr): + point = ell.ell2cart(beta, lamb) + geo_line_num.append(point) + + out2.append( html.Div([ @@ -489,6 +494,7 @@ def calc_and_plot(n1, n2, ]) ) + if "stochastisch" in method2: # stoch a_stoch = "noch nicht implementiert.." @@ -505,7 +511,11 @@ def calc_and_plot(n1, n2, fig = ellipsoid_figure(ell, title="Zweite Hauptaufgabe") fig = figure_constant_lines(fig, ell, "ell") + if "numerisch" in method2: + fig = figure_lines(fig, geo_line_num, "#ff8c00") fig = figure_points(fig, [("P1", p1, "black"), ("P2", p2, "red")]) + + return "", out2, fig