def test_value_update(): v = View('__') v.position = (0, 0, 10) v.direction = (0, 1, 0) v.up_vector = (0, 0, 1) v.type = 'l' v.h_size = 240 v.v_size = 300 v.shift = -10 v.lift = -25 v.fore_clip = 30 v.aft_clip = 50 assert v.position == (0, 0, 10) assert v.direction == (0, 1, 0) assert v.up_vector == (0, 0, 1) assert v.type == 'l' assert v.h_size == 240 assert v.v_size == 300 assert v.shift == -10 assert v.lift == -25 assert v.fore_clip == 30 assert v.aft_clip == 50 assert v.to_radiance() == '-vtl -vp 0.0 0.0 10.0 -vd 0.0 1.0 0.0' \ ' -vu 0.0 0.0 1.0 -vh 240.0 -vv 300.0 -vs -10.0 -vl -25.0 ' \ '-vo 30.0 -va 50.0'
def test_from_grid_vth(): v = View('test_vth') v.position = (0, 0, 0) v.direction = (0, 1, 0) v.up_vector = (0, 0, 1) v.type = 'h' v.h_size = 180 v.v_size = 180 grid = v.grid(x_div_count=2, y_div_count=5) from_grid = View.from_grid(grid) assert v.to_radiance() == from_grid.to_radiance()
def test_from_grid_unf(): v = View('test_vta') v.position = (3, 7, 1.8) v.direction = (0, 1, 0) v.up_vector = (0, 0, 1) v.type = 'a' v.h_size = 360 v.v_size = 360 grid = [ './tests/assets/view/view_0000.unf', './tests/assets/view/view_0001.unf', './tests/assets/view/view_0002.unf', './tests/assets/view/view_0003.unf', './tests/assets/view/view_0004.unf' ] from_grid = View.from_grid(grid) assert v.to_radiance() == from_grid.to_radiance()
def test_grid_dimension(): v = View('test_vtv') v.position = (0, 0, 0) v.direction = (0, 1, 0) v.up_vector = (0, 0, 1) v.type = 'v' v.h_size = 60 v.v_size = 60 grid = v.grid(x_div_count=1, y_div_count=1) from_grid = View.from_grid(grid) assert v.to_radiance() == from_grid.to_radiance() grid = v.grid(x_div_count=2, y_div_count=4) from_grid = View.from_grid(grid) assert v.to_radiance() == from_grid.to_radiance() grid = v.grid(x_div_count=1, y_div_count=10) from_grid = View.from_grid(grid) assert v.to_radiance() == from_grid.to_radiance() grid = v.grid(x_div_count=10, y_div_count=100) from_grid = View.from_grid(grid) assert v.to_radiance() == from_grid.to_radiance()