From a3227dda676e463f9b707c73f73909a68fbf17fa Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Wed, 28 Jul 2021 07:29:43 -0700 Subject: [PATCH 1/6] Small formatting fix --- manimlib/utils/space_ops.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manimlib/utils/space_ops.py b/manimlib/utils/space_ops.py index b24ca4f8..efa98f7a 100644 --- a/manimlib/utils/space_ops.py +++ b/manimlib/utils/space_ops.py @@ -369,8 +369,8 @@ def earclip_triangulation(verts, ring_ends): ] # Points at the same position may cause problems for i in rings: - verts[i[0]] += (verts[i[1]]-verts[i[0]])*5e-6 - verts[i[-1]] += (verts[i[-2]]-verts[i[-1]])*5e-6 + verts[i[0]] += (verts[i[1]] - verts[i[0]]) * 5e-6 + verts[i[-1]] += (verts[i[-2]] - verts[i[-1]]) * 5e-6 attached_rings = rings[:1] detached_rings = rings[1:] loop_connections = dict() From f7bb5c1b8c3d5a6b2ed86d16657eea051a565fe8 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Wed, 28 Jul 2021 07:30:13 -0700 Subject: [PATCH 2/6] If there is multisampling, don't have an antialias width --- manimlib/scene/three_d_scene.py | 1 + 1 file changed, 1 insertion(+) diff --git a/manimlib/scene/three_d_scene.py b/manimlib/scene/three_d_scene.py index 2d29fff8..728d1d37 100644 --- a/manimlib/scene/three_d_scene.py +++ b/manimlib/scene/three_d_scene.py @@ -5,6 +5,7 @@ class ThreeDScene(Scene): CONFIG = { "camera_config": { "samples": 4, + "anti_alias_width": 0, } } From b3ae517a05aec16c324cbc98e2b233b852ad90a8 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Wed, 28 Jul 2021 07:31:10 -0700 Subject: [PATCH 3/6] Take in u_range and v_range as arguments to ParametricSurface --- manimlib/mobject/types/surface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manimlib/mobject/types/surface.py b/manimlib/mobject/types/surface.py index b5e1571e..7ec4621c 100644 --- a/manimlib/mobject/types/surface.py +++ b/manimlib/mobject/types/surface.py @@ -181,9 +181,9 @@ class Surface(Mobject): class ParametricSurface(Surface): - def __init__(self, uv_func, **kwargs): + def __init__(self, uv_func, u_range=(0, 1), v_range=(0, 1), **kwargs): self.passed_uv_func = uv_func - super().__init__(**kwargs) + super().__init__(u_range=u_range, v_range=v_range, **kwargs) def uv_func(self, u, v): return self.passed_uv_func(u, v) From 71f018dfff651ddcd22a72b67b1a6e0f1bd11762 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Wed, 28 Jul 2021 07:31:31 -0700 Subject: [PATCH 4/6] Add TrueDot --- manimlib/mobject/types/dot_cloud.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/manimlib/mobject/types/dot_cloud.py b/manimlib/mobject/types/dot_cloud.py index 82e2b0ca..7557698b 100644 --- a/manimlib/mobject/types/dot_cloud.py +++ b/manimlib/mobject/types/dot_cloud.py @@ -2,11 +2,12 @@ import numpy as np import moderngl from manimlib.constants import GREY_C +from manimlib.constants import ORIGIN from manimlib.mobject.types.point_cloud_mobject import PMobject from manimlib.utils.iterables import resize_preserving_order -DEFAULT_DOT_CLOUD_RADIUS = 0.05 +DEFAULT_DOT_RADIUS = 0.05 DEFAULT_GRID_HEIGHT = 6 DEFAULT_BUFF_RATIO = 0.5 @@ -15,7 +16,7 @@ class DotCloud(PMobject): CONFIG = { "color": GREY_C, "opacity": 1, - "radius": DEFAULT_DOT_CLOUD_RADIUS, + "radius": DEFAULT_DOT_RADIUS, "shader_folder": "true_dot", "render_primitive": moderngl.POINTS, "shader_dtype": [ @@ -106,3 +107,8 @@ class DotCloud(PMobject): self.read_data_to_shader(shader_data, "radius", "radii") self.read_data_to_shader(shader_data, "color", "rgbas") return shader_data + + +class TrueDot(DotCloud): + def __init__(self, center=ORIGIN, radius=DEFAULT_DOT_RADIUS, **kwargs): + super().__init__(points=[center], radius=radius, **kwargs) From 2f5acc6a878a8927ddf5e5f101d9eff16def34b0 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Wed, 28 Jul 2021 07:32:16 -0700 Subject: [PATCH 5/6] Small refactor --- manimlib/mobject/three_dimensions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manimlib/mobject/three_dimensions.py b/manimlib/mobject/three_dimensions.py index 75740ae7..01fa16a1 100644 --- a/manimlib/mobject/three_dimensions.py +++ b/manimlib/mobject/three_dimensions.py @@ -14,7 +14,7 @@ class SurfaceMesh(VGroup): CONFIG = { "resolution": (21, 21), "stroke_width": 1, - "normal_nudge": 1e-2, + "normal_nudge": 1e-3, "depth_test": True, "flat_stroke": False, } @@ -35,7 +35,7 @@ class SurfaceMesh(VGroup): points, du_points, dv_points = uv_surface.get_surface_points_and_nudged_points() normals = uv_surface.get_unit_normals() - nudge = 1e-2 + nudge = self.normal_nudge nudged_points = points + nudge * normals for ui in u_indices: From 17452dcd106eb710c1addf29bce70ca5928ba63c Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Wed, 28 Jul 2021 07:32:45 -0700 Subject: [PATCH 6/6] Changing plane defaults --- manimlib/mobject/coordinate_systems.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manimlib/mobject/coordinate_systems.py b/manimlib/mobject/coordinate_systems.py index f02706b7..a52b2f82 100644 --- a/manimlib/mobject/coordinate_systems.py +++ b/manimlib/mobject/coordinate_systems.py @@ -29,7 +29,7 @@ class CoordinateSystem(): "y_range": np.array([-4.0, 4.0, 1.0]), "width": None, "height": None, - "num_sampled_graph_points_per_tick": 5, + "num_sampled_graph_points_per_tick": 20, } def coords_to_point(self, *coords): @@ -404,7 +404,7 @@ class NumberPlane(Axes): "width": None, # Defaults to a faded version of line_config "faded_line_style": None, - "faded_line_ratio": 1, + "faded_line_ratio": 4, "make_smooth_after_applying_functions": True, }