FirstLineIntersection.emam 927 Bytes
Newer Older
1
2
package ba.intersection;

3
//Finds the earliest line intersection from a set of LineIntersection components
Alexander David Hellwig's avatar
Alexander David Hellwig committed
4
component FirstLineIntersection<N1 m1 = 9, N1 m2 = 45>{
5
6
    ports in B collisionIn[m2],
          in Q^{2,1} pointsIn[m2],
7
8

          out B collisionOut,
9
10
          out Z linexA,
          out Z linexB,
11
12
          out Q^{2,1} pos;

13
14
	//TODO: bug: must not always be earliest crash pos
	//TODO: remove: filter all with TimeCutoff and MultiOr
15
16
    implementation Math{
        Z k = 1;
17
        B found = false;
18

19
20
        for i = 1:m1
            for j = i:m1
21
                if found == false
22
                    if collisionIn(k)
23
24
                        linexA = i;
                        linexB = j;
25
                        pos = pointsIn(k);
26
                        found = true;
27
28
29
30
31
32
33
34
35
                    end
                    k = k + 1;
                end
            end
        end

        collisionOut = found;
    }

36
}