def __init__(self): self.width = 400 self.height = 400 self.angle = 90.0 self.stepSizeX = 5 self.stepSizeY = 5 self.pressed = False self.rows = 10 self.cols = 10 self.M = makeTopoMap.get_matrix(seed=331, rows=self.rows, cols=self.cols, delta=3, maxval=20) #self.M = [[1,3,1], # [0,0,0], # [1,3,1]] self.t = 0.5 self.ULX = -(self.rows//2) self.ULY = self.cols//2 print(self.M) glutInit(sys.argv) glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH) #glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GLUT_DEPTH) glutInitWindowPosition(100,50) glutInitWindowSize(self.width, self.height) glutCreateWindow("ex6.py") glutDisplayFunc(self.display) glMatrixMode(GL_PROJECTION) glLoadIdentity() glFrustum(-5.0, 5.0, -5.0, 5.0, 5.0, 100.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() glEnable(GL_DEPTH_TEST) glutKeyboardFunc(self.keyboard) glutSpecialFunc(self.keyboardSpecial) glutMouseFunc(self.mouse) glutMotionFunc(self.motion) glutMainLoop()
def __init__(self): self.width = 400 self.height = 400 self.angleX = 90.0 self.angleY = 0.0 self.cameraInitX = 0 self.cameraInitY = 0 self.angle = 90.0 self.stepSizeX = 5 self.stepSizeY = 5 self.buttonDown = False self.M = makeTopoMap.get_matrix(rows=10, cols=10, seed=1117, maxval=8) self.maxval = 8.0 #self.M = [[1,3,1], # [0,0,0], # [1,3,1]] self.t = 6.5 self.ULX = -5 self.ULY = 5 print(self.M) glutInit(sys.argv) glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH) #glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GLUT_DEPTH) glutInitWindowPosition(100, 50) glutInitWindowSize(self.width, self.height) glutCreateWindow("ex6.py") glutDisplayFunc(self.display) glMatrixMode(GL_PROJECTION) glLoadIdentity() glFrustum(-5.0, 5.0, -5.0, 5.0, 5.0, 100.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() glEnable(GL_DEPTH_TEST) glutKeyboardFunc(self.keyboard) glutSpecialFunc(self.keyboardSpecial) glutMouseFunc(self.mouse) glutMotionFunc(self.motion) glutMainLoop()
def __init__(self): self.width = 800 self.height = 800 self.timeStep = 0 self.timeStepSize = 0.02 self.angle = -1.5708 self.up = 0.0 self.length = 5.0 self.radius = 30.0 self.stepSizeX = 5 self.stepSizeY = 5 self.lastX = 0 self.lastY = 0 self.threshold = 6.5 self.rows = 100 self.cols = 60 self.delta = 3 self.maxval = 20 self.M = makeTopoMap.get_matrix(seed=331, rows=self.rows, cols=self.cols, delta=self.delta, maxval=self.maxval) glutInit(sys.argv) glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH) #glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GLUT_DEPTH) glutInitWindowPosition(100, 50) glutInitWindowSize(self.width, self.height) glutCreateWindow("Lab 09 - Part 3") glutDisplayFunc(self.display) glMatrixMode(GL_PROJECTION) glLoadIdentity() glFrustum(-5.0, 5.0, -5.0, 5.0, 5.0, 100.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() glEnable(GL_DEPTH_TEST) glutSpecialFunc(self.keyboardSpecial) glutMouseFunc(self.mouse) glutMotionFunc(self.motion) glutMainLoop()
def __init__(self): self.width = 800 self.height = 800 self.timeStep = 0 self.timeStepSize = 0.02 self.angle = -1.5708 self.up = 0.0 self.length = 5.0 self.radius = 30.0 self.stepSizeX = 5 self.stepSizeY = 5 self.lastX = 0 self.lastY = 0 self.threshold = 6.5 self.rows = 10 self.cols = 10 self.M = makeTopoMap.get_matrix(rows=10, cols=10, seed=11317, maxval=8) self.colors = [(8,48,107), (8,81,156), (33, 113, 181), (66, 146, 198), (107, 174, 214), (158, 202, 225), (198, 219, 239), (222, 235, 247), (247, 251, 255)] glutInit(sys.argv) glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH) #glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GLUT_DEPTH) glutInitWindowPosition(100,50) glutInitWindowSize(self.width, self.height) glutCreateWindow("Color Scheme") glutDisplayFunc(self.display) glMatrixMode(GL_PROJECTION) glLoadIdentity() glFrustum(-5.0, 5.0, -5.0, 5.0, 5.0, 100.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() glEnable(GL_DEPTH_TEST) glutSpecialFunc(self.keyboardSpecial) glutMouseFunc(self.mouse) glutMotionFunc(self.motion) glutMainLoop()
from __future__ import print_function import makeTopoMap M = makeTopoMap.get_matrix(seed=331, rows=10, cols=10, delta=3, maxval=20) t = 1.5 M = [[1, 3, 1], [0, 0, 0], [1, 3, 1]] #for x add j to ULX and the difference #for y add i to ULY and the difference #formula for between 2 points = (threshold - Low)/ (high-low) def difference(a, b, t): if (a > b): return ((t - b) / (a - b)) return ((t - a) / (b - a)) ULX = -2 ULY = 2 for i in range(2): for j in range(2): # UL to UR a = M[i][j] b = M[i][j + 1] if ((a >= t) ^ (b >= t)): dif = difference(a, b, t) x = j + ULX + dif y = i print("Point at", x, ",", y, "dif = ", dif) # UR to LR