Skip to content

Instantly share code, notes, and snippets.

View andsve's full-sized avatar
🍎
Coding

Sven Andersson andsve

🍎
Coding
View GitHub Profile
float control_points[7*7*3];
for (int i = 0; i < n->numpoints; i++) {
for (int a = 0; a < 7; a+=1) {
float angle = (float)a/7.0f * 2 * PI;
control_points[i*7*7+a*3] = n->p[i+1].x*cos(angle);
control_points[i*7*7+a*3+1] = n->p[i+1].y;
control_points[i*7*7+a*3+2] = n->p[i+1].x*sin(angle));
}
}
float control_points[7*7*3];
for (int i = 0; i < (n->numpoints); i++) {
for (int a = 0; a < 7; a+=1) {
float angle = (float)a/7.0f * 2 * PI;
control_points[i*7*7+a*3] = n->p[i+1].x*cos(angle);
control_points[i*7*7+a*3+1] = n->p[i+1].y;
control_points[i*7*7+a*3+2] = n->p[i+1].x*sin(angle);
}
}
R T G M P D F A L H B U I X K O J S Z W N Y Q
-------------------------------------------------------------------------
R | 2 1 3 5 1 4 1 2 1 1 1 1 1 1
T | 4 1 2 8 2 2 1 2 1
G | 2 4 1 3 1 1 8 2 1 1
M | 1 3 1 1 7 1 1 1 2
P | 4 2 1 2 1 1 1 1 1 1 1 1 1
D | 4 1 3 1 1 3 1 1 1 1
F | 2 2 4 2 1 1 2 1
A | 5 2 2 2 1
# >> ones i ni eo a e idsorsah e totristhria nats idaseahehrndotaorth ids thei rnid nrt es et eotsaota th theoat neti oes e si ids ise th esrnar id a e idsi h t aserreona ehineotrartihth t nrth iherne ah se idr a esah ri a iah r ts e rneihed thrneirnes trnods stoth e restr
# >> iser o so ei a e o rinrah e titnorthnoa satr o areahehns itainth o r theo nso snt er et eitraita th theiat seto ier e ro o r ore th ernsan o a e o ro h t arenneisa ehoseitnantohth t snth ohense ah re o n a erah no a oah n tr e nseohe thnseonser tnsi r rtith e nertn
Task 2A:
X = 12
x = 9
Since: 18^9 % 23 = 12
Task 2B:
m = 16
X = 12
k = 5
void main (void)
{
float depth = texture2D(tex_depth, gl_TexCoord[0].st).r * 2.0 - 1.0;
vec3 norm = texture2D(tex_norm, gl_TexCoord[0].st).xyz * 2.0 - 1.0;
//norm = normalize(norm); // no need?
vec4 ambient = texture2D(tex_motion, gl_TexCoord[0].st); // currently holds ambient colors
// will be used for velocity in future
// Viewport position at this pixel in the range -1 to 1.
vec4 projection_pos = vec4(gl_TexCoord[0].st * 2.0 - 1.0, depth, 1.0);
void draw_geometry_pass(void)
{
glViewport(0,0,window_width,window_hight);
camera->updateProjection();
camera->updateModelview();
// Get projection matrix, and create inverse for DF pass 2.
glGetFloatv(GL_MODELVIEW_MATRIX, matrix_modelview);
glGetFloatv(GL_PROJECTION_MATRIX, matrix_projection);
def read_file(filename):
v = []
w = []
capacity = 0
f = open(filename)
for line in f:
if line.startswith("capacity="):
capacity = int(line[9:])
else:
v_, w_ = (eval(line))
@andsve
andsve / bot.lua
Created August 16, 2010 21:58
Auto updating IRC Bot written in Lua (using luasockets)
local socket = require("socket")
function create_bot(nick, channels)
local bot = {nick = nick, -- nickname of bot
firstresponse = false, -- got any data?
connection_ok = false,
channels = channels
}
function bot:connect(serv, port)