Exemplo n.º 1
0
cylinderRadius = 10.0

window = graphicsWindow(WIDTH, HEIGHT)  #Open a graphics window
camera = cameraMatrix(P, E, G, NP, FP, WIDTH, HEIGHT,
                      THETA)  #Set camera viewing system

plane = parametricPlane(planeT, planeWidth, planeLength, planeCol, planeRef,
                        (0.0, 1.0), (0.0, 1.0), (1.0 / 10.0, 1.0 / 10.0))
circle = parametricCircle(circleT, circleRadius, circleCol, circleRef,
                          (0.0, 1.0), (0.0, 2.0 * pi), (1.0 / 10.0, pi / 18.0))
sphere = parametricSphere(sphereT, sphereRadius, sphereCol, sphereRef,
                          (0.0, 2.0 * pi), (0.0, pi), (pi / 18.0, pi / 18.0))
cone = parametricCone(coneT, coneHeight, coneRadius, coneCol, coneRef,
                      (0.0, 1.0), (0.0, 2.0 * pi), (1.0 / 10.0, pi / 18.0))
cylinder = parametricCylinder(cylinderT, cylinderHeight, cylinderRadius,
                              cylinderCol, cylinderRef, (0.0, 1.0),
                              (0.0, 2.0 * pi), (1.0 / 10.0, pi / 18.0))
torus = parametricTorus(torusT, torusInnerRadius, torusOuterRadius, torusCol,
                        torusRef, (0.0, 2.0 * pi), (0.0, 2.0 * pi),
                        (pi / 18.0, pi / 9.0))

window.drawSegments(wireMesh(plane, camera).getSegList(), planeCol)
window.drawSegments(wireMesh(circle, camera).getSegList(), circleCol)
window.drawSegments(wireMesh(sphere, camera).getSegList(), sphereCol)
window.drawSegments(wireMesh(cone, camera).getSegList(), coneCol)
window.drawSegments(wireMesh(cylinder, camera).getSegList(), cylinderCol)
window.drawSegments(wireMesh(torus, camera).getSegList(), torusCol)

window.saveImage("testImage.png")
window.showImage()
Exemplo n.º 2
0
cylinderT = transform().translate(Tx=40.0)
cylinderCol = (255, 0, 255)
cylinderRef = (0.0, 0.0, 0.0, 0.0)
cylinderHeight = 20.0
cylinderRadius = 10.0

window = graphicsWindow(WIDTH, HEIGHT)  # Open a graphics window
camera = cameraMatrix(window, P, E, G, NP, FP,
                      THETA)  # Set camera viewing system

plane = parametricPlane(planeT, planeWidth, planeLength, planeCol, planeRef,
                        (0.0, 1.0), (0.0, 1.0), (1.0 / 10.0, 1.0 / 10.0))
circle = parametricCircle(circleT, circleRadius, circleCol, circleRef,
                          (0.0, 1.0), (0.0, 2.0 * pi), (1.0 / 10.0, pi / 18.0))
sphere = parametricSphere(sphereT, sphereRadius, sphereCol, sphereRef,
                          (0.0, 2.0 * pi), (0.0, pi), (pi / 18.0, pi / 18.0))
cone = parametricCone(coneT, coneHeight, coneRadius, coneCol, coneRef,
                      (0.0, 1.0), (0.0, 2.0 * pi), (1.0 / 10.0, pi / 18.0))
cylinder = parametricCylinder(cylinderT, cylinderHeight, cylinderRadius,
                              cylinderCol, cylinderRef, (0.0, 1.0),
                              (0.0, 2.0 * pi), (1.0 / 10.0, pi / 18.0))
torus = parametricTorus(torusT, torusInnerRadius, torusOuterRadius, torusCol,
                        torusRef, (0.0, 2.0 * pi), (0.0, 2.0 * pi),
                        (pi / 18.0, pi / 9.0))

window.drawWireMesh(
    wireMesh([plane, circle, sphere, cone, cylinder, torus],
             camera).getFaceList())
window.saveImage("assignment2Image.png")
window.showImage()