
sensor_model_width = 100;
sensor_model_height = 100;

map_width = 800;
map_height = 800;
arena = ones(map_width,map_height);

sample_sensor = sensor_model(:,:, 60);

%sample data:
x = 200;
y = 100;

dx = x;
dy = y;

objTheta = pi;
%objTheta = 0;

translation_mat = [1,   0, 0;
				   0,   1, 0;
				   dx, dy, 1];

rotation_mat = [cos(objTheta), sin(objTheta), 0;
			   -sin(objTheta), cos(objTheta), 0
			   			    0,			   0, 1];

udata = [-1, 1] * sensor_model_width/2;
vdata = [-1, 1] * sensor_model_height/2;
xdata = [-1, 1] * map_width/2;
ydata = [-1, 1] * map_height/2;

transformation_mat = rotation_mat * translation_mat;
translation = maketform('affine', transformation_mat);

sensor = imtransform(sample_sensor, translation,... 
		'UData', udata, 'Vdata', vdata,...
		'XData', xdata, 'YData', ydata,...
		'Size', [map_width, map_height], 'FillValues', 1);

size(arena)
size(sensor)

arena = arena.*sensor;

image(arena.*20);
