t.calc_circumcircle() def DrawScene(): t.to_OpenGL() if __name__ == "__main__": print "p1=" + str(p1) print "p2=" + str(p2) print "p3=" + str(p3) print "p2-p1=" + str(p2.sub(p1)) print "p3-p2=" + str(p3.sub(p2)) print "p1-p3=" + str(p1.sub(p3)) print "p2.p1=" + str(p2.dot(p1)) print "p3.p2=" + str(p3.dot(p2)) print "p1.p3=" + str(p1.dot(p3)) print "p1xp2=" + str(p1.cross(p2)) print "p2xp3=" + str(p2.cross(p3)) print "p3xp1=" + str(p3.cross(p1)) print t print "circ(t) = %s@%s" % (t.radius(), t.center()) Visualization("VisualizationTest", DrawScene)
GL.glColor3f(0.9, 0.8, 0.7) # GL.glMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, (0.9, 0.8, 0.7, 0.2)) # GL.glMaterial(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, (0.8, 0.8, 0.8, 0.2)) GL.glMaterial(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, (1.0, 1.0, 1.0, 1.0)) GL.glMaterial(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, (0.5)) zbuffer.to_OpenGL() dy = 0.1 dx = 0.23 dz = -0.01 def HandleKey(key, x, y): global dx, dy, dz p.x += dx if p.x > 5 or p.x < -5: dx = -dx p.x += dx * 2 p.y += dy if p.y > 5 or p.y < -5: dy = -dy p.y += dy * 2 p.z += dz c.moveto(p) zbuffer.add_cutter(c) Visualization("VisualizationTest", DrawScene, handleKey=HandleKey)