Liniendarstellung GHA2

This commit is contained in:
Tammo.Weber
2026-01-06 14:54:02 +01:00
parent 9db63d09fa
commit 3c1d56246c

View File

@@ -131,23 +131,22 @@ def figure_points(fig, points):
)) ))
return fig return fig
def figure_lines(fig, lines): def figure_lines(fig, line, color):
""" """
:param fig: plotly.graph_objects.Figure :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 :return: plotly.graph_objects.Figure
""" """
for (p1, p2, color) in lines:
xline = [p1[0], p2[0]] points = np.array(line, dtype=float)
yline = [p1[1], p2[1]] fig.add_trace(go.Scatter3d(
zline = [p1[2], p2[2]] x=points[:, 0], y=points[:, 1], z=points[:, 2],
fig.add_trace(go.Scatter3d( mode="lines",
x=xline, y=yline, z=zline, line=dict(width=4, color=color),
mode="lines", name="Strecke", showlegend=False
line=dict(width=4, color=color), ))
showlegend=False
))
return fig 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: if ay >= ax or b >= ay or ax <= 0 or ay <= 0 or b <= 0:
return html.Span("Eingabe inkorrekt.", style={"color": "red"}) return html.Span("Eingabe inkorrekt.", style={"color": "red"})
ell = EllipsoidTriaxial(ax, ay, b) 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( @app.callback(
Output("tabs-GHA-out", "children"), Output("tabs-GHA-out", "children"),
@@ -476,11 +475,17 @@ def calc_and_plot(n1, n2,
out2 = [] out2 = []
if "numerisch" in method2: if "numerisch" in method2:
alpha_1, alpha_2, s12 = gha2_num( alpha_1, alpha_2, s12, beta_arr, lamb_arr = gha2_num(
ell, ell,
np.deg2rad(float(beta21)), np.deg2rad(float(lamb21)), np.deg2rad(float(beta21)), np.deg2rad(float(lamb21)),
np.deg2rad(float(beta22)), np.deg2rad(float(lamb22)) 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( out2.append(
html.Div([ html.Div([
@@ -489,6 +494,7 @@ def calc_and_plot(n1, n2,
]) ])
) )
if "stochastisch" in method2: if "stochastisch" in method2:
# stoch # stoch
a_stoch = "noch nicht implementiert.." a_stoch = "noch nicht implementiert.."
@@ -505,7 +511,11 @@ def calc_and_plot(n1, n2,
fig = ellipsoid_figure(ell, title="Zweite Hauptaufgabe") fig = ellipsoid_figure(ell, title="Zweite Hauptaufgabe")
fig = figure_constant_lines(fig, ell, "ell") 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")]) fig = figure_points(fig, [("P1", p1, "black"), ("P2", p2, "red")])
return "", out2, fig return "", out2, fig