From 5e38f6034091929f2fa33c734e8f29a053ebf264 Mon Sep 17 00:00:00 2001 From: Antonio De Lucreziis Date: Fri, 29 Jul 2022 18:29:38 +0200 Subject: [PATCH] Updated readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 887607d..0e89e37 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This is the second version of the _wire art_ for the landing page of the new PHC The first version stored wires as polylines so when adding a new wire to the world we had to compute if the new wire intersected any of the previous one and that was _O(|number of segments of current wire| * |number of segments in whole canvas|)_ and it got pretty slow after some time. -Instead this version uses the fact that all segments lie on a grid and can be only of three kinds (going down, down left or down right) and stores them in a "2d integer hashmap" (in js this is just an object indexed by `,` for example `0,0` or `-15,7`) for fast access, this way computing intersections doesn't depend on the number of wires present in the world state and is just _O(|number of segments of current wire|)_. +Instead this version uses the fact that all segments lie on a grid and can be only of three kinds (going down, down left or down right) and stores them in a "2d integer hashmap" (in js this is just an object indexed by "`,`" for example "`0,0`" or "`-15,7`") for fast access, this way computing intersections doesn't depend on the number of wires present in the world state and is just _O(|number of segments of current wire|)_. Another improvement is that the screen is redrawn only when considered `dirty` (the update functions sets this to true after modifying the world state).