Diagramme in C ++ darstellen

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Diagramme in C ++ darstellen

by Anonymous » 26 Aug 2025, 12:11

Ich habe das folgende Diagramm mit Matplotlib in Python erstellt. Ich habe auch den Code angehängt, den ich verwendet habe.import matplotlib.pyplot as plt
import matplotlib.patches as patches

obs_boundary = [
[0, 0, 10, 600],
[0, 600, 900, 10],
[10, 0, 900, 10],
[900, 10, 10, 600]
]
obs_cir_own = [
[50,500,10],
[100,300,10],
[240,240,10],
[300,400,10],
[190,50,10]

]
obs_cir_opp = [
[700, 420, 10],
[460, 200, 10],
[550, 500, 10],
[670, 70, 10],
[800, 230, 10],
[600,300,10]
]
fig, ax = plt.subplots()

for (ox, oy, w, h) in obs_boundary:
print(ox, oy, w, h)
ax.add_patch(
patches.Rectangle(
(ox, oy), w, h,
edgecolor='black',
facecolor='black',
fill=True
)
)

for (ox, oy,r) in obs_cir_own:
ax.add_patch(
patches.Circle(
(ox, oy), r,
edgecolor='black',
facecolor='green',
fill=True
)
)
for (ox, oy, r) in obs_cir_opp:
ax.add_patch(
patches.Circle(
(ox, oy), r,
edgecolor='black',
facecolor='red',
fill=True
)
)

plt.plot(50,50, "bs", linewidth=30)
plt.plot(870, 550, "ys", linewidth=30)
name='arena'
plt.title(name)
plt.axis("equal")
< /code>
Ich möchte also eine ähnliche Arena mit C ++ implementieren und habe keine Ahnung, wie es geht? Ich habe recherchiert, dass ich wieder etwas über Qtplot erfahren habe. Ich weiß nicht viel über QT. Ist also nur qtplot der einzige Weg oder es gibt einen einfacheren Weg. Bitte sagen Sie mir, wie ich dies in C ++ implementieren kann.

Top