Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions manim/mobject/geometry/polygram.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,10 @@ class RectangleExample(Scene):
def construct(self):
rect1 = Rectangle(width=4.0, height=2.0, grid_xstep=1.0, grid_ystep=0.5)
rect2 = Rectangle(width=1.0, height=4.0)
rect3 = Rectangle(width=2.0, height=2.0, grid_xstep=1.0, grid_ystep=1.0)
rect3.grid_lines.set_stroke(width=1)
rects = Group(rect1,rect2).arrange(buff=1)
rects = Group(rect1, rect2, rect3).arrange(buff=1)
self.add(rects)
"""

Expand All @@ -618,6 +620,8 @@ def __init__(
self.stretch_to_fit_width(width)
self.stretch_to_fit_height(height)
v = self.get_vertices()
self.grid_lines = VGroup()

if grid_xstep is not None:
from manim.mobject.geometry.line import Line

Expand All @@ -633,7 +637,7 @@ def __init__(
for i in range(1, count)
)
)
self.add(grid)
self.grid_lines.add(grid)
if grid_ystep is not None:
grid_ystep = abs(grid_ystep)
count = int(height / grid_ystep)
Expand All @@ -647,7 +651,10 @@ def __init__(
for i in range(1, count)
)
)
self.add(grid)
self.grid_lines.add(grid)

if self.grid_lines:
self.add(self.grid_lines)


class Square(Rectangle):
Expand Down