-
Notifications
You must be signed in to change notification settings - Fork 5
/
rayMatching.H
54 lines (42 loc) · 977 Bytes
/
rayMatching.H
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
//Find complementary tracks corresponding to ray travelling in both directions
List<List<label> > compRay(totalRays); //label of complementary ray
List<List<label> > compDir(totalRays); //orientation of complementary ray
forAll(compRay, lines)
{
compRay[lines]= List<label>(2);
compDir[lines]= List<label>(2);
}
scalar angle;
scalar angle2;
scalar compAngle;
point pRay1End;
point pRay2Start;
bool found;
for(int lines=0; lines<totalRays; lines++)
{
angle=rayAngle[lines];
compAngle=PI - angle;
for(int dir=0; dir<2; dir++)
{
found=0;
pRay1End=rayPoints[dir][lines];
forAll(compRay, compLines)
{
angle2=rayAngle[compLines];
if(mag(compAngle-angle2)<1e-12)
{
for(int dd=0; dd<2; dd++)
{
pRay2Start=rayPoints[dd][compLines];
if(mag(pRay2Start-pRay1End)<1e-12)
{
compRay[lines][dir]=compLines;
compDir[lines][dir]=dd;
found=1;
break;
}
}
}if(found){break;}
}
}
}