mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
tweak to make the coin stacks more realistic
This commit is contained in:
parent
9b35a5daeb
commit
7ccabd7472
1 changed files with 6 additions and 1 deletions
|
@ -200,7 +200,12 @@ class FlatCoin(UprightCoin):
|
||||||
|
|
||||||
# draw the ridges
|
# draw the ridges
|
||||||
PI = TAU/2
|
PI = TAU/2
|
||||||
ridge_angles = np.arange(PI/self.nb_ridges,PI,PI/self.nb_ridges)
|
dtheta = PI/self.nb_ridges
|
||||||
|
ridge_angles = np.arange(dtheta,PI,dtheta)
|
||||||
|
# add a twist onto each coin
|
||||||
|
ridge_angles += np.random.rand(1) * dtheta
|
||||||
|
# crop the angles that overshoot on either side
|
||||||
|
ridge_angles = ridge_angles[(ridge_angles > 0) * (ridge_angles < PI)]
|
||||||
ridge_positions = 0.5 * 2 * self.radius * np.array([
|
ridge_positions = 0.5 * 2 * self.radius * np.array([
|
||||||
np.cos(theta) for theta in ridge_angles
|
np.cos(theta) for theta in ridge_angles
|
||||||
])
|
])
|
||||||
|
|
Loading…
Add table
Reference in a new issue