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
import pygame | |
import pygame.freetype | |
import pygame.gfxdraw | |
quadrants = ( | |
(( 0, 0), (+1, -1), (+1, +1)), | |
(( 0, 0), (+1, +1), (-1, +1)), | |
(( 0, 0), (-1, +1), (-1, -1)), | |
(( 0, 0), (-1, -1), (+1, -1))) |
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 <sys/types.h> | |
#include <sys/stat.h> | |
#include <sys/ioctl.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <linux/input.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
#include <math.h> | |
void hsv2rgb(float h, float s, float v, float *rgb) { | |
float c = v * s; | |
float hh = h * 6.0; | |
float x = c * (1.0 - fabsf(fmodf(hh, 2) - 1.)); | |
float m = v - c; | |
int i = (int)hh % 6; | |
rgb[(1 + 2*i)%3] = x + m; |
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
#version 420 | |
uniform mat4 projection_matrix; | |
uniform mat4 model_matrix; | |
void main() { | |
vec4 pos = vec4(0.0, 0.0, 0.0, 1.0); | |
int axis = gl_VertexID >> 3; | |
pos[(axis+0)%3] = (gl_VertexID & 1) >> 0; | |
pos[(axis+1)%3] = (gl_VertexID & 2) >> 1; |
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
% vim:nolist lbr tw=78 expandtab | |
\documentclass[a4paper]{article} | |
\usepackage[utf8]{inputenc} | |
\usepackage[landscape,top=1cm,bottom=1cm,left=1cm,right=1cm]{geometry} | |
\usepackage[tiny]{titlesec} % smaller titles | |
\usepackage{multicol} | |
\usepackage{amsmath} | |
\pagestyle{empty} |
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
% vim:nolist lbr tw=78 expandtab autoindent nocindent | |
\documentclass[a4paper]{minimal} | |
\usepackage[landscape,top=1cm,bottom=1cm,left=1cm,right=1cm]{geometry} | |
\usepackage{tikz} | |
%\usetikzlibrary{decorations.pathreplacing} | |
\everymath{\displaystyle} % set math in display style, not text style (ie. larger) | |
\begin{document} |
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
% vim:nolist lbr tw=78 expandtab autoindent nocindent | |
\documentclass[a4paper]{article} | |
\usepackage[utf8]{inputenc} | |
\usepackage[landscape,top=1cm,bottom=1cm,left=1cm,right=1cm]{geometry} | |
%\usepackage{amsmath} | |
\pagestyle{empty} | |
\setcounter{secnumdepth}{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
r(p,e,f) = p/(1.0 + e * cos(f)) | |
orbit_x(p,e,i,an,argp,f) = \ | |
r(p,e,f) * (\ | |
cos(f) * ((cos(argp) * cos(an)) - (sin(argp) * sin(an) * cos(i))) + \ | |
sin(f) * (-(cos(argp) * sin(an) * cos(i)) - (sin(argp) * cos(an)))) | |
orbit_y(p,e,i,an,argp,f) = \ | |
r(p,e,f) * (\ | |
cos(f) * ((sin(argp) * cos(an) * cos(i)) + (cos(argp) * sin(an))) + \ | |
sin(f) * ((cos(argp) * cos(an) * cos(i)) - (sin(argp) * sin(an)))) |
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
def numerical(): | |
from scipy.integrate import odeint | |
from numpy import array | |
# [position, mass, velocity, mass flow] | |
def acceleration(y, t, v_exhaust=1.0): | |
return array([y[2], y[3], v_exhaust * y[3]/y[1], 0.0]) | |
initial_state = array([0.0, 2.0, 0.0, -1.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
#include <stdbool.h> | |
#include <float.h> | |
#include <math.h> | |
double dot(const double *a, const double *b) { | |
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; | |
} | |
double mag(const double *a) { | |
return sqrt(dot(a, a)); |
NewerOlder