ctf: fix output writer segment intersection algorithm
Let's say you have two segments, A and B, they have the points
A0, A1, B0, B1. to see if there is intersection between the two
segments in one dimension, here are the exhaustive possibilities.
A----A
B--B 1
B--B 2
B--B 3
B--B 4
B--B 5
B----------B 6
we need to only reject 1 and 5
In 1, B0 && B1 < A0
In 5, B0 && B1 > A1
Now B0 < B1 so we can simplify to
B1 < A0 || B0 > A1
Applying demorgan we get
!(B1 >= A0 && B0 <= A1)
If B is the entry, B0 = entry.timestampStart() and B1 = entry.timestampEnd()
The intersection is the not(!) of the formula above.
entry.timestampEnd >= startTime && entry.timestampStart <= endTime
The patch changes the intersection algorith to that.
Change-Id: Ie3205a3c7da970daf94c0cb93cb336fe0851f039
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/53001
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
This page took 0.027751 seconds and 5 git commands to generate.