Skip to content

Commit 80b63cb

Browse files
[Rendering] Add ellipse (#123)
1 parent 61d7c41 commit 80b63cb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

vmas/simulator/rendering.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,10 +521,16 @@ def render_function_util(
521521

522522

523523
def make_circle(radius=10, res=30, filled=True, angle=2 * math.pi):
524+
return make_ellipse(
525+
radius_x=radius, radius_y=radius, res=res, filled=filled, angle=angle
526+
)
527+
528+
529+
def make_ellipse(radius_x=10, radius_y=5, res=30, filled=True, angle=2 * math.pi):
524530
points = []
525531
for i in range(res):
526532
ang = -angle / 2 + angle * i / res
527-
points.append((math.cos(ang) * radius, math.sin(ang) * radius))
533+
points.append((math.cos(ang) * radius_x, math.sin(ang) * radius_y))
528534
if angle % (2 * math.pi) != 0:
529535
points.append((0, 0))
530536
if filled:

0 commit comments

Comments
 (0)