Line Segments: Test Data. Post your results.

Dmitriy Vyukov
Total Points:
25,462
Status Points:
25,462
Black Belt
June 23, 2009 1:12 PM PDT
Rate
 
#1
My program has found 1622 intersections in 21 sec.
However I am not 100% sure in correctness of my program now. Since it's difficult to manually compare output of one program with output of another program, I propose following method for quick verification/comparison of results.
The idea is to compute some "hash" of results. Hash must be stable to following reorderings:
A B
C D
must yield the same hash as:
D C
B A

But not stable to following reorderings:
A B
C D
must not yield the same hash as:
A C
B D

Here is algorithm I currently use:
char hash [4] = {};
for (size_t i = 0; i != results.size(); i += 1)
{
line_t const* line1 = results[i].line1;
line_t const* line2 = results[i].line2;
for (int t = 0; t != 4; t += 1)
hash[t] ^= (line1->name[t] + line2->name[t]);
}
}
printf("count=%u (%u)\n", results.size(), *(unsigned*)sample);

My output is:
count=1622 (1711155)



Intel Software Network Forums Statistics

8488 users have contributed to 31627 threads and 100752 posts to date.
In the past 24 hours, we have 33 new thread(s) 138 new posts(s), and 198 new user(s).

In the past 3 days, the most popular thread for everyone has been gemm(A,A,A) like possible? The most posts were made to Crash when loading skeleton The post with the most views is Dear Steve, excuse me for a d

Please welcome our newest member chat1983