const float PI = 3.1415926535897932384626433832795;
const float PI_2 = 1.57079632679489661923;
const float PI_4 = 0.785398163397448309616;
float PHI = (1.0+sqrtf(5.0))/2.0;
This file contains 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
doug:rust-libs doug$ cat junk.rs | |
#![crate_id = "junk#0.1"] | |
use std::libc::c_int; | |
#[no_mangle] | |
pub extern fn dothing(a: c_int, b:c_int) -> c_int { | |
return a + b; | |
} |
Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative
float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
This file contains 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
pub mod cv { | |
extern crate libc; | |
use self::libc::{c_char, c_double, c_int, c_schar, c_void}; | |
#[repr(C)] | |
pub struct HaarClassifierCascade; | |
#[repr(C)] | |
pub struct MemStorage; |
This file contains 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
;you have to re-map the f keys so they work. | |
;Otherwise AHK will just 'wait' for the number key after - if there is non then nothing happens | |
f1::f1 | |
f2::f2 | |
f3::f3 | |
f4::f4 | |
f5::f5 | |
f6::f6 | |
f7::f7 | |
f8::f8 |
This file contains 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
use std::rc::Rc; | |
trait HKT<U> { | |
type C; // Current type | |
type T; // Type with C swapped with U | |
} | |
macro_rules! derive_hkt { | |
($t:ident) => { | |
impl<T, U> HKT<U> for $t<T> { |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <unistd.h> | |
#include <sys/mman.h> | |
#include <sys/stat.h> |
This file contains 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
// cargo-deps: lazy_static | |
#[macro_use] extern crate lazy_static; | |
macro_rules! declare_array { | |
// INTERNAL | |
// last element (proceed to output) | |
(@parse $size:expr, ($val:expr) -> [$($accs:expr),*] $thru:tt) => { | |
declare_array!(@output $size + 1usize, [$($accs,)* $val] $thru); |