mirror of
https://github.com/3b1b/manim.git
synced 2025-07-29 21:12:35 +08:00
Merge branch 'master' of https://github.com/3b1b/manim
This commit is contained in:
@ -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,
|
||||
}
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -5,6 +5,7 @@ class ThreeDScene(Scene):
|
||||
CONFIG = {
|
||||
"camera_config": {
|
||||
"samples": 4,
|
||||
"anti_alias_width": 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -365,19 +365,19 @@ def earclip_triangulation(verts, ring_ends):
|
||||
]
|
||||
|
||||
def is_in(point, ring_id):
|
||||
return abs(abs(get_winding_number([i-point for i in verts[rings[ring_id]]]))-1)<1e-5
|
||||
return abs(abs(get_winding_number([i - point for i in verts[rings[ring_id]]])) - 1) < 1e-5
|
||||
|
||||
def ring_area(ring_id):
|
||||
ring = rings[ring_id]
|
||||
s = 0
|
||||
for i, j in zip(ring[1:], ring):
|
||||
s += cross2d(verts[i], verts[j])
|
||||
return abs(s)/2
|
||||
return abs(s) / 2
|
||||
|
||||
# Points at the same position may cause problems
|
||||
for i in rings:
|
||||
verts[i[0]] += (verts[i[1]]-verts[i[0]])*1e-6
|
||||
verts[i[-1]] += (verts[i[-2]]-verts[i[-1]])*1e-6
|
||||
verts[i[0]] += (verts[i[1]]-verts[i[0]]) * 1e-6
|
||||
verts[i[-1]] += (verts[i[-2]]-verts[i[-1]]) * 1e-6
|
||||
|
||||
# First, we should know which rings are directly contained in it for each ring
|
||||
|
||||
@ -407,7 +407,7 @@ def earclip_triangulation(verts, ring_ends):
|
||||
res = []
|
||||
|
||||
# Then, we can use earcut for each part
|
||||
used = [False]*len(rings)
|
||||
used = [False] * len(rings)
|
||||
for i in rings_sorted:
|
||||
if used[i]:
|
||||
continue
|
||||
|
Reference in New Issue
Block a user