This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.syntax unified | |
.cpu cortex-m4 | |
.thumb | |
// configuration values for STM32F4x | |
// see: http://www.st.com/web/en/resource/technical/document/reference_manual/DM00031020.pdf | |
#define AHB1PERIPH_BASE 0x40020000 | |
#define RCC_BASE AHB1PERIPH_BASE + 0x3800 | |
#define RCC_AHB1_ENR RCC_BASE + 0x30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns sdf-voxel | |
(:require | |
[thi.ng.geom.core :as g] | |
[thi.ng.geom.core.vector :as v :refer [vec3]] | |
[thi.ng.geom.voxel.svo :as svo] | |
[thi.ng.geom.voxel.isosurface :as iso] | |
[thi.ng.geom.mesh.io :as mio] | |
[clojure.java.io :as io])) | |
(defn sd-nested-sphere |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; pretty printed randomly generated reproduction function | |
;; x = position in curr. generation | |
;; y = generation | |
;; gene = value at (x,y) | |
(set-cell | |
x y | |
(if (and (prob (abs-sin (* x (+ 0.70618 (/ y 4.62437))))) | |
(pos? (dist x y 0 (- (sq (>> y 3.39245)))))) | |
(mod (+ (+ gene (sin (* y 0.11592))) | |
(* 0.05011 (+ (gene-at x y -3 0) (gene-at x y 3 0)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; random example program AST | |
;; fixed target threshold 25, fixed rotation 45 deg | |
[[if-target 25 | |
[[mov 15] | |
[mov 15] | |
[mov 17] | |
[turn 45] | |
[mov 17] | |
[turn 45] | |
[turn 45]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; random example program AST (w/ peephole optimization) | |
;; fixed target threshold 25, fixed rotation 45 deg | |
;; unoptimized version: https://gist.github.com/postspectacular/f421037929be75ee7e4e | |
[[if-target 25 | |
[[mov 47] | |
[turn 45] | |
[mov 17] | |
[turn 90]] | |
[[if-target 25 | |
[[mov 10] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns hologp.path | |
(:require | |
[thi.ng.geom.core :as g] | |
[thi.ng.geom.core.vector :as v] | |
[thi.ng.math.core :as m])) | |
(def config | |
{:mov [10 20] | |
:turn [45 45] | |
:if-target {:non-empty 0.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<canvas><script>T=Math;S=T.sin;Q=T.cos;N=(M=75)*2;C=(V=document.all[3]).getContext("2d");a=b=d=1.8;c=.3;setInterval(function(){V.height=300;x=y=i=1e4;a-=1/N;while(--i)C.fillRect((t=x,x=S(a*y)-Q(b*x))*M+N,(y=S(c*t)-Q(d*y))*M+N,1,1)})</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns tjunctions | |
(:require | |
[thi.ng.geom.core :as g] | |
[thi.ng.geom.core.utils :as gu] | |
[thi.ng.geom.line :as l] | |
[thi.ng.geom.gmesh :as gm] | |
[thi.ng.math.core :as m])) | |
(defn- edges-without-v | |
"Takes gmesh and vertex, returns lazyseq of all edges NOT related to v." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static Screen *screen; | |
int main(void) { | |
HAL_Init(); | |
SystemClock_Config(); | |
screen = ct_screen_init(); | |
while (1) { | |
ct_screen_flip_buffers(screen); | |
// put normal drawing code here... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// particle system structs | |
typedef struct { | |
float x,y,z; | |
} Vec3; | |
typedef struct { | |
Vec3 pos; // 12 bytes | |
Vec3 vel; // 12 bytes | |
Vec3 col; // 12 bytes |