Skip to content

Commit 0c2a8bc

Browse files
AngelOnFiraozkriff
andauthored
N17: polyhedron-ops (#448)
* Polyhedron-ops December content * N17: polyhedron-ops: Style & fmt tweaks * N17: polyhedron: Fix section's position Co-authored-by: Andrey Lesnikov <ozkriff@gmail.com>
1 parent 23ee1ab commit 0c2a8bc

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

content/posts/newsletter-017/index.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,45 @@ _Discussions:
630630
[/r/rust](https://www.reddit.com/r/rust/comments/kkf1jz/kira_game_audio_library_v030_persequence_custom/),
631631
[Twitter](https://twitter.com/tesselode/status/1342878087990685700)_
632632

633+
### [polyhedron-ops]
634+
635+
![polyhedron render](polyhedron.jpg)
636+
_Some brutalist polyhedron; rendered with 3Delight and post processed in Darktable._
637+
638+
[polyhedron-ops] implements the [Conway Polyhedron Operators][polyhedron-wiki]
639+
and their extensions by George W. Hart and others.
640+
641+
It is based on Kit Wallace’s OpenSCAD code.
642+
As OpenSCAD Language is functional it lends itself well
643+
to translation into functional Rust:
644+
645+
```rust
646+
// Conway notation: gapcD
647+
let polyhedron = Polyhedron::dodecahedron()
648+
.chamfer(None, true)
649+
.propellor(None, true)
650+
.ambo(None, true)
651+
.gyro(None, None, true)
652+
.finalize();
653+
// Export as ./polyhedron-gapcD.obj
654+
polyhedron.write_to_obj(&Path::new("."), false);
655+
```
656+
657+
The internal representation uses mesh buffers that need furter preprocessing
658+
before they can be sent to a GPU
659+
but are almost fine to send to an offline renderer, as-is.
660+
661+
Optionally enabled features include:
662+
663+
- Converting a polyhedron [into a bevy Mesh][polyhedron-bevy].
664+
- Sending a polyhedron to an offline renderer via the [nsi] crate.
665+
- Writing data out as Wavefront OBJ.
666+
667+
[polyhedron-ops]: https://github.com/virtualritz/polyhedron-ops
668+
[polyhedron-wiki]: http://en.wikipedia.org/wiki/Conway_polyhedron_notation
669+
[polyhedron-bevy]: https://github.com/virtualritz/polyhedron-ops/blob/76a0c4b83examples/bevy/bevy.rs
670+
[nsi]: https://crates.io/crates/nsi
671+
633672
### [raw-gl-context]
634673

635674
[raw-gl-context] is a cross-platform library for OpenGL context creation which
311 KB
Loading

0 commit comments

Comments
 (0)