Skip to content
Snippets Groups Projects
Select Git revision
  • be5df93fb9bce312306c55202230459215f8a447
  • main default
  • tp2
  • tp1
  • tp3
  • tp2-correction
  • tp1-correction
  • admins
8 results

operators.py

Blame
  • Forked from an inaccessible project.
    reflection.py 787 B
    # Show to python where to find the modules
    import sys
    sys.path.append('..')
    
    from scene import *
    from light import Spotlight
    from camera import Camera
    from raytracer import raytracer_render
    from matplotlib.image import imsave
    import sys
    
    camera = Camera(200,200,1)
    materiau_sphere_bleue = Material(Vector((0,0,1)), .7, .7, .7, 100, .7)
    materiau_sphere_rouge = Material(Vector((1,0,0)), .7, .7, .7, 100, .7)
    sphere_bleue = Sphere(Vector([0,0,3]), .8, materiau_sphere_bleue)
    sphere_rouge = Sphere(Vector([0.5,0.5,2]), .5, materiau_sphere_rouge)
    lumiere = Spotlight(Vector((1,1,0)), Vector((1,1,1)))
    scene = Scene()
    scene.add_object(sphere_bleue)
    scene.add_object(sphere_rouge)
    scene.add_light(lumiere)
    affiche = raytracer_render(camera, scene)
    imsave('two_spheres_reflection.png',affiche)