def project_depth()

in touch_charts/models.py [0:0]


	def project_depth(self, depths, pos, rot, dim=100):
		# reshape the plane to have the same position and orientation as the touch sensor when the touch occurred
		batch_size = depths.shape[0]
		planes = self.orig_plane.view(1 , -1 , 3).expand(batch_size, -1, 3)
		planes = torch.bmm(rot, planes.permute(0, 2, 1)).permute(0, 2, 1)
		planes += pos.view(batch_size, 1, 3)

		# add the depth in the same direction as the normal of the sensor plane
		init_camera_vector = torch.FloatTensor((1, 0, 0)).cuda().view(1, 3, 1) .expand(batch_size, 3, 1 )
		camera_vector = torch.bmm(rot, init_camera_vector).permute(0, 2, 1)
		camera_vector = F.normalize(camera_vector, p=2, dim=-1).view(batch_size, 1, 1, 3).expand(batch_size, dim, dim, 3)
		depth_update = depths.unsqueeze(-1) * camera_vector
		local_depth = (planes + depth_update.view(batch_size, -1, 3)).view(batch_size, -1, 3)

		return local_depth