예제 #1
0
 def __init__(self,
              hash_prev: bytes,
              difficulty: int,
              transactions: List,
              nonce: int = 0,
              extra_nonce: int = 0,
              hash: bytes = None,
              merkle_root=None):
     self._hash_prev = hash_prev
     self._difficulty = difficulty
     self._target = create_target(service.hash_f.bits, difficulty)
     self._transactions = transactions
     self._nonce = nonce
     self.extra_nonce = extra_nonce
     self._hash = hash
     self._merkle_root = merkle_root
     self._merkle_tree = None
     self._bytes = None
예제 #2
0
    camera_position, target_position = (3, -10, 8), (0.3, -1.8, 0.5)  # DE
    #camera_position, target_position = (3, -10, 8), (0.3, 0.0, 0.5)  # AT
    #camera_position, target_position = (3, -10, 8), (-0.1, -0.4, 1.0)  # CH
    #camera_position, target_position = (-2, -10, 8), (0.0, -2.6, 1.0)  # GB

    #camera_type, ortho_scale = 'ORTHO', 15
    camera_type, ortho_scale = 'PERSP', 18
    render_idx = 0

    # Remove all elements in scene
    bpy.ops.object.select_all()
    bpy.ops.object.delete(use_global=False)

    # Create scene
    target = utils.create_target(target_position)
    camera = utils.create_camera(camera_position, target=target,
        camera_type=camera_type, ortho_scale=ortho_scale, lens=28)
        #type='ORTHO', ortho_scale=12)
    sun = utils.create_lamp((-5, 5, 10), 'SUN', target=target)

    # Set background color
    bpy.context.scene.world.color = (0.7, 0.7, 0.7)

    # Ambient occlusion
    bpy.context.scene.world.light_settings.use_ambient_occlusion = True
    # TODO update below line
    #bpy.context.scene.world.light_settings.samples = 8

    # Load points from existing geojson file or load them with Overpass API
    filepath = 'total_flexfare.json'.format(iso_a2, tag_key, tag_value)
예제 #3
0
    bm.free()
    obj = bpy.data.objects.new("Voronoi", me)
    bpy.context.scene.collection.objects.link(obj)

    # Create and assign materials to object
    for color in colors:
        mat = utils.create_material(convert_hsv(color))
        obj.data.materials.append(mat)


if __name__ == '__main__':
    print(__file__)

    # Remove all elements
    utils.remove_all()

    # Create object
    voronoi_landscape()

    # Create camera and lamp
    target = utils.create_target((0, 0, 3))
    utils.create_camera((-8, -12, 11), target, type='ORTHO', ortho_scale=5)
    utils.create_light((5, -5, 10), target=target, type='SUN')

    # Render scene
    utils.render('rendering',
                 'vornoi_landscape',
                 512,
                 512,
                 render_engine='CYCLES')
                    cap_ends=True, segments=6,
                    diameter1=r2, diameter2=r2,
                    depth=0.1*r2, matrix=T @ M0 @ M1 @ Rot)
        return bm


if __name__ == '__main__':
    # Remove all elements
    bpy.ops.object.select_all(action="SELECT")
    bpy.ops.object.delete(use_global=False)

    # Creata phyllotaxis flower
    flower = PhyllotaxisFlower(bpy.context.scene)

    # Create camera and lamp
    target = utils.create_target((0, 0, -1.5))
    camera = utils.create_camera((-21.0, -21.0, 12.5), target, 35)
    sun = utils.create_light((-5, 5, 10), 'SUN', target=target)

    # Select colors
    palette = [(3,101,100), (205,179,128)]
    # Convert color and apply gamma correction
    palette = [tuple(pow(float(c)/255, 2.2) for c in color)
                for color in palette]

    # Smooth surface and add subsurf modifier
    utils.set_smooth(flower.obj, 2)

    # Set background color of scene
    bpy.context.scene.world.use_nodes = False
    bpy.context.scene.world.color = palette[0]