aboutsummaryrefslogtreecommitdiff
path: root/example_beam_trace.m
blob: 95b5ff33316d5783e761c75d09b8c75fb88de7d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
beam.k=[-1,0];
beam.origin=[2,0.5];
beam.face=NA;
beam.intensity = 1;
beam.polarization = 1; % 1 for s  and 2 for p

face1.vertex1=[-1,0];
face1.vertex2=[1,0];
face1.n_right = [1, 1];
face1.n_left= [2.5, 2.9];

face2.vertex1=[1,0];
face2.vertex2=[0,1];
face2.n_right = [1, 1];
face2.n_left= [2.5, 2.9];

face3.vertex1=[0,1];
face3.vertex2=[-1,0];
face3.n_right = [1, 1];
face3.n_left= [2.5, 2.9];

faces={face1,face2,face3};


border1.vertex1=[-2,-2];
border1.vertex2=[2,-2];
border1.n_right = 1.;
border1.n_left= 1;

border2.vertex1=[2,-2];
border2.vertex2=[2,2];
border2.n_right = 1.;
border2.n_left= 1;

border3.vertex1=[2,2];
border3.vertex2=[-2,2];
border3.n_right = 1.;
border3.n_left= 1;

border4.vertex1=[-2,2];
border4.vertex2=[-2,-2];
border4.n_right = 1.;
border4.n_left= 1;

borders={border1,border2, border3, border4};
beams={beam};


img=zeros(1000,1000);
border_limits=[-2,-2, 2,2];
figure(1);
img = beam_trace(beams, faces, borders, border_limits, img );

fig_handle=2;
plot_beams_and_faces_figure(border_limits, img, faces, fig_handle );