diff --git a/manimlib/mobject/svg/svg_mobject.py b/manimlib/mobject/svg/svg_mobject.py index d140dd19..cf921085 100644 --- a/manimlib/mobject/svg/svg_mobject.py +++ b/manimlib/mobject/svg/svg_mobject.py @@ -74,6 +74,7 @@ class SVGMobject(VMobject): super().__init__(**kwargs ) self.init_svg_mobject() + self.ensure_positive_orientation() # Rather than passing style into super().__init__ # do it after svg has been taken in @@ -320,10 +321,6 @@ class VMobjectFromSVGPath(VMobject): self.set_points(self.get_points_without_null_curves()) # So triangulation doesn't get messed up self.subdivide_intersections() - # Always default to orienting outward, account - # for the fact that this will get flipped in SVG.__init__ - if self.get_unit_normal()[2] > 0: - self.reverse_points() # Save for future use PATH_TO_POINTS[path_string] = self.get_points().copy() else: diff --git a/manimlib/mobject/types/vectorized_mobject.py b/manimlib/mobject/types/vectorized_mobject.py index 2260fc2e..01304556 100644 --- a/manimlib/mobject/types/vectorized_mobject.py +++ b/manimlib/mobject/types/vectorized_mobject.py @@ -827,6 +827,12 @@ class VMobject(Mobject): ) return normal + def ensure_positive_orientation(self, recurse=True): + for mob in self.get_family(recurse): + if mob.get_unit_normal()[2] < 0: + mob.reverse_points() + return self + # Alignment def align_points(self, vmobject: VMobject): winding = self._use_winding_fill and vmobject._use_winding_fill