Skip to content

Instantly share code, notes, and snippets.

View tthtlc's full-sized avatar

Peter Teoh tthtlc

View GitHub Profile
@tthtlc
tthtlc / rotating_ellipse_plane.py
Created July 7, 2019 08:35
Rotating ellipse on a plane
import sys
try:
from OpenGL.GLUT import *
from OpenGL.GL import *
from OpenGL.GLU import *
except:
print ''' Error: PyOpenGL not installed properly '''
sys.exit( )
import array
@tthtlc
tthtlc / rotating_hypocycloid.py
Last active July 7, 2019 08:36
Rotating hypocycloid
import pygame
import math
import time
# Initialize the game engine
pygame.init()
# Define the colors we will use in RGB format
black = [ 0, 0, 0]
white = [255,255,255]
@tthtlc
tthtlc / winding_helix3.py
Created July 2, 2019 16:41
coloring differences arising from different periodic flow lines.
# Keywords: Alpha Blending, Textures, Animation, Double Buffer
# most basic winding: just a shift of math.pi away from one another
# compare with surface_linev2.py
# notice that this present does nt differ much from surface_linev22.py
from OpenGL.GL import *
from OpenGL.GLU import *
from math import * # trigonometry
import math
@tthtlc
tthtlc / rotating_coloured_helix.py
Created July 2, 2019 14:18
Rotating coloured helix
# Keywords: Alpha Blending, Textures, Animation, Double Buffer
# most basic winding: just a shift of math.pi away from one another
# compare with surface_linev2.py
# notice that this present does nt differ much from surface_linev22.py
from OpenGL.GL import *
from OpenGL.GLU import *
from math import * # trigonometry
import math
@tthtlc
tthtlc / rotating_sinuating_helix.py
Created July 2, 2019 06:21
Sinusoidal rotating helix
###
# pip install PyOpenGL
# pip install pygame
from OpenGL.GL import *
from OpenGL.GLU import *
from math import * # trigonometry
import math
@tthtlc
tthtlc / rotating_helix.py
Created June 30, 2019 13:43
Creating helical structures
# Keywords: Alpha Blending, Textures, Animation, Double Buffer
# most basic winding: just a shift of math.pi away from one another
# compare with surface_linev2.py
# notice that this present does nt differ much from surface_linev22.py
from OpenGL.GL import *
from OpenGL.GLU import *
from math import * # trigonometry
import math
@tthtlc
tthtlc / mobiusv1.py
Created June 30, 2019 12:42
Implementing Mobius surface
# Keywords: Alpha Blending, Textures, Animation, Double Buffer
# most basic winding: just a shift of math.pi away from one another
# compare with surface_linev2.py
# notice that this present does nt differ much from surface_linev22.py
from OpenGL.GL import *
from OpenGL.GLU import *
from math import * # trigonometry
import math
@tthtlc
tthtlc / ring_of_circle.py
Created June 30, 2019 09:17
Creating a ring of circles.
from OpenGL.GL import *
from OpenGL.GLU import *
from math import * # trigonometry
import math
import pygame # just to get a display
# get an OpenGL surface
@tthtlc
tthtlc / mobius_band.py
Created June 29, 2019 18:06
Implementing the mobius band: the one sided mathematical surface.
# Keywords: Alpha Blending, Textures, Animation, Double Buffer
# most basic winding: just a shift of math.pi away from one another
# compare with surface_linev2.py
# notice that this present does nt differ much from surface_linev22.py
from OpenGL.GL import *
from OpenGL.GLU import *
from math import * # trigonometry
import math
@tthtlc
tthtlc / hexagonv2.py
Created June 29, 2019 14:31
Rotating triangles around a hexagon
import pygame
import math
# Initialize the game engine
pygame.init()
# Define the colors we will use in RGB format
black = [ 0, 0, 0]
white = [255,255,255]
blue = [ 0, 0,255]