%通过光源source参数，计算出射光子photon,photonoriginalweight为光子初始权重
function [photon_]=transmitter_emit(transmitter_, photonoriginalweight_)
%Initialization of the position of the photon
photon_.positioninoriginal=transmitter_.positioninoriginal;
%Initialization of the weight of the photon
photon_.weight=photonoriginalweight_;
%Initialization of the path of the photon
photon_.path=0;%光子所走的路程
%Initialization of the scattering count of the photon
photon_.scattercount=0;%光子的散射次数
%sampling theta
photon_.theta=acos(1-rand()*(1-cos(transmitter_.delta)));
%sampling fai
photon_.fai=2*pi*rand();
%rotating matrix: the positive z axis of the new reference frame is parallel
%with the flying direction of the photon
photon_.matrix=reference_rotate(photon_.theta,photon_.fai)*reference_rotate(transmitter_.theta,transmitter_.fai);
%The position of the photon in the new reference frame
photon_.position=photon_.matrix*transmitter_.positioninoriginal;
end
