Exemple #1
0
 def __init__( self, center, planes, R ):
     # TODO: rather add R as an attribute to Tracer...
     components = []
     for p in planes:
         halfspace = HalfSpaceComponent( p, vec_norm(p) )
         components.append(halfspace)
     
     FixedConvexIntersection.__init__(self, center, components)
     self.linear_transform(scaling=R)
Exemple #2
0
 def __init__( self, center, vertices, R ):
     """
     The vertices and their symmetries about the center (i.e.,
     v -> -v) define the dual polyhedron of the result. R is a
     scaling factor. If R is 1 and the center is (0,0,1), then 
     a vertex, face or edge of the polyhedron is on the ground
     plane {z = 0}.
     """
     
     components = []
     for v in vertices:
         layer = LayerComponent( tuple([-x for x in v]), vec_norm(v)*2.0 )
         layer.position = v
         components.append(layer)
     
     FixedConvexIntersection.__init__(self, center, components)
     self.linear_transform(scaling=R)
Exemple #3
0
 def __init__(self, axis, h = None):
     if h is None:
         h = vec_norm(axis)
     else:
         h = h
     HalfSpaceComponent.__init__(self, axis, h)
		CylinderComponent( (1,1,0), 1, ),
		CylinderComponent( (0,1,0), 1, ),
		CylinderComponent( (1,0,1), 1, )
	] ), 'mirror')
	
cylR = .4
scene.add_object(
	ConvexIntersection( (-0.7,-0.8,cylR), [
		CylinderComponent( (1,0,0), cylR, ),
		CylinderComponent( (0,1,0), cylR, ),
		CylinderComponent( (0,0,1), cylR, )
	] ), 'wax')

scene.add_object(Parallelepiped( (1.3,-0.5,0.0), (1,0,0), (0,1.3,0), (0,0,0.6) ), 'red')

scene.add_object(Dodecahedron( (1.8,0.2,.5+0.6), 0.5 ), 'glass')

#scene.image.size = (1280,1024)
scene.image.size = (1024,768)
#scene.image.size = (640,400)
scene.samples_per_pixel = 10000
scene.quasirandom = False
scene.gamma = 1.6
scene.max_bounces = 5
scene.camera_fov = 60

scene.camera_position = (-2,-3,1.5)
scene.direct_camera_towards( (0,0,0.5) )
#scene.camera_dof_fstop = 0.02
scene.camera_sharp_distance = vec_norm( np.array([1.8,0.2,.5+0.6]) - np.array(scene.camera_position) )