Skip to content

Commit 79b4d54

Browse files
author
XorUnison
committed
Added BraceBetweenPoints, adjusted tests
1 parent e8445ea commit 79b4d54

File tree

5 files changed

+46
-1
lines changed

5 files changed

+46
-1
lines changed

manim/mobject/svg/brace.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from ...mobject.svg.tex_mobject import TexMobject
88
from ...mobject.svg.tex_mobject import TextMobject
99
from ...mobject.types.vectorized_mobject import VMobject
10+
from ...mobject.geometry import Line
1011
from ...utils.config_ops import digest_config
1112
from ...utils.space_ops import get_norm
1213

@@ -136,4 +137,9 @@ def copy(self):
136137
class BraceText(BraceLabel):
137138
CONFIG = {
138139
"label_constructor": TextMobject
139-
}
140+
}
141+
142+
143+
class BraceBetweeenPoints(Brace):
144+
def __init__(self,point_1,point_2,**kwargs):
145+
Brace.__init__(self,Line(point_1,point_2),**kwargs)

tests/test_geometry.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,44 @@ def construct(self):
106106
self.play(Animation(a))
107107

108108

109+
class ArcPolygonTest(Scene):
110+
def construct(self):
111+
r3 = np.sqrt(3)
112+
arc_config = {"stroke_width":3,"stroke_color":RED,
113+
"fill_opacity":0.5,"color": GREEN}
114+
pol_config = {"stroke_width":10,"stroke_color":BLUE,
115+
"fill_opacity":1,"color": PURPLE}
116+
arc0=ArcBetweenPoints(np.array([-1,0,0]),
117+
np.array([1,0,0]),radius=2,**arc_config)
118+
arc1=ArcBetweenPoints(np.array([1,0,0]),
119+
np.array([0,r3,0]),radius=2,**arc_config)
120+
arc2=ArcBetweenPoints(np.array([0,r3,0]),
121+
np.array([-1,0,0]),radius=2,**arc_config)
122+
a=ArcPolygon(arc0,arc1,arc2,**pol_config)
123+
self.play(Animation(a))
124+
125+
126+
class TilingTest(Scene):
127+
def construct(self):
128+
a=Tiling(Square(),
129+
[[Mobject.shift,[2.1,0,0]]],
130+
[[Mobject.shift,[0,2.1,0]]],
131+
range(-1,1),
132+
range(-1,1))
133+
self.play(Animation(a))
134+
135+
136+
class GraphTest(Scene):
137+
def construct(self):
138+
g = {0: [[0,0,0], [[1,{"angle": 2}], [2,{"color": WHITE}]], {"color": BLUE}],
139+
1: [[1,0,0], [0, 2], {"color": GRAY}],
140+
2: [[0,1,0], [0, 1], {"color": PINK}]}
141+
K3 = Graph(g,vertex_config={"radius": 0.2,"fill_opacity": 1},
142+
edge_config={"stroke_width": 5,"color": RED})
143+
K3v = K3.vertices
144+
K3e = K3.edges
145+
self.play(Animation(K3e),Animation(K3v))
146+
147+
109148
def test_scenes():
110149
utils_test_scenes(get_scenes_to_test(__name__), "geometry")
1.56 MB
Binary file not shown.
1.56 MB
Binary file not shown.
1.56 MB
Binary file not shown.

0 commit comments

Comments
 (0)