Skip to content

Commit

Permalink
20
Browse files Browse the repository at this point in the history
  • Loading branch information
villares committed Dec 20, 2024
1 parent c20b286 commit bda636b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
Binary file added 2024/sketch_2024_12_20/sketch_2024_12_20.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions 2024/sketch_2024_12_20/sketch_2024_12_20.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Tetrahedron
import py5
from py5_tools import animated_gif
import numpy as np

def setup():
py5.size(600, 600, py5.P3D)
animated_gif('out.gif', duration=0.05,
frame_numbers=range(1, 361, 3))

def draw():
py5.background(0, 0, 100)
py5.translate(py5.width / 2, py5.height / 2, -py5.height)
py5.rotate_y(py5.radians(py5.frame_count))
tetrahdron(300)

def tetrahdron(radius):
a = radius / 3 * 2
vs = np.array([(a, a, a), (-a, -a, a),
(-a, a, -a), ( a, -a, -a)])
sequence = np.array([0, 1, 2, 3, 0, 1, 3, 2, 1])
with py5.begin_shape(py5.TRIANGLE_STRIP):
py5.vertices(vs[sequence])

py5.run_sketch(block=False)
10 changes: 10 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ Here are listed some of the tools I have been using more recently:
2024 \| [<b>2023</b>](2023.md) \| [<b>2022</b>](2022.md) \| [<b>2021</b>](2021.md) \| [<b>2020</b>](2020.md) \| [<b>2019</b>](2019.md) \| [<b>2018</b>](2018.md)


---

### sketch_2024_12_20

![sketch_2024_12_20](https://raw.githubusercontent.com/villares/sketch-a-day/main/2024/sketch_2024_12_20/sketch_2024_12_20.gif)

[sketch_2024_12_20](https://github.com/villares/sketch-a-day/tree/main/2024/sketch_2024_12_20) [[py5](https://py5coding.org/)]

A tetrahedron with #py5 and a bit of #NumPy ... Maybe tomorrow I'll tackle the icosahedron, but if I'm tired, I might do just use the built-in box() for the hexahedron ;)

---

### sketch_2024_12_19
Expand Down

0 comments on commit bda636b

Please sign in to comment.