mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Fix Line3D
This commit is contained in:
parent
eee4054da8
commit
a0006426cc
1 changed files with 14 additions and 13 deletions
|
@ -75,6 +75,19 @@ class Sphere(ArglessSurface):
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
class Torus(ArglessSurface):
|
||||||
|
CONFIG = {
|
||||||
|
"u_range": (0, TAU),
|
||||||
|
"v_range": (0, TAU),
|
||||||
|
"r1": 3,
|
||||||
|
"r2": 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
def uv_func(self, u, v):
|
||||||
|
P = np.array([math.cos(u), math.sin(u), 0])
|
||||||
|
return (self.r1 - self.r2 * math.cos(v)) * P - math.sin(v) * OUT
|
||||||
|
|
||||||
|
|
||||||
class Cylinder(ArglessSurface):
|
class Cylinder(ArglessSurface):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"height": 2,
|
"height": 2,
|
||||||
|
@ -96,19 +109,6 @@ class Cylinder(ArglessSurface):
|
||||||
return [np.cos(u), np.sin(u), v]
|
return [np.cos(u), np.sin(u), v]
|
||||||
|
|
||||||
|
|
||||||
class Torus(ArglessSurface):
|
|
||||||
CONFIG = {
|
|
||||||
"u_range": (0, TAU),
|
|
||||||
"v_range": (0, TAU),
|
|
||||||
"r1": 3,
|
|
||||||
"r2": 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
def uv_func(self, u, v):
|
|
||||||
P = np.array([math.cos(u), math.sin(u), 0])
|
|
||||||
return (self.r1 - self.r2 * math.cos(v)) * P - math.sin(v) * OUT
|
|
||||||
|
|
||||||
|
|
||||||
class Line3D(Cylinder):
|
class Line3D(Cylinder):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"width": 0.05,
|
"width": 0.05,
|
||||||
|
@ -122,6 +122,7 @@ class Line3D(Cylinder):
|
||||||
radius=self.width / 2,
|
radius=self.width / 2,
|
||||||
axis=axis
|
axis=axis
|
||||||
)
|
)
|
||||||
|
self.shift((start + end) / 2)
|
||||||
|
|
||||||
|
|
||||||
class Disk3D(ArglessSurface):
|
class Disk3D(ArglessSurface):
|
||||||
|
|
Loading…
Add table
Reference in a new issue