Commit Graph

63 Commits

Author SHA1 Message Date
hasufell 2ccb52eb62
VEC: Fix the inRange function
It now takes a PROPER square, as in ((xmin, ymin), (xmax, ymax))
instead of ((xmin, xmax), (ymin, ymax)) and also works
with negative values.

Because the meaning of the arguments has changed, we also
had to fix all uses of it.
2014-12-17 03:35:33 +01:00
hasufell f16fe7738a
ALGO: rm empty 'where' in KDTree 2014-12-07 04:47:19 +01:00
hasufell 3c1a34e4af
Merge VectorTypes.hs into Vector.hs 2014-12-03 21:41:00 +01:00
hasufell 9d6af63b46
Move test objs into test_objs subdir 2014-12-03 21:30:21 +01:00
hasufell 73e1673c63
Restructure Algorithms subdir and module names
No subdirs in Algorithms, just the module files
2014-12-03 21:26:35 +01:00
hasufell 9fca3ccaa9
Add HACK notes 2014-12-03 21:20:34 +01:00
hasufell 0f0362322e
ALGO: rename QuadTree Zipper and rm Breadcrumbs type 2014-12-03 21:18:15 +01:00
hasufell 899afc7287
ALGO: fix runtime complexity in KDTree
The old code in fact increased the complexity to O(n^2), because
we applied 'elem' which is O(n) to every element of xs.

Instead we compare (in case of partitioning against Y) the y-value
of every element of xs with the y-value of the pivot which tells us
if x lies within ys.
2014-12-02 19:01:04 +01:00
hasufell 78a3dd8b95
ALGO: avoid printing KTNil for both childs 2014-11-30 20:04:02 +01:00
hasufell 8cf9d93580
ALGO: don't export all functions in KDTree 2014-11-29 23:51:41 +01:00
hasufell 9867d25c4a
ALGO: add haddock ignore-exports in KDTree 2014-11-29 23:51:23 +01:00
hasufell 26221f3046
ALGO: add goLeft/goRight in KDTree 2014-11-29 23:49:39 +01:00
hasufell 543b08df2c
GUI/DIAG: allow visualizing the rangeSearch and the tree 2014-11-29 23:45:53 +01:00
hasufell d195d3f11d
ALGO: save direction in KDTree and refactor 2014-11-29 18:06:07 +01:00
hasufell 7dbd3a1352
ALGO: initial implementation of KDTree
No visualization yet.
2014-11-29 05:11:15 +01:00
hasufell b5a56ea7b0
ALGO: fix spelling in QuadTree 2014-11-29 05:09:13 +01:00
hasufell 7527e0bec3
ALGO: generalize the QuadTree folds
Now we traverse over all nodes (TNode, TLeaf, TNil),
not just TLeaf.
2014-11-18 00:56:24 +01:00
hasufell ea88ef84ea
Improve code prettiness 2014-11-16 16:45:51 +01:00
hasufell 8c1d54d97a
ALGO: add TODO note in PolygonIntersection about Zippers 2014-11-16 04:49:34 +01:00
hasufell 62583d82a5
Improve prettiness further 2014-11-16 04:49:13 +01:00
hasufell 26337d437e
ALGO: expose lookupByNeighbors in QuadTree 2014-11-15 16:04:31 +01:00
hasufell 60d7dca2c8
DIAG: make the current node in the tree red 2014-11-15 15:26:43 +01:00
hasufell 50fc0c3d01
ALGO: add test obj to quadtree 2014-11-15 14:24:46 +01:00
hasufell 0b3c7d2100
ALGO: rename wrongly named RangeSearch to QuadTree 2014-11-15 14:24:24 +01:00
hasufell f3cabab280
Implement visualizing the quad tree in a separate window
This window creation still sucks a bit, we should realize it
without actually showing it.
2014-11-15 03:58:38 +01:00
hasufell 5fa5afc073
ALGO: rm obsolete test array 2014-11-15 03:55:52 +01:00
hasufell 75c45149d9
Rename Algorithms.RangeSearch.Core to Algorithms.RangeSearch.QuadTree 2014-11-15 00:49:44 +01:00
hasufell 068ea04d56
ALGO: fix bug when a pointer is between multiple quads
We have to set a priority, otherwise a point might belong to
multiple quads (max 4 if it's in the very middle).
2014-11-14 22:45:12 +01:00
hasufell 534f0f9609
Add getSquareByZipper function 2014-11-14 21:26:02 +01:00
hasufell 76afaae38e
ALGO: export constructors and Zipper in RangeSearch 2014-11-14 21:25:25 +01:00
hasufell af2e1b59cd
ALGO: add missing Show instances to RangeSearch 2014-11-14 21:24:14 +01:00
hasufell 62d7c9ffcd
ALGO: implement the quad tree 2014-11-13 23:05:56 +01:00
hasufell c765c63125
POLYINT: run rmdups only once 2014-10-31 17:49:08 +01:00
hasufell 61e0063d78
POLYINT: fix comparison for different-length polygons 2014-10-28 18:51:11 +01:00
hasufell d81b6b1cec
POLYINT: improve haddock doc 2014-10-26 14:58:43 +01:00
hasufell c8914c8272
POLYINT: small refactor
Get predecessors and successors in the beginning instead of
figuring them out for every single point separetely.
This is still O(n), butt should be a lot quicker than the previous
approach.
2014-10-26 04:22:05 +01:00
hasufell fd931db7e0
Improve readability 2014-10-25 20:39:34 +02:00
hasufell c4c397e12f
POLYINT: small refactor, abstract some stuff out 2014-10-25 20:23:34 +02:00
hasufell 7965443aa6
Fix example mesh 2014-10-25 03:15:00 +02:00
hasufell 9a101d68a5
POLYINT: first try of polygon intersection algorithm in O(n) 2014-10-25 01:44:13 +02:00
hasufell a31e1ff578
ALGO: improve haddock doc 2014-10-15 22:50:56 +02:00
hasufell 077d0442f5
ALGO: improve style 2014-10-13 22:30:19 +02:00
hasufell 8300929fd7
ALGO: refactor
Move sortedXY to Vector.hs, fix shadowing of scanH.
Simplified grahamCHSteps by making use of a more generalized scanH
function.
2014-10-13 22:06:12 +02:00
hasufell edde93ec77
ALGO: improve function names 2014-10-13 19:50:02 +02:00
hasufell 7cdb867cf4
ALGO: Split scanH out and make the graham API more modular 2014-10-13 19:49:53 +02:00
hasufell 2c1d5fa5ec Improve redability, add docs 2014-10-13 03:25:22 +02:00
hasufell 87393af71a
Make Gif animation more nice, TODO: IMPROVE CODE 2014-10-13 02:58:18 +02:00
hasufell f82c948055
ALGO: Improve readability by introducing notcw 2014-10-12 20:37:24 +02:00
hasufell 56ea542535
ALGO: fix generation of gif
This is a good guess... the maximum of possible steps shouldn't
be higher than twice the length of the points.
2014-10-12 19:22:37 +02:00
hasufell 37b38115ae
ALGO: fix algorithm to show collinear points as part of the hull
There was also a bug to be fixed when doing this. We missed
an important pattern match case which casued wrong results.
2014-10-12 19:19:44 +02:00