Skip to content
Draft
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a2a61f8
function declarations
ajfriend Dec 22, 2021
7ce1842
rfc
ajfriend Dec 22, 2021
ddeaf42
types of arrays
ajfriend Dec 22, 2021
1c741bd
merp
ajfriend Dec 22, 2021
f1a6e9a
implementations
ajfriend Dec 23, 2021
d372101
intersection test
ajfriend Dec 23, 2021
b9d5af2
better with bool
ajfriend Dec 23, 2021
f87297b
wayLessThan
ajfriend Dec 23, 2021
8c90200
ensureASmaller
ajfriend Dec 23, 2021
d7bf43e
ternary
ajfriend Dec 23, 2021
cbf69b3
merp
ajfriend Dec 23, 2021
8b07372
notes
ajfriend Dec 23, 2021
81d7e2f
intersectTheyDo_slow
ajfriend Dec 23, 2021
b55c886
formatting
ajfriend Dec 23, 2021
6368edf
add some tests
ajfriend Dec 25, 2021
34e6bf2
trying some stuff
ajfriend Dec 25, 2021
04c853d
clean up tests
ajfriend Dec 25, 2021
0355ce7
ring_intersect
ajfriend Dec 25, 2021
39cb4e0
overlapping disks
ajfriend Dec 25, 2021
fc2da34
h3api.h
ajfriend Dec 25, 2021
bec6d6b
oops, wrong one
ajfriend Dec 25, 2021
8076474
try again
ajfriend Dec 25, 2021
0e810f3
H3_EXPORT might be the trick
ajfriend Dec 25, 2021
5a6c581
H3_EXPORT all the things
ajfriend Dec 25, 2021
948d2e8
one last straggler
ajfriend Dec 25, 2021
201c6c1
some clean up
ajfriend Dec 25, 2021
24f6e2b
cleaner
ajfriend Dec 25, 2021
26d02dc
trying out t_isLow52 and t_isCanon
ajfriend Dec 25, 2021
a9e1777
t_intersect
ajfriend Dec 25, 2021
3eed379
clean up helper functions
ajfriend Dec 25, 2021
d624f97
sets use capital letters
ajfriend Dec 25, 2021
5475831
t_intersects
ajfriend Dec 26, 2021
ea81e27
do some simpler flipping between left and right side of A
ajfriend Dec 26, 2021
6e3fcaf
simplify input for disjointInsertionPoint
ajfriend Dec 26, 2021
428854c
tricky ring tests
ajfriend Dec 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
better with bool
  • Loading branch information
ajfriend committed Dec 23, 2021
commit b9d5af283fe54e7eea8fe1486cdf445e136b9747
14 changes: 7 additions & 7 deletions src/h3lib/lib/low52.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,15 @@ typedef struct {
int64_t N, i, j;
} SearchInterval;

typedef enum { LEFT = 0, RIGHT = 1 } Endpoint;

// Yoda naming until we come up with something better
int intersectTheyDo(const H3Index *_A, const int64_t aN, const H3Index *_B,
const int64_t bN) {
SearchInterval A = {.cells = _A, .N = aN, .i = 0, .j = aN};
SearchInterval B = {.cells = _B, .N = bN, .i = 0, .j = bN};
H3Index h;

// TODO: a quick exit check?

while ((A.i < A.j) && (B.i < B.j)) {
// ensure A is the smaller of the two sets.
if ((B.j - B.i) < (A.j - A.i)) {
Expand All @@ -321,11 +321,11 @@ int intersectTheyDo(const H3Index *_A, const int64_t aN, const H3Index *_B,
}

// take A[i] or A[j-1] and see what happens when we look into B[i:j]
Endpoint ep = (A.i % 2 == 0);
bool usingLeft = (A.i % 2 == 0);

if (ep == LEFT) {
if (usingLeft) {
h = A.cells[A.i];
} else if (ep == RIGHT) {
} else {
h = A.cells[A.j - 1];
}

Expand All @@ -335,10 +335,10 @@ int intersectTheyDo(const H3Index *_A, const int64_t aN, const H3Index *_B,
return true; // they intersect
}

if (ep == LEFT) {
if (usingLeft) {
B.i = k;
A.i++;
} else if (ep == RIGHT) {
} else {
B.j = k;
A.j--;
}
Expand Down