def _letter_o(lclass): """@Todo: ApiDoc.""" return lclass( # Letter O Torus(18.45, 6, ClippedBy(Plane(Vector(40, 0, -9), 0)), Translate(Vector(-40, 0, 99))), Cylinder(Vector(-44.05, 0, 81), Vector(35.95, 0, 63), 6), Torus(18.45, 6, ClippedBy(Plane(Vector(-40, 0, 9), 0)), Translate(Vector(40, 0, 81))), Cylinder(Vector(44.05, 0, 99), Vector(-35.95, 0, 117), 6), )
def test_create_arg_wrong_type(self): """Test creation of Translate object.""" with self.assertRaisesRegexp( SdlSyntaxException, 'Value of Argument 0 is expected to be type Vector but got str' ): Translate('foo')
def solid(length=4, width=1): """@Todo: DocString.""" return Union( Sphere(Vector(LGCS, LGCS, LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGCS), Vector(length * LGBW - LGCS, LGCS, LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, LGCS, LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS), Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS), Vector(LGCS, LGCS, LGBH - LGCS), LGCS), Sphere(Vector(LGCS, LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGCS), Vector(LGCS, LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGCS), Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS), Sphere(Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS), Cylinder(Vector(LGCS, width * LGBW - LGCS, LGCS), Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS), Sphere(Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGBH - LGCS), Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS), Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS), Cylinder( Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS), Cylinder( Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS), Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS), Cylinder( Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS), Difference( Union( Box( Vector(LGCS, LGCS, 0), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGBH), ), Box( Vector(0, LGCS, LGCS), Vector(length * LGBW, width * LGBW - LGCS, LGBH - LGCS), ), Box( Vector(LGCS, 0, LGCS), Vector(length * LGBW - LGCS, width * LGBW, LGBH - LGCS), ), ), get_knob_inner_space(length, width)), get_brick_coloumn(length), get_knob_objects(length, width), Translate(Vector(-length / 2 * LGBW, -LGBW / 2, -LGBH)), Rotate(Vector(0, 0, 90)))
def get_knob_inner_space(length=1, width=1, height=LG_BRICK_INNER_HEIGHT): """@Todo: DocString.""" result = Union( Box( Vector(LGWW, LGWW, -LGCS), Vector( length * LGBW - LGWW, width * LGBW - LGWW, LG_PLATE_INNER_HEIGHT ) ) ) for ks_x in range(0, length): for ks_y in range(0, width): result.append( Object( LG_KNOB_INNER_SPACE, Translate( Vector( (ks_x + 0.5) * LGBW, (ks_y + 0.5) * LGBW, height ) ) ) ) return result
def _letter_g(lclass): """@Todo: ApiDoc.""" letter_g = lclass( # Letter G Sphere(Vector(-35.95, 0, 57), 6), Torus(18.45, 6, ClippedBy(Plane(Vector(40, 0, -9), 0)), Translate(Vector(-40, 0, 39))), Cylinder(Vector(-44.05, 0, 21), Vector(35.95, 0, 3), 6), Torus(18.45, 6, ClippedBy(Plane(Vector(-40, 0, 9), 0), ), Translate(Vector(40, 0, 21))), Cylinder(Vector(44.05, 0, 39), Vector(0, 0, 49), 6), Sphere(Vector(0, 0, 49), 6), Cylinder(Vector(0, 0, 49), Vector(0, 0, 34), 6), Sphere(Vector(0, 0, 34), 6), ) if LG_STUD_LOGO > 0: letter_g.append(Translate(Vector(0, 0, -65))) return letter_g
def lg_knob_function(knobclass, textfunction): """@Todo: ApiDoc.""" result = knobclass( knobclass( Cylinder(Vector(0, 0, LG_KNOB_HEIGHT - LG_KNOB_CORNER_SPACE), Vector(0, 0, -LG_E), LG_KNOB_RADIUS), Cylinder(Vector(0, 0, LG_KNOB_HEIGHT), Vector(0, 0, -LG_E), LG_KNOB_RADIUS - LG_KNOB_CORNER_SPACE), ), Torus(LG_KNOB_RADIUS - LG_KNOB_CORNER_SPACE, LG_KNOB_CORNER_SPACE, Rotate(Vector(90, 0, 0)), Translate(Vector(0, 0, (LG_KNOB_HEIGHT - LG_KNOB_CORNER_SPACE))))) if LG_QUALITY > 2: result.append( Object(textfunction, Translate(Vector(0, 0, LG_KNOB_HEIGHT)))) return result
def _lg_tech_knob_function(knobclass): """@Todo: ApiDoc.""" return knobclass( Difference( knobclass( Cylinder(Vector(0, 0, LG_KNOB_HEIGHT - LG_CORNER_SPACE), Vector(0, 0, -LG_E), LG_KNOB_RADIUS), Difference( Cylinder(Vector(0, 0, LG_KNOB_HEIGHT), Vector(0, 0, -LG_E), LG_KNOB_RADIUS - LG_CORNER_SPACE), Cylinder(Vector(0, 0, LG_KNOB_HEIGHT + LG_E), Vector(0, 0, -2 * LG_E), LG_KNOB_INNER_RADIUS + LG_CORNER_SPACE))), Cylinder(Vector(0, 0, (LG_KNOB_HEIGHT + 2 * LG_E)), Vector(0, 0, -3 * LG_E), LG_KNOB_INNER_RADIUS)), Torus(LG_KNOB_INNER_RADIUS + LG_CORNER_SPACE, LG_CORNER_SPACE, Rotate(Vector(90, 0, 0)), Translate(Vector(0, 0, (LG_KNOB_HEIGHT - LG_CORNER_SPACE)))), Torus(LG_KNOB_RADIUS - LG_CORNER_SPACE, LG_CORNER_SPACE, Rotate(Vector(90, 0, 0)), Translate(Vector(0, 0, (LG_KNOB_HEIGHT - LG_CORNER_SPACE)))))
def get_lg_cylinder(cylinderclass, height): """@Todo:ApiDoc.""" return cylinderclass( Difference( Cylinder(Vector(0, 0, height + LG_E), Vector(0, 0, (LG_CYLINDER_WALL_WIDTH / 2)), LG_CYLINDER_RADIUS), Cylinder(Vector(0, 0, height + LG_CORNER_SPACE), Vector(0, 0, 0), LG_KNOB_RADIUS)), Torus(LG_CYLINDER_RADIUS - LG_CYLINDER_WALL_WIDTH / 2, LG_CYLINDER_WALL_WIDTH / 2, Rotate(Vector(90, 0, 0)), Translate(Vector(0, 0, (LG_CYLINDER_WALL_WIDTH / 2)))))
def _letter_e(lclass): """@Todo: ApiDoc.""" result = lclass( # Letter E Sphere(Vector(-59, 0, -36), 6), Cylinder(Vector(-59, 0, -36), Vector(-59, 0, 1), 6), Sphere(Vector(-59, 0, 1), 6), Cylinder(Vector(0, 0, -49), Vector(0, 0, -25), 6), Sphere(Vector(0, 0, -25), 6), Sphere(Vector(59, 0, -62), 6), Cylinder(Vector(59, 0, -62), Vector(59, 0, -24), 6), Sphere(Vector(59, 0, -24), 6), Cylinder(Vector(-59, 0, -36), Vector(59, 0, -62), 6), ) if LG_STUD_LOGO > 0: result.append(Translate(Vector(0, 0, 60))) return result
def get_cylinder( length=1, width=1, cclass=Union, height=LG_PLATE_INNER_HEIGHT ): """Return Plate Cylinder.""" result = cclass() for cyl_x in range(1, length): for cyl_y in range(1, width): result.append( Object( get_lg_cylinder(cclass, height), Translate(Vector(cyl_x * LGBW, cyl_y * LGBW, 0)) ) ) return result
def get_knob_objects(length=1, width=1, height=LGBH): """@Todo: DocString.""" result = Union() for knob_x in range(0, length): for knob_y in range(0, width): result.append( Object( lg_knob(), Rotate(Vector(0, 0, -90)), Translate( Vector( (0.5 + knob_x) * LGBW, (0.5 + knob_y) * LGBW, height ) ), ) ) return result
def get_brick_coloumn(length=1): """@Todo: DocString.""" result = Union() col_x = 1 while col_x < length: result.append( Object( LG_BRICK_COLUMN, Translate( Vector( col_x * LGBW, 0.5 * LGBW, 0 ) ), ) ) col_x = col_x + 1 return result
def solid(length=2, width=1): """@Todo: Docstring.""" return Union( Sphere( Vector(LGCS, LGCS, LGCS + 0.04), LGCS ), Cylinder( Vector(LGCS, LGCS, LGCS + 0.04), Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04), LGCS ), Sphere( Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04), LGCS ), Cylinder( Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04), Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), LGCS ), Sphere( Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), Vector(LGCS, LGCS, LGPH - LGCS), LGCS ), Sphere( Vector(LGCS, LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(LGCS, LGCS, LGCS + 0.04), Vector(LGCS, LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(LGCS, LGCS, LGCS + 0.04), Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04), LGCS ), Sphere( Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04), LGCS ), Cylinder( Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04), Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS ), Sphere( Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04), LGCS ), Sphere( Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04), LGCS ), Cylinder( Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04), Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04), LGCS ), Cylinder( Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS ), Sphere( Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS), Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, LGWW - LGCS, LGPH - LGCS), Vector(LGCS, LGWW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LGPH - LGCS), Vector(LGCS, 2 * LGWW + LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, 3 * LGWW - LGCS, LGPH - LGCS), Vector(LGCS, 3 * LGWW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LGPH - LGCS), Vector(LGCS, 4 * LGWW + LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(LGCS, LGCS, LGPH - LGCS), Vector(LGCS, LGWW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(LGCS, 2 * LGWW + LGCS, LGPH - LGCS), Vector(LGCS, 3 * LGWW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(LGCS, 4 * LGWW + LGCS, LGPH - LGCS), Vector(LGCS, 5 * LGWW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), Vector(length * LGBW - LGCS, LGWW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LGPH - LGCS), Vector(length * LGBW - LGCS, 3 * LGWW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LGPH - LGCS), Vector(length * LGBW - LGCS, 5 * LGWW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(LGCS, LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS), Vector(LGCS, LGWW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS), Vector(length * LGBW - LGCS, LGWW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(LGCS, 2 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS), Vector(LGCS, 2 * LGWW + LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS), Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(LGCS, 3 * LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS), Vector(LGCS, 3 * LGWW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, 3 * LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS), Vector(length * LGBW - LGCS, 3 * LGWW - LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(LGCS, 4 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS), Vector(LGCS, 4 * LGWW + LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS), Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LGPH - LGCS), LGCS ), Sphere( Vector(LGCS, LGWW - LGCS, LGPH - LGCS), LGCS ), Sphere( Vector(length * LGBW - LGCS, LGWW - LGCS, LGPH - LGCS), LGCS ), Sphere( Vector(LGCS, 2 * LGWW + LGCS, LGPH - LGCS), LGCS ), Sphere( Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LGPH - LGCS), LGCS ), Sphere( Vector(LGCS, 3 * LGWW - LGCS, LGPH - LGCS), LGCS ), Sphere( Vector(length * LGBW - LGCS, 3 * LGWW - LGCS, LGPH - LGCS), LGCS ), Sphere( Vector(LGCS, 4 * LGWW + LGCS, LGPH - LGCS), LGCS ), Sphere( Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LGPH - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS), Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS), LGCS ), Cylinder( Vector(LGCS, LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS), Vector(LGCS, 2 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS), LGCS ), Cylinder( Vector(length * LGBW - LGCS, 3 * LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS), Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS), LGCS ), Cylinder( Vector(LGCS, 3 * LGWW - LGCS, LG_PLATE_INNER_HEIGHT - LGCS), Vector(LGCS, 4 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS), LGCS ), Difference( Union( Box( Vector(LGCS, LGCS, 0.04), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH) ), Box( Vector(0, LGCS, LGCS + 0.04), Vector(length * LGBW, width * LGBW - LGCS, LGPH - LGCS) ), Box( Vector(LGCS, 0, LGCS + 0.04), Vector(length * LGBW - LGCS, width * LGBW, LGPH - LGCS) ), Box( Vector(0.04, 0.04, 0), Vector(length * LGBW - 0.04, width * LGBW - 0.04, 0.04 + LG_E) ) ), Union( Box( Vector(LGWW, LGWW, -LGCS), Vector(length * LGBW - LGWW, width * LGBW - LGWW, LG_PLATE_INNER_HEIGHT + LG_E) ), Box( Vector(-LG_E, LGWW - LGCS, LGPH + LG_E), Vector(LGCS, 2 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS) ), Box( Vector(length * LGBW + LG_E, LGWW - LGCS, LGPH + LG_E), Vector(length * LGBW - LGCS, 2 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS) ), Box( Vector(0, LGWW - LGCS, LGPH + LG_E), Vector(length * LGBW, 2 * LGWW + LGCS, LGPH - LGCS) ), Box( Vector(0, LGWW, LGPH), Vector(length * LGBW, 2 * LGWW, LG_PLATE_INNER_HEIGHT) ), Box( Vector(-LG_E, 3 * LGWW - LGCS, LGPH + LG_E), Vector(LGCS, 4 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS) ), Box( Vector(length * LGBW + LG_E, 3 * LGWW - LGCS, LGPH + LG_E), Vector(length * LGBW - LGCS, 4 * LGWW + LGCS, LG_PLATE_INNER_HEIGHT - LGCS) ), Box( Vector(0, 3 * LGWW - LGCS, LGPH + LG_E), Vector(length * LGBW, 4 * LGWW + LGCS, LGPH - LGCS) ), Box( Vector(0, 3 * LGWW, LGPH), Vector(length * LGBW, 4 * LGWW, LG_PLATE_INNER_HEIGHT) ) ) ), Difference( Cylinder( Vector(LGBW, LGBW / 2, LG_PLATE_INNER_HEIGHT + LG_E), Vector(LGBW, LGBW / 2, 0), LG_KNOB_INNER_RADIUS ), Union( Box( Vector(LGWW, LGWW, -LG_E), Vector(length * LGBW - LGWW, 2 * LGWW, LGPH) ), Box( Vector(LGWW, 3 * LGWW, -LG_E), Vector(length * LGBW - LGWW, 4 * LGWW, LGPH) ), ), ), Translate(Vector(-LGBW, -0.5 * LGBW, -LGPH)), Rotate(Vector(0, 0, 90)) )
def main(): """@Todo: DocString.""" fix = SceneFile('test.pov') fix.append(Version(3.6)) part = lg_3853 # *********************************************************************** # Settings --> After Includes to overwrite presets # *********************************************************************** # @TODO: Read from Config image_width = 1600 # @TODO: Read from Config image_height = 1200 fix.append( GlobalSettings(assumed_gamma=1.5, ambient_light=Color(rgb=Vector(1, 1, 1)))) # *********************************************************************** # Camera # *********************************************************************** fix.append( Camera(location=Vector(0, 500, 0), direction=Vector(0, 25, 0), right=x * image_width / image_height, look_at=(0.0, 0.0, 0.0))) # *********************************************************************** # Background # *********************************************************************** fix.append( SkySphere( Pigment( Gradient(y * 0.8), ColorMap({ 0.00: Color(rgb=Vector(0.6, 0.7, 1.0)), 0.70: Color(rgb=Vector(0.0, 0.1, 0.8)) }), ))) # *********************************************************************** # Light # *********************************************************************** fix.append( Union( LightSource( Vector(0, 0, 0), # light's position (translated below) Color(rgb=(1, 1, 1)), # light's color Translate(Vector(-300, 300, -300))), LightSource( Vector(0, 0, 0), # light's position (translated below) Color(rgb=Vector(1, 1, 1)), # light's color Translate(Vector(300, 300, 300))))) # *********************************************************************** # Ground plane # *********************************************************************** # fix.append( # Plane( # y, -5.01, # Pigment( # Color(rgb=Vector(0.5, 0.5, 0.5)) # ) # ) # ) fix.append( Union( Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, 9, 0, 8, 45, 0, 45), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, 3, 0, 8, 135, 0, 45), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, -3, 0, 8, 215, 0, -45), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, -9, 0, 8, 315, 0, -45), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, 9, 0, 3, 45, 45, 0), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, 3, 0, 3, 45, 135, 0), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, -3, 0, 3, -45, 215, 0), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, -9, 0, 3, -45, 315, 0), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick( part.solid(), LG_WHITE, 9, 0, -2, 45, 0, 45, ), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, 3, 0, -2, 45, 0, 135), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, -3, 0, -2, -45, 0, 215), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, -9, 0, -2, -45, 0, 315), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick( part.solid(), LG_WHITE, 9, 0, -7, 0, 0, 0, ), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, 3, 0, -7, 90, 0, 0), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, -3, 0, -7, 180, 0, 0), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(part.solid(), LG_WHITE, -9, 0, -7, 270, 0, 0), )) return fix
def solid(length=1, width=2, height=1): """return lg_4865: Panel 1 x 2 x 1.""" result = Union( ) for rot in range(0, 2): rotation = Rotate(Vector(0, 0, 0)) translation = Translate(Vector(0, 0, 0)) if rot == 1: rotation = Rotate(Vector(0, 0, 180)) translation = Translate(Vector(-LGBW, 0, 0)) result.append( Union( Sphere( Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS), LGCS ), Sphere( Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS), LGCS ), Cylinder( Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS), Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS), LGCS ), Cylinder( Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS), Vector(length / 2 * LGBW - LGCS, -width / 2 * LGBW + LGCS, -height * LGBH + LGCS), LGCS ), rotation, translation ), ) result.append( Union( Cylinder( Vector(-length / 2 * LGBW + LGWW - LGCS, width / 2 * LGBW - LGCS, -LGCS), Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -LGCS), LGCS ), Cylinder( Vector(-length / 2 * LGBW + LGWW - LGCS, -width / 2 * LGBW + LGCS, -LGCS), Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW + LGCS, -LGCS), LGCS ), Cylinder( Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -LGCS), Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW + LGCS, -LGCS), LGCS ), Cylinder( Vector(-length / 2 * LGBW + LGWW - LGCS, width / 2 * LGBW - LGCS, -LGCS), Vector(-length / 2 * LGBW + LGWW - LGCS, -width / 2 * LGBW + LGCS, -LGCS), LGCS ), Sphere( Vector(-length / 2 * LGBW + LGWW - LGCS, width / 2 * LGBW - LGCS, -LGCS), LGCS ), Sphere( Vector(-length / 2 * LGBW + LGWW - LGCS, -width / 2 * LGBW + LGCS, -LGCS), LGCS ), Sphere( Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -LGCS), LGCS ), Sphere( Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW + LGCS, -LGCS), LGCS ), Cylinder( Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -LGCS), Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS), LGCS ), Cylinder( Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW + LGCS, -LGCS), Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW + LGCS, -height * LGBH + LGCS), LGCS ), Cylinder( Vector(-length / 2 * LGBW + LGWW - LGCS, -width / 2 * LGBW + LGCS, -LGCS), Vector(-length / 2 * LGBW + LGWW - LGCS, width / 2 * LGBW - LGCS, -LGCS), LGCS ), Cylinder( Vector(-length / 2 * LGBW - LGCS + LGWW, width / 2 * LGBW - LGCS, -(height * 3 - 1) * LGPH - LGCS), Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -(height * 3 - 1) * LGPH - LGCS), LGCS ), Cylinder( Vector(-length / 2 * LGBW - LGCS + LGWW, -width / 2 * LGBW + LGCS, -(height * 3 - 1) * LGPH - LGCS), Vector(length / 2 * LGBW - LGCS, -width / 2 * LGBW + LGCS, -(height * 3 - 1) * LGPH - LGCS), LGCS ), Cylinder( Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -(height * 3 - 1) * LGPH - LGCS), Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGCS), LGCS ), Cylinder( Vector(length / 2 * LGBW - LGCS, -width / 2 * LGBW + LGCS, -(height * 3 - 1) * LGPH - LGCS), Vector(length / 2 * LGBW - LGCS, -width / 2 * LGBW + LGCS, -height * LGBH + LGCS), LGCS ), Cylinder( Vector(length / 2 * LGBW - LGCS, -width / 2 * LGBW + LGCS, -(height * 3 - 1) * LGPH - LGCS), Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -(height * 3 - 1) * LGPH - LGCS), LGCS ), Cylinder( Vector(-length / 2 * LGBW - LGCS + LGWW, width / 2 * LGBW - LGCS, -LGCS), Vector(-length / 2 * LGBW - LGCS + LGWW, width / 2 * LGBW - LGCS, -(height * 3 - 1) * LGPH - LGCS), LGCS ), Cylinder( Vector(-length / 2 * LGBW - LGCS + LGWW, -width / 2 * LGBW + LGCS, -LGCS), Vector(-length / 2 * LGBW - LGCS + LGWW, -width / 2 * LGBW + LGCS, -(height * 3 - 1) * LGPH - LGCS), LGCS ), Sphere( Vector(length / 2 * LGBW - LGCS, -width / 2 * LGBW + LGCS, -(height * 3 - 1) * LGPH - LGCS), LGCS ), Sphere( Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -(height * 3 - 1) * LGPH - LGCS), LGCS ), Difference( Union( Box( Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW - LGCS, -height * LGBH + LGPH), Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW + LGCS, -height * LGBH), ), Box( Vector(length / 2 * LGBW, width / 2 * LGBW - LGCS, -height * LGBH + LGPH - LGCS), Vector(-length / 2 * LGBW, -width / 2 * LGBW + LGCS, -height * LGBH + LGCS), ), Box( Vector(length / 2 * LGBW - LGCS, width / 2 * LGBW, -height * LGBH + LGPH - LGCS), Vector(-length / 2 * LGBW + LGCS, -width / 2 * LGBW, -height * LGBH + LGCS) ), ), Box( Vector(length / 2 * LGBW - LGWW, width / 2 * LGBW - LGWW, -height * LGBH + LGPH - LG_TOP_HEIGHT), Vector(-length / 2 * LGBW + LGWW, -width / 2 * LGBW + LGWW, -height * LGBH - LG_E) ), ), Box( Vector(-length / 2 * LGBW, width / 2 * LGBW - LGCS, -LGCS), Vector(-length / 2 * LGBW + LGWW, -width / 2 * LGBW + LGCS, -height * LGBH + LGCS) ), Box( Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW, -LGCS), Vector(-length / 2 * LGBW + LGWW - LGCS, -width / 2 * LGBW, -height * LGBH + LGCS) ), Box( Vector(-length / 2 * LGBW + LGCS, width / 2 * LGBW - LGCS, -2 * LGCS), Vector(-length / 2 * LGBW + LGWW - LGCS, -width / 2 * LGBW + LGCS, 0) ), Object( LG_PLATE_COLUMN, Translate(Vector(-LGBW / 2, 0, -height * LGBH)) ), ) ) return result
def main(): """@Todo: DocString.""" fix = SceneFile('test.pov') fix.append(Version(3.6)) # *********************************************************************** # Settings --> After Includes to overwrite presets # *********************************************************************** # @TODO: Read from Config image_width = 800 # @TODO: Read from Config image_height = 600 fix.append( GlobalSettings( assumed_gamma=1.5, ambient_light=Color(rgb=Vector(1, 1, 1)) ) ) # L3P Settings # l3_version = 1.4 # Quality level, 0=BBox, 1=no refr, 2=normal, 3=studlogo, 4=stud2logo # l3_quality = lg_quality # Width of seam between two bricks # L3SW = 0.5 # L3Studs = 1 # 1=on 0=off # L3Bumps = 0 # 1=on 0=off # L3Ambient = 0.4 # L3Diffuse = 0.4 # L3Ior = 1.25 # L3NormalBumps = Normal( # bumps=0.01, # scale=20 # ) # L3NormalSlope = Normal( # bumps=0.3, # scale=0.5 # ) # At least a small seam when transparent # if L3SW: # L3SWT = L3SW # else: # L3SWT = 0.001 # *********************************************************************** # Camera # *********************************************************************** fix.append( Camera( location=Vector(5, 12, 12), direction=1.5 * z, right=x * image_width / image_height, look_at=(0.0, 5.0, 0.0) ) ) # *********************************************************************** # Background # *********************************************************************** fix.append( SkySphere( Pigment( Gradient(y), ColorMap({ 0.00: Color(rgb=Vector(0.6, 0.7, 1.0)), 0.70: Color(rgb=Vector(0.0, 0.1, 0.8)) }), ) ) ) # *********************************************************************** # Light # *********************************************************************** fix.append( # LightSource( # Vector(0, 0, 0) # light's position (translated below) # Color(rgb=(1, 1, 1) # light's color # Translate( # Vector(-3000, 3000, -3000) # ) # ) LightSource( Vector(0, 0, 0), # light's position (translated below) Color(rgb=Vector(1, 1, 1)), # light's color Translate( Vector(300, 300, 300) ) ) ) # *********************************************************************** # Ground plane # *********************************************************************** fix.append( Plane( y, -0.01, Pigment( Color(rgb=Vector(0.7, 0.5, 0.3)) ) ) ) # *********************************************************************** # Objects # *********************************************************************** # Pizza to go / Car fix.append( lg_10036_1_car.nonmoving() ) # object {set_10036_1_car_steering_wheel} # object {set_10036_1_car_schutter_l} # object {set_10036_1_car_schutter_r} # object {set_10036_1_car_sunroof} # object {set_10036_1_car_sunroof_glass} # object {set_10036_1_car_wheel_fr} # object {set_10036_1_car_wheel_fl} # object {set_10036_1_car_wheel_rr} # object {set_10036_1_car_wheel_rl} # object {set_10036_1_house_base} # object {set_10036_1_house_nonmoving fix.append( lg_10036_1_house.set_10036_1_house_nonmoving() ) # object {set_10036_1_house_oven_door} return fix
def solid(): """LG 3788 Solid brick.""" mainpart = Union() for rot in (0, 1): rotpart = Union( Sphere( Vector(LGBW - LGCS, 2 * LGBW - LGCS, -LGCS), LGCS ), Sphere( Vector(LGBW - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), LGCS ), Sphere( Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -LGCS), LGCS ), Sphere( Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), LGCS ), Sphere( Vector(-LGBW + LGCS, LGBW + LGCS, -LGCS), LGCS ), Sphere( Vector(LGBW - LGCS, LGBW + LGCS, -LGCS), LGCS ), Sphere( Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), LGCS ), Sphere( Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), LGCS ), Cylinder( Vector(LGBW - LGCS, 2 * LGBW - LGCS, -LGCS), Vector(LGBW - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), LGCS ), Cylinder( Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -LGCS), Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), LGCS ), Cylinder( Vector(-LGBW + LGCS, LGBW + LGCS, -LGCS), Vector(LGBW - LGCS, LGBW + LGCS, -LGCS), LGCS ), Cylinder( Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -LGCS), Vector(LGBW - LGCS, 2 * LGBW - LGCS, -LGCS), LGCS ), Cylinder( Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), LGCS ), Cylinder( Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), Vector(LGBW - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), LGCS ), Cylinder( Vector(-LGBW + LGCS, 2 * LGBW - LGCS, -LGCS), Vector(-LGBW + LGCS, LGBW + LGCS, -LGCS), LGCS ), Cylinder( Vector(LGBW - LGCS, 2 * LGBW - LGCS, -LGCS), Vector(LGBW - LGCS, LGBW + LGCS, -LGCS), LGCS ), Cylinder( Vector(LGBW - LGCS, -2 * LGBW + LGCS, -2 * LGPH + LGCS), Vector(LGBW - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), LGCS ), Cylinder( Vector(LGBW - 0.12 + LGCS, LGBW - LGCS, -2 * LGPH + LGCS), Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), LGCS ), Cylinder( Vector(-LGBW + 0.12 - LGCS, LGBW - LGCS, -2 * LGPH + LGCS), Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS), LGCS ), Cylinder( Vector(-LGBW + LGCS, LGBW + LGCS, -LGCS), Vector(-LGBW + LGCS, LGBW + LGCS, -LGPH - LGCS), LGCS ), Cylinder( Vector(LGBW - LGCS, LGBW + LGCS, -LGCS), Vector(LGBW - LGCS, LGBW + LGCS, -LGPH - LGCS), LGCS ), Cylinder( Vector(-LGBW + LGCS, LGBW + LGCS, -LGPH - LGCS), Vector(-LGBW + LGCS, -LGBW - LGCS, -LGPH - LGCS), LGCS ), Cylinder( Vector(LGBW - LGCS, LGBW + LGCS, -LGPH - LGCS), Vector(LGBW - LGCS, -LGBW - LGCS, -LGPH - LGCS), LGCS ), Cylinder( Vector(LGBW - 0.12 + LGCS, LGBW - LGCS, -2 * LGPH + LGCS), Vector(-LGBW + 0.12 - LGCS, LGBW - LGCS, -2 * LGPH + LGCS), LGCS ), Cylinder( Vector(LGBW - 0.12 + LGCS, -LGBW + LGCS, -2 * LGPH + LGCS), Vector(-LGBW + 0.12 - LGCS, -LGBW + LGCS, -2 * LGPH + LGCS), LGCS ), Cylinder( Vector(-0.3 - LGCS, 2 * LGBW - LGCS, -0.2 + LGCS), Vector(0.3 + LGCS, 2 * LGBW - LGCS, -0.2 + LGCS), LGCS ), Cylinder( Vector(0, 0, 0), Vector(0.38 / cos(LG_ANGLE * pi / 180), 0, 0), LGCS, Rotate(Vector(0, -LG_ANGLE, 0)), Translate(Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS)) ), Cylinder( Vector(0, 0, 0), Vector(-0.38 / cos(LG_ANGLE * pi / 180), 0, 0), LGCS, Rotate(Vector(0, LG_ANGLE, 0)), Translate(Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS)) ), Difference( Union( Box( Vector(LGBW - LGCS, 2 * LGBW - LGCS, 0), Vector(-LGBW + LGCS, LGBW + LGCS, -2 * LGPH) ), Box( Vector(LGBW, 2 * LGBW - LGCS, -LGCS), Vector(-LGBW, LGBW + LGCS, -2 * LGPH + LGCS) ), Box( Vector(LGBW - LGCS, 2 * LGBW, -LGCS), Vector(-LGBW + LGCS, LGBW, -2 * LGPH + LGCS) ) ), Union( Object( LG_KNOB_INNER_SPACE, Translate(Vector(LGBW / 2, 1.5 * LGBW, -LG_TOP_HEIGHT)) ), Object( LG_KNOB_INNER_SPACE, Translate(Vector(-LGBW / 2, 1.5 * LGBW, -LG_TOP_HEIGHT)) ), Box( Vector(LGBW - 0.12, 2 * LGBW - 0.12, -LG_TOP_HEIGHT), Vector(-LGBW + 0.12, LGBW - LG_E, -2 * LGPH - LG_E) ), Box( Vector(LGBW - 0.12 + LGCS, 2 * LGBW - 0.12, -2 * LGPH + LGCS), Vector(-LGBW + 0.12 - LGCS, LGBW - LGCS, -2 * LGPH - LG_E) ), Box( Vector(-LGCS, -LGWW, 0), Vector(0.38 / cos(LG_ANGLE * pi / 180), LGCS + LG_E, -0.5), Rotate(Vector(0, -LG_ANGLE, 0)), Translate(Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS)) ), Box( Vector(LGCS, -LGWW, 0), Vector(-0.38 / cos(LG_ANGLE * pi / 180), LGCS + LG_E, -0.5), Rotate(Vector(0, LG_ANGLE, 0)), Translate(Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS)) ), Box( Vector(-0.3 - LGCS, 2 * LGBW - LGWW, -0.2 + LGCS), Vector(0.3 + LGCS, 2 * LGBW + LG_E, -2 * LGPH - LG_E) ) ) ), Difference( Box( Vector(LGBW - LGCS, LGBW + 0.13, -LGCS), Vector(-LGBW + LGCS, LGBW - LGWW, -2 * LGPH + LGCS) ), Union( Box( Vector(LGBW, 0.2, 0), Vector(-LGBW, 0, -0.4 / cos(18.00416161)), Rotate(Vector(-18.00416161, 0, 0)), Translate(Vector(0, LGBW + 0.13, -0.2)) ), Box( Vector(LGBW, LGBW, 0), Vector(-LGBW, LGBW - 0.2, -LGPH - LG_E) ), ), ), Box( Vector(LGBW, LGBW + 0.1, -LGPH - LGCS), Vector(LGBW - 0.12 + LG_E, -LGBW - 0.1, -2 * LGPH + LGCS) ), Box( Vector(LGBW - LGCS, LGBW + 0.1, -LGPH - LGCS), Vector(LGBW - 0.12 + LGCS, -LGBW - 0.1, -2 * LGPH) ), Box( Vector(LGBW - 0.12, LGBW - LGCS, -LGPH - LGCS), Vector(LGBW - 0.12 + LGCS + LG_E, -LGBW + LGCS, -2 * LGPH) ), Box( Vector(LGBW - LGCS, LGBW - LGCS, -2 * LGPH), Vector(-LGBW + LGCS, LGBW - LGWW, -2 * LGPH + LGCS + LG_E) ), Box( Vector(LGBW - LGWW, LGBW / 2 + 0.04, -2 * LGPH + LGCS), Vector(LGBW - 0.1, LGBW / 2 - 0.04, -LGPH - LGCS) ), Box( Vector(-LGBW + LGWW, LGBW / 2 + 0.04, -2 * LGPH + LGCS), Vector(-LGBW + 0.1, LGBW / 2 - 0.04, -LGPH - LGCS) ), Box( Vector(0, - 0.12 + LGCS, -LGCS), Vector(0.38 / cos(LG_ANGLE * pi / 180), 0, LG_E), Rotate(Vector(0, -LG_ANGLE, 0)), Translate(Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS)) ), Box( Vector(0, -0.12 + LGCS, -LGCS), Vector(-0.38 / cos(LG_ANGLE * pi / 180), 0, LG_E), Rotate(Vector(0, LG_ANGLE, 0)), Translate(Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH + LGCS)) ), Box( Vector(-0.3 - LGCS, 2 * LGBW - 0.12, -0.2 + LGCS), Vector(0.3 + LGCS, 2 * LGBW - LGCS, -0.2) ), Box( Vector(LGBW - 0.12 + LGCS, 2 * LGBW - LGCS, -2 * LGPH), Vector(LGBW - LGCS, 2 * LGBW - 0.12e0, -2 * LGPH + LGCS) ), Box( Vector(-LGBW + 0.12 - LGCS, 2 * LGBW - LGCS, -2 * LGPH), Vector(-LGBW + LGCS, 2 * LGBW - 0.12e0, -2 * LGPH + LGCS) ), Object( lg_knob(), Rotate(Vector(0, 0, 90 + 180 * rot)), Translate(Vector(LGBW / 2, LGBW / 2, -LGPH)) ), Object( lg_knob(), Rotate(Vector(0, 0, 90 + 180 * rot)), Translate(Vector(-LGBW / 2, LGBW / 2, -LGPH)) ), Object( lg_knob(), Rotate(Vector(0, 0, 90 + 180 * rot)), Translate(Vector(LGBW / 2, 3 * LGBW / 2, 0)) ), Object( lg_knob(), Rotate(Vector(0, 0, 90 + 180 * rot)), Translate(Vector(-LGBW / 2, 3 * LGBW / 2, 0)) ) ) if rot == 1: rotpart.append( Rotate(Vector(0, 0, 180)) ) mainpart.append(rotpart) mainpart.append( Difference( Box( Vector(LGBW - LGCS, LGBW + LGCS, -LGPH), Vector(-LGBW + LGCS, -LGBW - LGCS, -LGPH - LG_TOP_HEIGHT) ), Union( Object( LG_KNOB_INNER_SPACE, Translate(Vector(LGBW / 2, LGBW / 2, -LGPH - LG_TOP_HEIGHT)) ), Object( LG_KNOB_INNER_SPACE, Translate(Vector(-LGBW / 2, LGBW / 2, -LGPH - LG_TOP_HEIGHT)) ), Object( LG_KNOB_INNER_SPACE, Translate(Vector(-LGBW / 2, -LGBW / 2, -LGPH - LG_TOP_HEIGHT)) ), Object( LG_KNOB_INNER_SPACE, Translate(Vector(LGBW / 2, -LGBW / 2, -LGPH - LG_TOP_HEIGHT)) ) ) ), Object( get_lg_cylinder(Union, LG_PLATE_INNER_HEIGHT), Translate(Vector(0, 0, -2 * LGPH)) ) ) return mainpart
def solid(length=2, width=2): """Return lg_4865: Panel 1 x 2 x 1.""" result = Union( Sphere(Vector(LGCS, LGCS, LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGCS), Vector(length * LGBW - LGCS, LGCS, LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, LGCS, LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS), Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS), Vector(LGCS, LGCS, LGBH - LGCS), LGCS), Sphere(Vector(LGCS, LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGCS), Vector(LGCS, LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGCS), Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS), Sphere(Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS), Cylinder(Vector(LGCS, width * LGBW - LGCS, LGCS), Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS), Sphere(Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGBH - LGCS), Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS), Vector(length * LGBW - LGCS, LGBW - LGCS, LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, LGBW - LGCS, LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, (width - 1) * LGBW - LGCS, LGCS), Vector(LGBW - LGCS, LGBW - LGCS, LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGBW - LGCS, LGCS), Vector(length * LGBW - LGCS, LGBW - LGCS, LGBH - LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, LGBW - LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGBW - LGCS, LGBH - LGCS), Vector(LGBW - LGCS, LGBW - LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGCS, LGBH - LGCS), Vector(length * LGBW - LGCS, LGBW - LGCS, LGBH - LGCS), LGCS), Sphere(Vector(LGBW - LGCS, width * LGBW - LGCS, LGCS), LGCS), Sphere(Vector(LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(LGBW - LGCS, width * LGBW - LGCS, LGCS), Vector(LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(LGBW - LGCS, width * LGBW - LGCS, LGCS), Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS), Cylinder(Vector(LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS), Vector(LGCS, width * LGBW - LGCS, LGBH - LGCS), LGCS), Cylinder(Vector(LGBW - LGCS, width * LGBW - LGCS, LGCS), Vector(LGBW - LGCS, LGBW - LGCS, LGCS), LGCS), Cylinder(Vector(LGBW - LGCS, width * LGBW - LGCS, LGBH - LGCS), Vector(LGBW - LGCS, LGBW - LGCS, LGBH - LGCS), LGCS), Difference( Union( Difference( Box( Vector(LGCS, LGCS, 0), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGBH)), Box(Vector(LGBW - LGCS, LGBW - LGCS, -LG_E), Vector(length * LGBW, width * LGBW, LGBH + LG_E)), ), Difference( Union( Box( Vector(0, LGCS, LGCS), Vector(length * LGBW, width * LGBW - LGCS, LGBH - LGCS)), Box( Vector(LGCS, 0, LGCS), Vector(length * LGBW - LGCS, width * LGBW, LGBH - LGCS)), ), Box( Vector(LGBW, LGBH, 0), Vector(length * LGBW + LG_E, width * LGBW + LG_E, LGBH))), Union( Difference( Box( Vector(LGWW, LGWW, -LG_E), Vector(length * LGBW - LGWW, width * LGBW - LGWW, LG_BRICK_INNER_HEIGHT)), Box( Vector(length / LGBW, width * LGBW, -LGCS), Vector(length / 2 * LGBW - LGWW, width / 2 * LGBW - LGWW, LG_BRICK_INNER_HEIGHT + LG_E)), ), Box(Vector(length * LGBW - LGCS, LGBW - LGCS, -LG_E), Vector(length * LGBW + LG_E, LGBW + LG_E, LGBH + LG_E)), Box(Vector(LGBW - LGCS, width * LGBW - LGCS, -LG_E), Vector(LGBW + LG_E, width * LGBW + LG_E, LGBH + LG_E)), Object( LG_KNOB_INNER_SPACE, Translate( Vector(0.5 * LGBW, 0.5 * LGBW, LG_BRICK_INNER_HEIGHT))), Object( LG_KNOB_INNER_SPACE, Translate( Vector(0.5 * LGBW, 1.5 * LGBW, LG_BRICK_INNER_HEIGHT))), Object( LG_KNOB_INNER_SPACE, Translate( Vector(1.5 * LGBW, 0.5 * LGBW, LG_BRICK_INNER_HEIGHT))))), Box( Vector( sqrt(2) * (LGBW + LG_CYLINDER_RADIUS) / 2, -0.06, LG_BRICK_INNER_HEIGHT), Vector(sqrt(2) * LGBW, 0.06, 0), Rotate(Vector(0, 0, 45))), ), Object(LG_BRICK_COLUMN, Translate(Vector(LGBW, 0.5 * LGBW, 0))), Object(LG_BRICK_COLUMN, Translate(Vector(0.5 * LGBW, LGBW, 0))), Object(lg_knob(), Translate(Vector(0.5 * LGBW, 0.5 * LGBW, LGBH))), Object(lg_knob(), Translate(Vector(1.5 * LGBW, 0.5 * LGBW, LGBH))), Object( lg_knob(), Translate(Vector(0.5 * LGBW, 1.5 * LGBW, LGBH)), ), Translate(Vector((-length / 2 + 0.5) * LGBW, -0.5 * LGBW, -LGBH)), Rotate(Vector(0, 0, 180))) return result
def solid(length=4, width=1): """return lg_3710: Brick 1 x 4.""" return Union( Sphere(Vector(LGCS, LGCS, LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGCS), Vector(length * LGBW - LGCS, LGCS, LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, LGCS, LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS), Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), Vector(LGCS, LGCS, LGPH - LGCS), LGCS), Sphere(Vector(LGCS, LGCS, LGPH - LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGCS), Vector(LGCS, LGCS, LGPH - LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGCS), Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS), Sphere(Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS), Cylinder(Vector(LGCS, width * LGBW - LGCS, LGCS), Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Sphere(Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGPH - LGCS), Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS), Vector(LGCS, width * LGBW - LGCS, LGCS), LGCS), Cylinder( Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Cylinder( Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS), Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Cylinder( Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Difference( Union( Box( Vector(LGCS, LGCS, 0), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH), ), Box( Vector(0, LGCS, LGCS), Vector(length * LGBW, width * LGBW - LGCS, LGPH - LGCS), ), Box( Vector(LGCS, 0, LGCS), Vector(length * LGBW - LGCS, width * LGBW, LGPH - LGCS), ), ), get_knob_inner_space(length, width)), # LG_PLATE_COLUMN, get_knob_objects(length, width, LGPH), Translate(Vector(-length / 2 * LGBW, -LGBW / 2, -LGPH)), Rotate(Vector(0, 0, 90)))
def test_create_wrong_length_vector(self): """Test creation of Translate object.""" with self.assertRaisesRegexp( SdlSyntaxException, 'Vector TVector has more or less than 3 dimensions'): Translate(Vector(1, 2, 3, 4))
def setUp(self): """Setup test environment.""" self.sut = Translate(Vector(1, 2, 3))
def nonmoving(tvector=Vector(0, 0, 0), rvector=Vector(0, 0, 0)): """ docstring for lg_10036_car. @Todo: ApiDoc. :param tvector: :param rvector: """ part = Union( Comment(""" # ******************************************************************* # Objects (Step 1) # ******************************************************************* """), Comment('**** Start 2441 Red Car Base 7 x 4 x 2/3 ****'), std_brick(lg_2441.solid(), LG_RED, 0, 3 * LGPH, 0, -90, 0, 0), Comment('**** End 2441 Red Car Base 7 x 4 x 2/3 ****'), Comment(""" # ******************************************************************* # Objects (Step 2) # ******************************************************************* """), Comment('**** Start 3022 White Plate 2 x 2 ****'), std_brick(lg_3022.solid(), LG_WHITE, 2.5 * LGBW, 4 * LGPH, 0, -90, 0, 0), Comment('**** End 3022 White Plate 2 x 2 ****'), Comment('**** Start 2412b White Tile 1 x 2 Grille with Groove ****'), std_brick(lg_2412b.solid(), LG_WHITE, 0.5 * LGBW, 3 * LGPH, -1.5 * LGBW, -90, 90, 0), Comment('**** End 2412b White Tile 1 x 2 Grille with Groove ****'), Comment('**** Start 2412b White Tile 1 x 2 Grille with Groove ****'), std_brick(lg_2412b.solid(), LG_WHITE, 0.5 * LGBW, 3 * LGPH, 1.5 * LGBW, -90, 90, 0), Comment('**** End 2412b White Tile 1 x 2 Grille with Groove ****'), Comment(""" ******************************************************************** * Objects (Step 3) ******************************************************************** """), Comment('**** Start 3022 White Plate 2 x 2 ****'), std_brick(lg_3022.solid(), LG_WHITE, -2.5 * LGBW, 4 * LGPH, 0, -90, 0, 0), Comment('**** End 3022 White Plate 2 x 2 ****'), Comment('**** Start 3010 White Brick 1 x 4 ****'), std_brick(lg_3010.solid(), LG_WHITE, -1 * LGBW, 5 * LGPH, 0, -90, 0, 0), Comment('**** End 3010 White Brick 1 x 4 ****'), Comment(""" ******************************************************************** * Objects (Step 4) ******************************************************************** """), Comment('**** Start 3003 Yellow Brick 2 x 2 ****'), std_brick(lg_3003.solid(), LG_YELLOW, 0.5 * LGBW, 5 * LGPH, 0, -90, 0, 0), Comment('**** End 3003 Yellow Brick 2 x 2 ****'), Comment('**** 3788 White Car Mudguard 2 x 4 ****'), std_brick(lg_3788.solid(), LG_WHITE, 2.5 * LGBW, 6 * LGPH, 0, -90, 0, 0), Comment('**** 3788 White Car Mudguard 2 x 4 ****'), Comment(""" ******************************************************************** * Objects (Step 5) ******************************************************************** """), Comment('**** 3788 White Car Mudguard 2 x 4 ****'), std_brick(lg_3788.solid(), LG_WHITE, -2.5 * LGBW, 6 * LGPH, 0, -90, 0, 0), Comment('**** 3788 White Car Mudguard 2 x 4 ****'), Comment('**** 3021 Red Plate 2 x 3 ****'), std_brick(lg_3021.solid(), LG_RED, -1.5 * LGBW, 6 * LGPH, 0, -90, 0, 0), Comment('**** 3021 Red Plate 2 x 3 ****'), Comment('**** 3024 White Plate 1 x 1 ****'), std_brick(lg_3024.solid(), LG_WHITE, -1.5 * LGBW, 6 * LGPH, -2 * LGBW, -90, 0, 0), Comment('**** 3024 White Plate 1 x 1 ****'), Comment( '**** 4085c White Plate 1 x 1 with Clip Vertical - Type 3 ****'), std_brick(lg_4085c.solid(), LG_WHITE, -1 * LGBW, 6 * LGPH, 1.5 * LGBW, -90, 0, 0), Comment( '**** 4085c White Plate 1 x 1 with Clip Vertical - Type 3 ****'), Comment(""" ******************************************************************** * Objects (Step 6) ******************************************************************** """), Comment('**** 2436 White Bracket 1 x 2 - 1 x 4 ****'), std_brick(lg_2436.solid(), LG_WHITE, 3 * LGBW, 6 * LGPH, 0, -90, 0, 0), Comment('**** 2436 White Bracket 1 x 2 - 1 x 4 ****'), Comment('**** 3020 White Plate 2 x 4 ****'), std_brick(lg_3020.solid(), LG_WHITE, -1.5 * LGBW, 7 * LGPH, -LGBW, -90, 90, 0), Comment('**** 3020 White Plate 2 x 4 ****'), Comment(""" ******************************************************************** * Objects (Step 7) ******************************************************************** """), Comment('**** 4073 TrYello Plate 1 x 1 Round ****'), std_brick(lg_4073.clear(), LG_CLEAR_YELLOW, 4.1 * LGBW, 5 * LGPH, -1.5 * LGBW, 0, 90, 0), std_brick(lg_4073.clear(), LG_CLEAR_YELLOW, 4.1 * LGBW, 5 * LGPH, 1.5 * LGBW, 0, 90, 0), Comment('**** 4073 TrYello Plate 1 x 1 Round ****'), Comment('**** 2412b Red Tile 1 x 2 Grille with Groove ****'), std_brick(lg_2412b.solid(), LG_RED, 4.0 * LGBW, 4.7 * LGPH, 0, -90, 0, -90), Comment('**** 2412b Red Tile 1 x 2 Grille with Groove ****'), Comment('**** 3069b Black Tile 1 x 2 with Groove ****'), std_brick(lg_3069b.solid(), LG_BLACK, -2 * LGBW, 8 * LGPH, 0, -90, 180, 0), Comment('**** 3069b Black Tile 1 x 2 with Groove ****'), Comment('**** 4865 Black Panel 1 x 2 x 1 ****'), std_brick(lg_4865.solid(), LG_BLACK, -1.5 * LGBW, 10 * LGPH, 0, -90, 180, 0), Comment('**** 4865 Black Panel 1 x 2 x 1 ****'), Comment(""" ******************************************************************** * Objects (Step 8) ******************************************************************** """), Comment('**** 3004 White Brick 1 x 2 ****'), std_brick(lg_3004.solid(), LG_WHITE, -1.5 * LGBW, 10 * LGPH, -2 * LGBW, -90, 0, 0), Comment('**** 3004 White Brick 1 x 2 ****'), Comment('**** 3004 White Brick 1 x 2 ****'), std_brick(lg_3004.solid(), LG_WHITE, -1.5 * LGBW, 10 * LGPH, 1 * LGBW, -90, 0, 0), Comment('**** 3004 White Brick 1 x 2 ****'), Comment(""" ******************************************************************** * Objects (Step 9) ******************************************************************** """), Comment('**** 3020 White Plate 2 x 4 ****'), std_brick(lg_3020.solid(), LG_WHITE, -1.5 * LGBW, 11 * LGPH, -LGBW, -90, 90, 0), Comment('**** 3020 White Plate 2 x 4 ****'), Comment('**** 2357 White Brick 2 x 2 Corner ****'), std_brick(lg_2357.solid(), LG_WHITE, 3 * LGBW, 9 * LGPH, -1.5 * LGBW, -90, 0, 0), Comment('**** 2357 White Brick 2 x 2 Corner ****'), Comment('**** 2357 White Brick 2 x 2 Corner ****'), std_brick(lg_2357.solid(), LG_WHITE, 3 * LGBW, 9 * LGPH, 1.5 * LGBW, -90, 270, 0), Comment('**** 2357 White Brick 2 x 2 Corner ****'), Comment(""" ******************************************************************** * Objects (Step 10) ******************************************************************** """), Comment('**** 3069b Black Tile 1 x 2 with Groove ****'), std_brick(lg_3069b.solid(), LG_BLACK, -2 * LGBW, 12 * LGPH, 0 * LGBW, -90, 180, 0), Comment('**** 3069b Black Tile 1 x 2 with Groove ****'), Comment('**** 4865 Black Panel 1 x 2 x 1 ****'), std_brick(lg_4865.solid(), LG_BLACK, -1.5 * LGBW, 14 * LGPH, 0 * LGBW, -90, 180, 0), Comment('**** 4865 Black Panel 1 x 2 x 1 ****'), Comment('**** 3823 TrLtBlu Windscreen 2 x 4 x 2 ****'), # @Todo: Needs a lot of fixing std_brick(lg_3823.clear(), LG_CLEAR_CYAN, 2 * LGBW, 15 * LGPH, 0 * LGBW, -90, 0, 0), Comment('**** 3823 TrLtBlu Windscreen 2 x 4 x 2 ****'), Comment(""" ******************************************************************** * Objects (Step 11) ******************************************************************** """), Comment('**** 3853 White Window 1 x 4 x 3 ****'), std_brick(lg_3853.solid(), LG_WHITE, -3 * LGBW, 15 * LGPH, 0 * LGBW, -90, 180, 0), Comment('**** 3853 White Window 1 x 4 x 3 ****'), Comment(''' Comment('**** 3004 White Brick 1 x 2 ****'), std_brick( lg_3004.solid(), LG_WHITE, -1.5 * LGBW, 14 * LGPH, -1 * LGBW, -90, 180, 0 ), Comment('**** 3004 White Brick 1 x 2 ****'), Comment('**** 3004 White Brick 1 x 2 ****'), std_brick( lg_3004.solid(), LG_WHITE, -1.5 * LGBW, 14 * LGPH, 2 * LGBW, -90, 180, 0 ), Comment('**** 3004 White Brick 1 x 2 ****'), Comment('**** 3710 White Plate 1 x 4 ****'), # Todo: fix plate coloumns std_brick( lg_3710.solid(), LG_WHITE, -2 * LGBW, 15 * LGPH, 0 * LGBW, -90, 0, 0 ), Comment('**** 3710 White Plate 1 x 4 ****'), Comment(""" ******************************************************************** * Objects (Step 12) ******************************************************************** """), Comment('**** White Hinge Tile 1 x 4 ****'), # std_brick( # lg_4625.solid(), # LG_WHITE, -1*LGBW, 15*LGPH, 0*LGBW, # -90, 0, 0 # ), Comment('**** White Hinge Tile 1 x 4 ****'), Comment(""" ******************************************************************** # * Objects (Step 13) ******************************************************************** """), Comment('**** 3020 White Plate 2 x 4 ****'), std_brick( lg_3020.solid(), LG_WHITE, -2.5 * LGBW, 16 * LGPH, -1 * LGBW, -90, 90, 0 ), Comment('**** 3020 White Plate 2 x 4 ****'), '''), Rotate(rvector), Translate(tvector)) return part
def solid(): """@Todo: Docstring.""" return Union( Sphere(Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGCS), LGCS), Sphere(Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGCS), LGCS), Sphere(Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGPH + LGCS), LGCS), Sphere(Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGPH + LGCS), LGCS), Cylinder(Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGCS), Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGCS), LGCS), Cylinder(Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGPH + LGCS), Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGPH + LGCS), LGCS), Cylinder(Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGCS), Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGPH + LGCS), LGCS), Cylinder(Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGCS), Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGPH + LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, -LGBW + LGCS, -LGCS), Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, LGBW - LGCS, -LGCS), Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, -LGBW + LGCS, -LGPH + LGCS), Vector(-LGBW / 2 + LGCS, -LGBW + LGCS, -LGPH + LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, LGBW - LGCS, -LGPH + LGCS), Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGPH + LGCS), LGCS), Sphere(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS), LGCS), Sphere(Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGCS), LGCS), Sphere(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGBW + LGCS), LGCS), Sphere(Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGBW + LGCS), LGCS), Sphere(Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGCS), LGCS), Sphere(Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGCS), LGCS), Sphere(Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGBW + LGCS), LGCS), Sphere(Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGBW + LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, -LGBW + LGCS, -LGCS), Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, LGBW - LGCS, -LGCS), Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGBW + LGCS), Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGBW + LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGCS), Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGCS), LGCS), Cylinder( Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGBW + LGCS), Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGBW + LGCS), LGCS), Cylinder( Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGBW + LGCS), Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGBW + LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGBW + LGCS), Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGBW + LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGCS), Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS), Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGCS), LGCS), Cylinder( Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGCS), Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGBW + LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGCS), Vector(LGBW / 2 + LGWW - LGCS, 2 * LGBW - LGCS, -LGBW + LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGCS), Vector(LGBW / 2 + LGCS, -2 * LGBW + LGCS, -LGBW + LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS), Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGBW + LGCS), LGCS), Difference( Union( Box(Vector(LGBW / 2 + LGCS + LG_E, -LGBW + LGCS, 0), Vector(-LGBW / 2 + LGCS, LGBW - LGCS, -LGPH)), Box(Vector(LGBW / 2 + LGCS + LG_E, -LGBW, -LGCS), Vector(-LGBW / 2 + LGCS, LGBW, -LGPH + LGCS)), Box(Vector(LGBW / 2 + LGCS + LG_E, -LGBW + LGCS, -LGCS), Vector(-LGBW / 2, LGBW - LGCS, -LGPH + LGCS)), ), Union( Box(Vector(LGBW / 2 + LG_E, -LGBW + LGWW, -LG_TOP_HEIGHT), Vector(-LGBW / 2 + LGWW, LGBW - LGWW, -LGPH - LG_E)), Object(LG_KNOB_INNER_SPACE, Translate(Vector(0, -LGBW / 2, -LG_TOP_HEIGHT))), Object(LG_KNOB_INNER_SPACE, Translate(Vector(0, LGBW / 2, -LG_TOP_HEIGHT))), ), ), Box(Vector(LGBW / 2 + LGCS, 2 * LGBW - LGCS, 0), Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW + LGCS, -LGBW)), Box(Vector(LGBW / 2 + LGCS, 2 * LGBW, -LGCS), Vector(LGBW / 2 + LGWW - LGCS, -2 * LGBW, -LGBW + LGCS)), Box(Vector(LGBW / 2, 2 * LGBW - LGCS, -LGCS), Vector(LGBW / 2 + LGWW, -2 * LGBW + LGCS, -LGBW + LGCS)), Box(Vector(LG_KNOB_RADIUS, -LGBW / 2 + 0.06, -LGPH), Vector(LGBW / 2 + LG_E, -LGBW / 2 - 0.06, -LG_TOP_HEIGHT + LG_E)), Box(Vector(LG_KNOB_RADIUS, LGBW / 2 + 0.06, -LGPH), Vector(LGBW / 2 + LG_E, LGBW / 2 - 0.06, -LG_TOP_HEIGHT + LG_E)), Object(LG_PLATE_COLUMN, Translate(Vector(0, 0, -LGPH))), Object(lg_knob(), Rotate(Vector(0, 0, 90)), Translate(Vector(0, -LGBW / 2, 0))), Object(lg_knob(), Rotate(Vector(0, 0, 90)), Translate(Vector(0, LGBW / 2, 0))), Object(lg_tech_knob_logo(), Rotate(Vector(0, 0, 90)), Rotate(Vector(0, 90, 0)), Translate(Vector(LGBW / 2 + LGWW, -3 * LGBW / 2, -LGBW / 2))), Object(lg_tech_knob_logo(), Rotate(Vector(0, 0, 90)), Rotate(Vector(0, 90, 0)), Translate(Vector(LGBW / 2 + LGWW, -LGBW / 2, -LGBW / 2))), Object(lg_tech_knob_logo(), Rotate(Vector(0, 0, 90)), Rotate(Vector(0, 90, 0)), Translate(Vector(LGBW / 2 + LGWW, LGBW / 2, -LGBW / 2))), Object(lg_tech_knob_logo(), Rotate(Vector(0, 0, 90)), Rotate(Vector(0, 90, 0)), Translate(Vector(LGBW / 2 + LGWW, 3 * LGBW / 2, -LGBW / 2))), )
def test_checkered_floor_example(self): """Test examples/checkered_floor.pov.""" lsep = os.linesep ref = '#version 3.6;' + lsep ref += '#include "pov/tests/fixture/colors.inc"' + lsep ref += 'global_settings {' + lsep ref += ' assumed_gamma 1.0' + lsep ref += ' max_trace_level 5' + lsep ref += '}' + lsep ref += 'camera {' + lsep ref += ' location <0.0, 0.5, -4.0>' + lsep ref += ' look_at <0.0, 0.0, 0.0>' + lsep ref += ' right <1.33333333333, 0.0, 0.0>' + lsep ref += ' direction <0.0, 0.0, 1.5>' + lsep ref += '}' + lsep ref += 'sky_sphere {' + lsep ref += ' pigment {' + lsep ref += ' color_map {' + lsep ref += ' [0.0 color rgb <0.6, 0.7, 1.0>]' + lsep ref += ' [0.7 color rgb <0.0, 0.1, 0.8>]' + lsep ref += ' }' + lsep ref += ' gradient <0.0, 1.0, 0.0>' + lsep ref += ' }' + lsep ref += '}' + lsep ref += 'light_source {' + lsep ref += ' <0, 0, 0>' + lsep ref += ' color rgb <1, 1, 1>' + lsep ref += ' translate <-30, 30, -30>' + lsep ref += '}' + lsep ref += 'plane {' + lsep ref += ' <0.0, 1.0, 0.0>, -1' + lsep ref += ' texture {' + lsep ref += ' pigment {' + lsep ref += ' checker' + lsep ref += ' color rgb <1, 1, 1>' + lsep ref += ' color rgbft <0, 0, 1, 0, 0>' + lsep ref += ' scale 0.5' + lsep ref += ' }' + lsep ref += ' finish {' + lsep ref += ' ambient 0.1' + lsep ref += ' diffuse 0.8' + lsep ref += ' }' + lsep ref += ' }' + lsep ref += '}' + lsep ref += 'sphere {' + lsep ref += ' <0, 0, 0>, 1' + lsep ref += ' texture {' + lsep ref += ' pigment {' + lsep ref += ' color rgb <0.8, 0.8, 1.0>' + lsep ref += ' }' + lsep ref += ' finish {' + lsep ref += ' conserve_energy' + lsep ref += ' reflection {' + lsep ref += ' metallic' + lsep ref += ' 0.8' + lsep ref += ' }' + lsep ref += ' diffuse 0.3' + lsep ref += ' ambient 0.0' + lsep ref += ' specular 0.6' + lsep ref += ' }' + lsep ref += ' }' + lsep ref += '}' + lsep fix = SceneFile('test.pov') fix.append(Version(3.6)) fix.append(Include('pov/tests/fixture/colors.inc')) fix.append(GlobalSettings(assumed_gamma=1.0, max_trace_level=5)) # @TODO: Read from Config image_width = 800 # @TODO: Read from Config image_height = 600 fix.append( Camera(location=Vector(0.0, 0.5, -4.0), direction=1.5 * z, right=x * image_width / image_height, look_at=Vector(0.0, 0.0, 0.0)), SkySphere( Pigment(ColorMap({ 0.0: Color(rgb=Vector(0.6, 0.7, 1.0)), 0.7: Color(rgb=Vector(0.0, 0.1, 0.8)) }), gradient=y)), LightSource(Vector(0, 0, 0), Color(rgb=Vector(1, 1, 1)), Translate(Vector(-30, 30, -30)))) fix.append( Plane( y, -1, Texture( Pigment(Color(rgb=Vector(1, 1, 1)), Color(blue=1), checker=True, scale=0.5), Finish(diffuse=0.8, ambient=0.1))), Sphere((0, 0, 0), 1, Texture( Pigment(Color(rgb=Vector(0.8, 0.8, 1.0))), Finish(Reflection(0.8, metallic=True), diffuse=0.3, ambient=0.0, specular=0.6, conserve_energy=True)))) # ---------------------------------------------------- msg = '\n' + ''.join( difflib.ndiff(ref.splitlines(1), str(fix).splitlines(1))) self.assertEqual(ref, str(fix), msg)
def test_image_map_example(self): """@TODO: Apidoc.""" ref = os.linesep.join([ '#version 3.6;', '#include "pov/tests/fixture/colors.inc"', 'global_settings {', ' assumed_gamma 1.0', '}', 'camera {', ' location <0.0, 0.0, -4.0>', ' look_at <0.0, 0.0, 0.0>', ' right <1.33333333333, 0.0, 0.0>', ' direction <0.0, 0.0, 2.0>', '}', 'sky_sphere {', ' pigment {', ' color_map {', ' [0.0 color rgbft <0, 0, 0.6, 0, 0>]', ' [1.0 color rgb <1, 1, 1>]', ' }', ' gradient <0.0, 1.0, 0.0>', ' }', '}', 'light_source {', ' <0, 0, 0>', ' color rgb <1, 1, 1>', ' translate <-30, 30, -30>', '}', 'plane {', ' <0.0, 1.0, 0.0>, -1', ' texture {', ' pigment {', ' checker', ' color rgb <1, 1, 1>', ' color rgbft <0, 0, 1, 0, 0>', ' scale 0.5', ' }', ' finish {', ' reflection 0.2', ' }', ' }', '}', 'plane {', ' <0.0, 0.0, 1.0>, -1', ' texture {', ' pigment {', ' image_map {', ' png "test.png"', ' filter 0 0.8', ' filter 1 0.8', ' once', ' interpolate 2', ' }', ' translate <-0.5, -0.5, -0.0>', ' scale 2', ' }', ' finish {', ' ambient 0.3', ' }', ' }', '}', '' ]) fix = SceneFile('test.pov') fix.append(Version(3.6)) fix.append(Include('pov/tests/fixture/colors.inc')) fix.append(GlobalSettings(assumed_gamma=1.0, )) # @TODO: Read from Config image_width = 800 # @TODO: Read from Config image_height = 600 fix.append( Camera(location=Vector(0.0, 0.0, -4.0), direction=2 * z, right=x * image_width / image_height, look_at=Vector(0.0, 0.0, 0.0)), SkySphere( Pigment(ColorMap({ 0.0: Color(blue=0.6), 1.0: Color(rgb=Vector(1, 1, 1)) }), gradient=y)), LightSource(Vector(0, 0, 0), Color(rgb=Vector(1, 1, 1)), Translate(Vector(-30, 30, -30)))) fix.append( Plane( y, -1, Texture( Pigment(Color(rgb=Vector(1, 1, 1)), Color(blue=1), checker=True, scale=0.5), Finish(reflection=0.2))), Plane( z, -1, Texture( Pigment(ImageMap( 'png', 'test.png', Filter(0, 0.8), Filter(1, 0.8), interpolate=2, once=True, ), Translate(-0.5 * (x + y)), scale=2), Finish(ambient=0.3)))) # ---------------------------------------------------- msg = '\n' + ''.join( difflib.ndiff(ref.splitlines(1), str(fix).splitlines(1))) self.assertEqual(ref, str(fix), msg)
def solid(): """lg_4085c: Plate 1 x 1 with Clip Vertical.""" result = Union() for mir in range(0, 2): mirmatrix = Matrix(Vector(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0)) if mir == 1: mirmatrix = Matrix(Vector(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)) result.append( Union( Sphere(Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGCS), LGCS), Sphere(Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGPH + LGCS), LGCS), Sphere(Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGCS), LGCS), Sphere(Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGPH + LGCS), LGCS), Cylinder(Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGCS), Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGCS), LGCS), Cylinder( Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGPH + LGCS), Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGPH + LGCS), LGCS), Cylinder( Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGCS), Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGPH + LGCS), LGCS), Cylinder( Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGCS), Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGPH + LGCS), LGCS), Cylinder(Vector(LGBW / 2 - LGCS, 0.2 - LGCS, -LGCS), Vector(LGBW - LGWW, 0.2 - LGCS, -LGCS), LGCS), Cylinder(Vector(LGBW / 2 - LGCS, 0.2 - LGCS, -LGPH + LGCS), Vector(LGBW - LGWW, 0.2 - LGCS, -LGPH + LGCS), LGCS), Sphere( Vector( LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE), 0.13 + LGCS, -LGCS), LGCS), Cylinder( Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGCS), Vector( LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE), 0.13 + LGCS, -LGCS), LGCS), Sphere(Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGCS), LGCS), Cylinder(Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGCS), Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGCS), LGCS), Sphere(Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGCS), LGCS), Cylinder(Vector(LGBW, 2 * LGWW - LGCS, -LGCS), Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGCS), LGCS), Sphere( Vector( LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE), 0.13 + LGCS, -LGPH + LGCS), LGCS), Cylinder( Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGPH + LGCS), Vector( LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE), 0.13 + LGCS, -LGPH + LGCS), LGCS), Sphere(Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGPH + LGCS), LGCS), Cylinder( Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGPH + LGCS), Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGPH + LGCS), LGCS), Sphere( Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGPH + LGCS), LGCS), Cylinder( Vector(LGBW, 2 * LGWW - LGCS, -LGPH + LGCS), Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGPH + LGCS), LGCS), Cylinder( Vector( LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE), 0.13 + LGCS, -LGCS), Vector( LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE), 0.13 + LGCS, -LGPH + LGCS), LGCS), Cylinder(Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGCS), Vector(LGBW + LGWW - LGCS, 0.13 + LGCS, -LGPH + LGCS), LGCS), Cylinder( Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGCS), Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS, -LGPH + LGCS), LGCS), Box( Vector(LGBW + LGWW, 0.13 + LGCS, -LGCS), Vector(LGBW + LGWW - LGCS - LG_E, 2 * LGWW - LGCS, -LGPH + LGCS)), Box( Vector(LGBW, 2 * LGWW, -LGCS), Vector(LGBW + LGWW - LGCS, 2 * LGWW - LGCS - LG_E, -LGPH + LGCS)), Box( Vector( LGBW + (LG_KNOB_INNER_RADIUS + LGCS) * sin(LG_ANGLE), 0.13 + LGCS + LG_E, -LGCS), Vector(LGBW + LGWW - LGCS, 0.13, -LGPH + LGCS)), Difference( Box(Vector(LGBW + LGWW - LGCS, 0.13, 0), Vector(LGBW, 2 * LGWW - LGCS, -LGPH)), Union( Cylinder(Vector(LGBW, 0, 0), Vector(LGBW, 0, -LGPH), LG_KNOB_INNER_RADIUS), Cylinder(Vector(LGBW, 0, -LGPH - LG_E), Vector(LGBW, 0, -LGPH + LGCS), LG_KNOB_INNER_RADIUS + LGCS), Cylinder(Vector(LGBW, 0, LG_E), Vector(LGBW, 0, -LGCS), LG_KNOB_INNER_RADIUS + LGCS), Difference( Box(Vector(LGBW + LGWW, 0, LG_E), Vector(LGBW - LG_E, 0.13 + LGCS, -LGPH - LG_E)), Box(Vector(0, 0.4, LG_E), Vector(-0.4, -0.4, -LGPH - LG_E), Rotate(Vector(0, 0, -LG_ANGLE * 180 / pi)), Translate(Vector(LGBW, 0, 0))), ), ), ), mirmatrix)) result.append( Union( Cylinder(Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGCS), Vector(LGBW / 2 - LGCS, -LGBW / 2 + LGCS, -LGCS), LGCS), Cylinder(Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, -LGPH + LGCS), Vector(LGBW / 2 - LGCS, -LGBW / 2 + LGCS, -LGPH + LGCS), LGCS), Cylinder(Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGCS), Vector(-LGBW / 2 + LGCS, -LGBW / 2 + LGCS, -LGCS), LGCS), Cylinder(Vector(-LGBW / 2 + LGCS, LGBW / 2 - LGCS, -LGPH + LGCS), Vector(-LGBW / 2 + LGCS, -LGBW / 2 + LGCS, -LGPH + LGCS), LGCS), Difference( Union( Box(Vector(LGBW / 2 - LGCS, LGBW / 2 - LGCS, 0), Vector(-LGBW / 2 + LGCS, -LGBW / 2 + LGCS, -LGPH)), Box(Vector(LGBW / 2, LGBW / 2 - LGCS, -LGCS), Vector(-LGBW / 2, -LGBW / 2 + LGCS, -LGPH + LGCS)), Box(Vector(LGBW / 2 - LGCS, LGBW / 2, -LGCS), Vector(-LGBW / 2 + LGCS, -LGBW / 2, -LGPH + LGCS)), ), Union( Box( Vector(LGBW / 2 - LGWW, LGBW / 2 - LGWW, -LG_TOP_HEIGHT), Vector(-LGBW / 2 + LGWW, -LGBW / 2 + LGWW, -LGPH - LG_E)), Object(LG_KNOB_INNER_SPACE, Translate(Vector(0, 0, -LG_TOP_HEIGHT))), ), ), Object(lg_knob(), Rotate(Vector(0, 0, -90))), Intersection( Union( Torus(0.32 - LGCS, LGCS, Rotate(Vector(90, 0, 0)), Translate(Vector(LGBW, 0, -LGCS))), Torus(0.32 - LGCS, LGCS, Rotate(Vector(90, 0, 0)), Translate(Vector(LGBW, 0, -LGPH + LGCS))), Difference( Union( Cylinder(Vector(LGBW, 0, 0), Vector(LGBW, 0, -LGPH), 0.32 - LGCS), Cylinder(Vector(LGBW, 0, -LGCS), Vector(LGBW, 0, -LGPH + LGCS), 0.32), ), Union( Cylinder(Vector(LGBW, 0, 0), Vector(LGBW, 0, -LGPH), LG_KNOB_INNER_RADIUS), Cylinder(Vector(LGBW, 0, -LGPH - LG_E), Vector(LGBW, 0, -LGPH + LGCS), LG_KNOB_INNER_RADIUS + LGCS), Cylinder(Vector(LGBW, 0, LG_E), Vector(LGBW, 0, -LGCS), LG_KNOB_INNER_RADIUS + LGCS), ), ), ), Box(Vector(LGBW, 0.4, LG_E), Vector(LGBW / 2, -0.4, -LGPH - LG_E)), ), Intersection( Torus(LG_KNOB_INNER_RADIUS + LGCS, LGCS, Rotate(Vector(90, 0, 0))), Union( Box(Vector(0, 0.4, LGCS + LG_E), Vector(-0.4, -0.4, -LGCS - LG_E), Rotate(Vector(0, 0, LG_ANGLE * 180 / pi))), Box(Vector(0, 0.4, LGCS + LG_E), Vector(-0.4, -0.4, -LGCS - LG_E), Rotate(Vector(0, 0, -LG_ANGLE * 180 / pi))), ), Translate(Vector(LGBW, 0, -LGCS))), Intersection( Torus(LG_KNOB_INNER_RADIUS + LGCS, LGCS, Rotate(Vector(90, 0, 0))), Union( Box(Vector(0, 0.4, LGCS + LG_E), Vector(-0.4, -0.4, -LGCS - LG_E), Rotate(Vector(0, 0, LG_ANGLE * 180 / pi))), Box(Vector(0, 0.4, LGCS + LG_E), Vector(-0.4, -0.4, -LGCS - LG_E), Rotate(Vector(0, 0, -LG_ANGLE * 180 / pi))), ), Translate(Vector(LGBW, 0, -LGPH + LGCS))), Box(Vector(LGBW - LGWW - LGCS, 0.2 - LGCS, 0), Vector(LGBW / 2 - LGCS - LG_E, -0.2 + LGCS, -LGPH)), Box(Vector(LGBW - LGWW, 0.2, -LGCS), Vector(LGBW / 2 - LGCS - LG_E, -0.2, -LGPH + LGCS)))) return result
def solid(length=2, width=1): """return lg_3069b: Tile 1 x 2 with groove.""" return Union( Sphere(Vector(LGCS, LGCS, LGCS + 0.04), LGCS), Cylinder(Vector(LGCS, LGCS, LGCS + 0.04), Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04), LGCS), Sphere(Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04), Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), LGCS), Cylinder(Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), Vector(LGCS, LGCS, LGPH - LGCS), LGCS), Sphere(Vector(LGCS, LGCS, LGPH - LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGCS + 0.04), Vector(LGCS, LGCS, LGPH - LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGCS + 0.04), Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04), LGCS), Sphere(Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04), LGCS), Cylinder(Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04), Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Sphere(Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Cylinder(Vector(LGCS, LGCS, LGPH - LGCS), Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Cylinder( Vector(length * LGBW - LGCS, LGCS, LGCS + 0.04), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04), LGCS), Sphere(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04), LGCS), Cylinder( Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04), Vector(LGCS, width * LGBW - LGCS, LGCS + 0.04), LGCS), Cylinder( Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGCS + 0.04), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Sphere(Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Cylinder( Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS), Vector(LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Cylinder( Vector(length * LGBW - LGCS, LGCS, LGPH - LGCS), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH - LGCS), LGCS), Difference( Union( Box(Vector(LGCS, LGCS, 0.04), Vector(length * LGBW - LGCS, width * LGBW - LGCS, LGPH)), Box(Vector(LGCS, 0, LGCS + 0.04), Vector(length * LGBW - LGCS, width * LGBW, LGPH - LGCS)), Box(Vector(0, LGCS, LGCS + 0.04), Vector(length * LGBW, width * LGBW - LGCS, LGPH - LGCS)), Box( Vector(0.04, 0.04, 0), Vector(length * LGBW - 0.04, width * LGBW - 0.04, 0.04 + LG_E)), ), Box( Vector(LGWW, LGWW, -LGCS), Vector(length * LGBW - LGWW, width * LGBW - LGWW, LG_PLATE_INNER_HEIGHT)), ), Translate(Vector(-LGBW, -0.5 * LGBW, -LGPH)), Rotate(Vector(0, 0, 90)))
def std_brick(brick, texture, transx, transy, transz, rotatex, rotatey, rotatez): """Create rotated + translated Brick object.""" return Object(brick, texture, Rotate(Vector(rotatex, rotatey, rotatez)), Translate(Vector(transx, transy, transz)))
def clear(): """return lg_3823: Windscreen 2 x 4 x 2.""" result = Merge() for mir in range(0, 2): mirmatrix = Matrix(Vector(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) if mir == 1: mirmatrix = Matrix(Vector(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0)) result.append( Merge( Cylinder(Vector(0, 2 * LGBW - LGCS, -LGCS), Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS), LGCS), Sphere(Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS), LGCS), Sphere( Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, -2 * LGBH + LGCS), LGCS), Cylinder( Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS), Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, -2 * LGBH + LGCS), LGCS), Cylinder(Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, -LGCS), Vector(-LGBW / 2 + LGCS, 1.5 * LGBW + 0.12, -LGCS), LGCS), Intersection( Torus(LGBW / 2 - LGCS, LGCS, Rotate(Vector(90, 0, 0))), Box( Vector(-LGBW / 2 - LG_E, -LGBW / 2 - LG_E, LGCS + LG_E), Vector(0, 0, -LGCS - LG_E)), Translate(Vector(0, 1.5 * LGBW + 0.12, -LGCS))), Cylinder( Vector(0, LGBW + 0.12 + LGCS, -LGCS), Vector(LGBW / 2 - LGWW / 2 + LGCS, LGBW + 0.12 + LGCS, -LGCS), LGCS), Cylinder( Vector(LGBW, 2 * LGBW - LGCS, -2 * LGBH + LGCS), Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, -2 * LGBH + LGCS), LGCS), Intersection( Difference( Cylinder( Vector(0, 0, 0), Vector(0, 0, -2.5 * LGPH), # Vector(0, 0, -5 * LGPH), LGBW / 2), Cylinder( Vector(0, 0, LGCS + LG_E), Vector(0, 0, -3 * LGPH), # Vector(0, 0, -6 * LGPH), LGBW / 2 - LGWW), ), Box(Vector(LGBW / 2 + LG_E, LGBW / 2 + LG_E, LGCS + LG_E), Vector(0, 0, -2 * LGBH)), Matrix( Vector(1, 0, 2 / LGBW * LGCS * sin(LG_ANGLE * pi / 180), 0, 1, 0, -1 / 2, 0, 1, LGCS * (cos(LG_ANGLE * pi / 180) - 1), 3 * LGBW / 2, -LGCS))), Intersection( Difference( Cylinder( Vector(0, 0, -2.5 * LGPH), Vector(0, 0, -5 * LGPH), # Vector(0, 0, -5 * LGPH), LGBW / 2), Cylinder( Vector(0, 0, -2.5 * LGPH), Vector(0, 0, -5 * LGPH), # Vector(0, 0, -6 * LGPH), LGBW / 2 - LGWW), ), Box(Vector(LGBW / 2 + LG_E, LGBW / 2 + LG_E, LGCS + LG_E), Vector(0, 0, -2 * LGBH)), Translate(Vector(1 * LGBW, 0 * LGBW, 0)), Matrix( Vector( 1, 0, 0, # 2 / LGBW * LGCS * sin(LG_ANGLE * pi / 180), 0, 1, 0, 0, 0, 1, 0, # LGCS * (cos(LG_ANGLE * pi / 180) -1), 3 * LGBW / 2, -LGCS)), ), Intersection( Torus(LGBW / 2 - LGCS, LGCS, Rotate(Vector(90, 0, 0))), Box(Vector(LGBW / 2 + LG_E, LGBW / 2 + LG_E, LGCS + LG_E), Vector(0, 0, -LGCS - LG_E)), Translate(Vector(0, 3 * LGBW / 2, -LGCS))), Intersection( Torus(LGBW / 2 - LGCS, LGCS, Rotate(Vector(90, 0, 0))), Box(Vector(LGBW / 2 + LG_E, LGBW / 2 + LG_E, LGCS + LG_E), Vector(0, 0, -LGCS - LG_E)), Translate(Vector(LGBW, 3 * LGBW / 2, -5 * LGPH - LGCS))), Intersection( Torus(LGBW / 2 - LGCS, LGCS, Rotate(Vector(90, 0, 0))), Box(Vector(LGBW / 2 + LG_E, LGBW / 2 + LG_E, LGCS + LG_E), Vector(0, 0, -LGCS - LG_E)), Translate(Vector(LGBW, 3 * LGBW / 2, -2 * LGBH + LGCS))), Difference( Merge( Cylinder( Vector(LGBW / 2 + LGCS, LGBW + LGCS, -5 * LGPH - LGCS), Vector(-LGCS, LGBW + LGCS, -5 * LGPH - LGCS), LGCS), Cylinder( Vector(-LGBW / 2 + LGCS, 1.5 * LGBW - LGCS, -5 * LGPH - LGCS), Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGWW + LG_E, -5 * LGPH - LGCS), LGCS), Cylinder( Vector(LGBW / 2 + LGCS, LGBW + LGCS, -6 * LGPH + LGCS), Vector(-LGCS, LGBW + LGCS, -6 * LGPH + LGCS), LGCS), Cylinder( Vector(-LGBW / 2 + LGCS, 1.5 * LGBW - LGCS, -6 * LGPH + LGCS), Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, -6 * LGPH + LGCS), LGCS), Box( Vector(LGBW / 2 + LGCS + LG_E, LGBW + LGCS, -2 * LGBH), Vector(-LGBW / 2, LGBW + LGWW, -2 * LGBH + LGCS + LG_E)), Box( Vector(-LGBW / 2 + LGCS, LGBW + LGCS, -2 * LGBH), Vector(-LGBW / 2 + LGWW, 2 * LGBW - LGCS, -2 * LGBH + LGCS + LG_E)), Box( Vector(LGBW + LGCS, 2 * LGBW - LGCS, -5 * LGPH), Vector(-LGBW / 2 + LGCS, LGBW + LGCS, -2 * LGBH + LG_PLATE_INNER_HEIGHT)), Box( Vector(LGBW / 2 + LGCS + LG_E, LGBW, -5 * LGPH - LGCS), Vector(-LGBW / 2, LGBW + LGWW, -2 * LGBH + LGCS)), Box( Vector(-LGBW / 2, LGBW + LGCS, -5 * LGPH - LGCS), Vector(-LGBW / 2 + LGWW, 2 * LGBW - LGCS, -2 * LGBH + LGCS)), ), Cylinder(Vector(-LGBW / 2, LGBW, -2 * LGBH - LG_E), Vector(-LGBW / 2, LGBW, -5 * LGPH + LG_E), LGBW / 2), ), Cylinder( Vector(LGBW / 2, 1.5 * LGBW, -5 * LGPH - LG_TOP_HEIGHT + LG_E), Vector(LGBW / 2, 1.5 * LGBW, -2 * LGBH), LG_KNOB_INNER_RADIUS), Cylinder(Vector(LGBW, LGBW, -5 * LGPH - LG_TOP_HEIGHT + LG_E), Vector(LGBW, LGBW, -2 * LGBH), LG_KNOB_INNER_RADIUS), Intersection( Difference( Merge( Cylinder( Vector(LGBW, 1.5 * LGBW, -5 * LGPH - LGCS), Vector(LGBW, 1.5 * LGBW, -2 * LGBH + LGCS), LGBW / 2), Cylinder(Vector(LGBW, 1.5 * LGBW, -5 * LGPH), Vector(LGBW, 1.5 * LGBW, -2 * LGBH), LGBW / 2 - LGCS), ), Cylinder( Vector(LGBW, 1.5 * LGBW, -5 * LGPH - LG_TOP_HEIGHT), Vector(LGBW, 1.5 * LGBW, -2 * LGBH - LG_E), LGBW / 2 - LGWW), ), Box( Vector(LGBW, 1.5 * LGBW, -5 * LGPH + LGCS), Vector(1.5 * LGBW + LG_E, 2 * LGBW + LG_E, -2 * LGBH - LG_E)), ), Difference( Merge( Box( Vector(LGBW, 2 * LGBW, -2 * LGBH + LGCS), Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS - LG_E, -LGCS)), Box(Vector(LGBW, 2 * LGBW - LGWW, -2 * LGBH), Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, 0)), ), Box( Vector(LGBW + LG_E, LGBW / 2 + LG_E, LGCS + LG_E), Vector(0, 0, -2 * LGBH), Matrix( Vector(1, 0, 2 / LGBW * LGCS * sin(LG_ANGLE * pi / 180), 0, 1, 0, -1 / 2, 0, 1, LGCS * (cos(LG_ANGLE * pi / 180) - 1), 3 * LGBW / 2, -LGCS))), ), Box(Vector(-LGBW / 2, 2 * LGBW - LGCS, -5 * LGPH - LGCS), Vector(-LGBW / 2 + LGCS + LG_E, 2 * LGBW - LGWW, -LGCS)), Intersection( Merge( Cylinder(Vector(0, 0, 0), Vector(0, 0, -LGCS - LG_E), LGBW / 2 - LGCS), Cylinder(Vector(0, 0, -LGCS), Vector(0, 0, -LGWW), LGBW / 2), ), Box(Vector(-LGBW / 2 - LG_E, -LGBW / 2 - LG_E, LG_E), Vector(0, 0, -LGWW - LG_E)), Translate(Vector(0, 1.5 * LGBW + 0.12, 0))), Intersection( Merge( Cylinder(Vector(0, 0, 0), Vector(0, 0, -LGCS - LG_E), LGBW / 2 - LGCS), Cylinder(Vector(0, 0, -LGCS), Vector(0, 0, -LGWW), LGBW / 2), ), Box(Vector(LGBW / 2 - LG_E, LGBW / 2 - LG_E, LG_E), Vector(0, 0, -LGWW - LG_E)), Translate(Vector(0, 1.5 * LGBW, 0))), Box(Vector(LGBW / 2 - LGCS, LGBW + 0.12 + LGCS, 0), Vector(0, 1.5 * LGBW, -LGCS - LG_E)), Box(Vector(LGBW / 2 - LGCS, LGBW + 0.12, -LGCS), Vector(0, 1.5 * LGBW, -LGWW)), Box(Vector(-LGBW / 2 + LGCS, 2 * LGBW - LGCS, 0), Vector(0, 1.5 * LGBW + 0.12, -LGCS - LG_E)), Box(Vector(-LGBW / 2, 2 * LGBW - LGCS, -LGCS), Vector(0, 1.5 * LGBW + 0.12, -LGWW)), Object( lg_tech_knob_logo_clear(), Rotate(Vector(0, 0, 90)), Scale(Vector(1, 1 - 2 * mir, 1)), Translate(Vector(0, 1.5 * LGBW, 0)), ), mirmatrix)) result.append( Merge( Cylinder( Vector(3 * LGBW / 2 - LGCS, 3 * LGBW / 2, -5 * LGPH - LGCS), Vector(3 * LGBW / 2 - LGCS, -3 * LGBW / 2, -5 * LGPH - LGCS), LGCS), Cylinder( Vector(3 * LGBW / 2 - LGCS, 3 * LGBW / 2, -2 * LGBH + LGCS), Vector(3 * LGBW / 2 - LGCS, -3 * LGBW / 2, -2 * LGBH + LGCS), LGCS), Cylinder(Vector(LGBW / 2 - LGCS, 3 * LGBW / 2, -LGCS), Vector(LGBW / 2 - LGCS, -3 * LGBW / 2, -LGCS), LGCS), Cylinder( Vector(LGBW / 2 - LGWW / 2 + LGCS, LGBW + 0.12 + LGCS, -LGCS), Vector(LGBW / 2 - LGWW / 2 + LGCS, -LGBW - 0.12 - LGCS, -LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, LGBW + LGCS, -2 * LGBH + LGCS), Vector(LGBW / 2 + LGCS, -LGBW - LGCS, -2 * LGBH + LGCS), LGCS), Cylinder(Vector(LGBW / 2 + LGCS, LGBW + LGCS, -5 * LGPH - LGCS), Vector(LGBW / 2 + LGCS, -LGBW - LGCS, -5 * LGPH - LGCS), LGCS), Box(Vector(LGBW / 2 + LGCS, LGBW + LGWW, -2 * LGBH), Vector(LGBW / 2 + LGWW, -LGBW - LGWW, -2 * LGBH + LGCS + LG_E)), Box( Vector(1.5 * LGBW - LGCS, 1.5 * LGBW, -2 * LGBH), Vector(1.5 * LGBW - LGWW, -1.5 * LGBW, -2 * LGBH + LGCS + LG_E)), Box(Vector(LGBW / 2, LGBW + LGWW, -5 * LGPH - LGCS), Vector(LGBW / 2 + LGWW, -LGBW - LGWW, -2 * LGBH + LGCS)), Box(Vector(1.5 * LGBW, 1.5 * LGBW, -5 * LGPH - LGCS), Vector(1.5 * LGBW - LGWW, -1.5 * LGBW, -2 * LGBH + LGCS)), Box( Vector(1.5 * LGBW - LGCS, 1.5 * LGBW, -5 * LGPH), Vector(LGBW / 2 + LGCS, -1.5 * LGBW, -2 * LGBH + LG_PLATE_INNER_HEIGHT)), Difference( Merge( Box( Vector(LGBW / 2, 1.5 * LGBW, 0), Vector(LGBW / 2 - LGWW, -1.5 * LGBW, -2.5 * LGPH), Matrix( Vector(1, 0, 2 / LGBW * LGCS * sin(LG_ANGLE * pi / 180), 0, 1, 0, -1 / 2, 0, 1, LGCS * (cos(LG_ANGLE * pi / 180) - 1), 0, -LGCS))), Box(Vector(LGBW / 2 - LGCS, 1.5 * LGBW, 0), Vector(LGBW / 2 - LGWW, -1.5 * LGBW, -LGWW / 2)), ), Union( Box(Vector(LGBW / 2 - LGWW / 2, LGBW + 0.12 + LGCS, LG_E), Vector(LGWW, -LGBW - 0.12 - LGCS, -LGWW - LG_E)), Box( Vector(LGBW / 2 - LGWW / 2 + LGCS, LGBW + 0.12 + LGCS, LG_E), Vector(LGWW, -LGBW - 0.12 - LGCS, -LGCS)), ), ), Difference( Merge( Box( Vector(LGBW / 2, 1.5 * LGBW, 0), Vector(LGBW / 2 - LGWW, -1.5 * LGBW, -2.5 * LGPH), # Matrix( # Vector( # 1, 0, # 2 / LGBW * LGCS * sin(LG_ANGLE * pi / 180), # 0, 1, 0, # -1 / 2, 0, 1, # LGCS * (cos(LG_ANGLE * pi / 180) - 1), # 0, -LGCS # ) # ) ), Box(Vector(LGBW / 2 - LGCS, 1.5 * LGBW, 0), Vector(LGBW / 2 - LGWW, -1.5 * LGBW, -LGWW / 2)), ), Union( Box(Vector(LGBW / 2 - LGWW / 2, LGBW + 0.12 + LGCS, LG_E), Vector(LGWW, -LGBW - 0.12 - LGCS, -LGWW - LG_E)), Box( Vector(LGBW / 2 - LGWW / 2 + LGCS, LGBW + 0.12 + LGCS, LG_E), Vector(LGWW, -LGBW - 0.12 - LGCS, -LGCS)), ), Translate(Vector(LGBW, 0, -2.5 * LGPH)), ), Cylinder(Vector(LGBW, 0, -5 * LGPH - LG_TOP_HEIGHT + LG_E), Vector(LGBW, 0, -2 * LGBH), LG_KNOB_INNER_RADIUS), ), # Rotate(Vector(0, 0, -45)) ) return result
def test_scene1(self): """ Test Scene 1. Example taken from: http://www.f-lohmueller.de/pov_tut/basic/povkurs3.htm """ lsep = os.linesep ref = "#version 3.6;" + lsep ref += "global_settings {" + lsep ref += " assumed_gamma 1.0" + lsep ref += "}" + lsep ref += "#default {" + lsep ref += " finish {" + lsep ref += " ambient 0.1" + lsep ref += " diffuse 0.9" + lsep ref += " }" + lsep ref += "}" + lsep ref += "#include \"pov/tests/fixture/colors.inc\"" + lsep ref += "#include \"pov/tests/fixture/textures.inc\"" + lsep ref += "camera {" + lsep ref += " location <0.0, 1.0, -3.0>" + lsep ref += " angle 75" + lsep ref += " right <1.33333333333, 0.0, 0.0>" + lsep ref += " look_at <0.0, 1.0, 0.0>" + lsep ref += "}" + lsep ref += "light_source {" + lsep ref += " <1500, 3000, -2500>" + lsep ref += " color White" + lsep ref += "}" + lsep ref += "plane {" + lsep ref += " <0.0, 1.0, 0.0>, 1.0" + lsep ref += " texture {" + lsep ref += " pigment {" + lsep ref += " bozo" + lsep ref += " color_map {" + lsep ref += " [0.0 color rgb <0.05, 0.15, 0.45>]" + lsep ref += " [0.5 color rgb <0.05, 0.15, 0.45>]" + lsep ref += " [0.85 color rgb <0.2, 0.2, 0.2>]" + lsep ref += " [1.0 color rgb <0.5, 0.5, 0.5>]" + lsep ref += " [0.7 color rgb <1.0, 1.0, 1.0>]" + lsep ref += " }" + lsep ref += " scale <2.5, 2.5, 3.75>" + lsep ref += " translate <0.0, 0.0, 0.0>" + lsep ref += " turbulence 0.92" + lsep ref += " }" + lsep ref += " finish {" + lsep ref += " ambient 1.0" + lsep ref += " diffuse 0.0" + lsep ref += " }" + lsep ref += " }" + lsep ref += " hollow" + lsep ref += " scale 10000.0" + lsep ref += "}" + lsep ref += "fog {" + lsep ref += " color rgb <0.8, 0.8, 0.8>" + lsep ref += " turbulence 1.8" + lsep ref += " fog_offset 0.1" + lsep ref += " fog_alt 1.5" + lsep ref += " fog_type 2" + lsep ref += " distance 50.0" + lsep ref += "}" + lsep ref += "plane {" + lsep ref += " <0.0, 1.0, 0.0>, 0.0" + lsep ref += " texture {" + lsep ref += " pigment {" + lsep ref += " color rgb <0.22, 0.45, 0.0>" + lsep ref += " }" + lsep ref += " normal {" + lsep ref += " bumps 0.75" + lsep ref += " scale 0.015" + lsep ref += " }" + lsep ref += " finish {" + lsep ref += " phong 0.1" + lsep ref += " }" + lsep ref += " }" + lsep ref += "}" + lsep ref += "sphere {" + lsep ref += " <0.0, 0.0, 0.0>, 0.75" + lsep ref += " texture {" + lsep ref += " pigment {" + lsep ref += " color rgb <0.9, 0.55, 0.0>" + lsep ref += " }" + lsep ref += " finish {" + lsep ref += " phong 1.0" + lsep ref += " }" + lsep ref += " }" + lsep ref += " translate <0.85, 1.1, 0.0>" + lsep ref += "}" + lsep fix = SceneFile('test.pov') fix.append(Version(3.6)) fix.append(GlobalSettings(assumed_gamma=1.0)) fix.append(Default(Finish(ambient=0.1, diffuse=0.9))) fix.append(Include('pov/tests/fixture/colors.inc'), Include('pov/tests/fixture/textures.inc')) # @TODO: Read from Config image_width = 800 # @TODO: Read from Config image_height = 600 fix.append( Camera(location=Vector(0.0, 1.0, -3.0), look_at=Vector(0.0, 1.0, 0.0), right=(x * image_width / image_height), angle=75), LightSource(Vector(1500, 3000, -2500), color='White')) fix.append( Plane(Vector(0.0, 1.0, 0.0), 1.0, Texture( Pigment(ColorMap({ 0.00: Color(rgb=Vector(0.05, 0.15, 0.45)), 0.50: Color(rgb=Vector(0.05, 0.15, 0.45)), 0.70: Color(rgb=Vector(1.0, 1.0, 1.0)), 0.85: Color(rgb=Vector(0.2, 0.2, 0.2)), 1.00: Color(rgb=Vector(0.5, 0.5, 0.5)) }), bozo=True, turbulence=0.92, scale=Vector(1.0, 1.0, 1.5) * 2.5, translate=Vector(0.0, 0.0, 0.0)), Finish(ambient=1.0, diffuse=0.0)), hollow=True, scale=10000.0)) fix.append( Fog(Color(rgb=Vector(1, 1, 1)) * 0.8, fog_type=2, turbulence=1.8, fog_offset=0.1, fog_alt=1.5, distance=50.0)) fix.append( Plane( Vector(0.0, 1.0, 0.0), 0.0, Texture(Pigment(Color(rgb=Vector(0.22, 0.45, 0.0))), Normal(bumps=0.75, scale=0.015), Finish(phong=0.1))), Sphere( Vector(0.0, 0.0, 0.0), 0.75, Texture(Pigment(Color(rgb=Vector(0.9, 0.55, 0.0))), Finish(phong=1.0)), Translate(Vector(0.85, 1.1, 0.0)))) # ---------------------------------------------------- msg = '\n' + ''.join( difflib.ndiff(ref.splitlines(1), str(fix).splitlines(1))) self.assertEqual(ref, str(fix), msg)