Mikolaj Wielgus
6f5a73759a
guide: Take unqualified `{Dot,Seg,Bend}Index` unions as arguments
2023-10-25 15:29:13 +00:00
Mikolaj Wielgus
cedc2253ca
primitive,layout: Remove methods that assume order
...
There's should be no previous or next primitive, only this end and the
other end.
2023-10-25 15:29:13 +00:00
Mikolaj Wielgus
aaad590870
primitive: Remove `.tagged_prev()`, `.tagged_next()` methods
...
Temporarily commented out band code which relied on tem.
2023-10-25 15:29:13 +00:00
Mikolaj Wielgus
62579d98ba
graph: Merge `FixedEnd` and `LooseEnd` into one `Adjacent`
2023-10-25 15:29:13 +00:00
Mikolaj Wielgus
d5acfaccb5
primitive: Remove `.prev_bend()` and `.next_bend()` for now
...
Commented out the experimental code parts that use tem.
2023-10-25 15:29:09 +00:00
Mikolaj Wielgus
0dac23f018
graph,layout: Add creation methods for new primitives and a new label
2023-10-22 05:07:53 +00:00
Mikolaj Wielgus
a2531b078d
graph,primitive: Split the 3 primitives into 7
...
`Dot` becomes `FixedDot` and `LooseDot`.
`Seg` becomes `FixedSeg`, `HalfLooseSeg`, and `FullyLooseSeg`.
`Bend` becomes `FixedBend` and `LooseBend`.
The fixed variants differ from the loose variants by being unchangeable
for the router (though probably will be pushable in some cases, but
that's for later). So typically tey're going to be the initial
conditions.
For now only the fixed variants are used even if actually loose, to
split this change into several commits.
2023-10-22 02:05:22 +00:00
Mikolaj Wielgus
2966df6b2c
graph: Move boilerplate `impl`s to a new `impl_type` macro
2023-10-21 06:04:41 +00:00
Mikolaj Wielgus
403e3e4f98
graph: Remove the `untag` macro
...
To accomplish this, some more methods are moved to traits.
2023-10-21 04:37:18 +00:00
Mikolaj Wielgus
4549de098c
primitive: Move `tagged_{prev,next}` to a trait
...
First step towards getting rid of the `untag` macro.
2023-10-20 23:44:20 +00:00
Mikolaj Wielgus
4d20362e00
primitive: Move `.weight()` method to a new `GetWeight` trait
2023-10-20 01:08:58 +00:00
Mikolaj Wielgus
e271c82b7e
graph: Remove `Tag` trait
...
Name `Index` enum variants explicitly instead.
2023-10-19 22:41:53 +00:00
Mikolaj Wielgus
b52eefb1a3
cleanup: Remove unused imports, formatting
2023-10-19 20:29:31 +00:00
Mikolaj Wielgus
708fbb98f1
graph,primitive: Use enum_dispatch, rely on generics less
2023-10-19 20:07:26 +00:00
Mikolaj Wielgus
4e21ff754d
primitive: Move `.shape()` to a new trait `MakeShape`
2023-10-19 06:38:57 +00:00
Mikolaj Wielgus
ae9dd23b7c
graph: Move `retag` to an enum-dispatched trait
2023-10-18 22:46:18 +00:00
Mikolaj Wielgus
b7ff507302
shape: Use `enum_dispatch` for `Shape`
2023-10-18 02:33:03 +00:00
Mikolaj Wielgus
26778e7d47
draw: Comment out bend-flipping code for now
...
Was causing panics, so let's keep this out of the way for now.
2023-10-17 22:40:47 +00:00
Mikolaj Wielgus
e4e6590b4c
segbend: When constructing, don't assume bend before face dot
2023-10-17 22:39:48 +00:00
Mikolaj Wielgus
11c7f7fb12
layout: Don't modify bends while tey're in the R-tree
2023-10-17 22:37:40 +00:00
Mikolaj Wielgus
478f630a73
tracer: Don't tuck under inexistent bend
2023-10-17 19:02:26 +00:00
Mikolaj Wielgus
177b8cb231
guide: Return Err(...) instead of panicking
2023-10-17 05:17:07 +00:00
Mikolaj Wielgus
087d1deea0
router: Don't try to route around target dot
...
This was causing a panic, as it's not possible to route from *around* a
dot *into* the same dot.
2023-10-17 03:55:21 +00:00
Mikolaj Wielgus
c9d0b2178e
tracer: Add some initial code for squeezing/tucking
...
Not functional yet.
2023-10-17 03:16:02 +00:00
Mikolaj Wielgus
ce72a2ba4b
shape: Fix bend-seg intersection
...
By making zero-length bends non-intersectable.
2023-10-15 01:15:35 +00:00
Mikolaj Wielgus
4ec32c97ba
layout: Move R-tree remove out of `debug_assert`
...
Because of that release builds were panicking.
2023-10-14 04:47:30 +00:00
Mikolaj Wielgus
b1ac987d2f
shape: Temporarily disable bend-seg intersection as it's bugged
2023-10-14 04:46:16 +00:00
Mikolaj Wielgus
bfbad933e2
debug: Create and use `before_probe` observer for search visualization
...
Also changed `as_*`s to `into_*`s.
2023-10-13 04:00:01 +00:00
Mikolaj Wielgus
4e8e9298e6
astar: Probe neighbors before adding tem to queue
2023-10-12 00:19:38 +00:00
Mikolaj Wielgus
af61a6b120
router: Rename `Route` to `Tracer` and simplify related code
2023-10-11 22:23:18 +00:00
Mikolaj Wielgus
cc3b537b5c
debug: Visualize A* running during interactive routing
2023-10-10 21:09:21 +00:00
Mikolaj Wielgus
7a06a9b02d
router: Implement basic cursor following
2023-10-06 22:41:59 +00:00
Mikolaj Wielgus
0e8a6d6e42
Create new `Band` struct to pass around whole bands
2023-10-05 19:52:59 +00:00
Mikolaj Wielgus
0695b1deab
draw: Implement flipping the bend if a shorter one is available
2023-09-19 20:56:40 +02:00
Mikolaj Wielgus
abf92c7f43
contracts: Fix R-tree envelope invariance test
...
Violations were not detected if shape changed but not the envelope
(which is the case when bends are flipped).
2023-09-19 20:44:05 +02:00
Mikolaj Wielgus
f36f80537f
layout: Add invariant testing R-tree envelope invariance
2023-09-19 15:40:26 +02:00
Mikolaj Wielgus
efea917cb1
draw: Use `enum_dispatch` to dynamically dispatch `Head`
2023-09-17 16:54:23 +02:00
Mikolaj Wielgus
394510de8d
layout: Add contracts for node and edge counts
2023-09-16 18:24:57 +02:00
Mikolaj Wielgus
7d2cff9004
route: Add contracts for path length
2023-09-15 22:48:51 +02:00
Mikolaj Wielgus
c94a4c716a
draw: Add contracts for node counts
2023-09-15 22:10:29 +02:00
Mikolaj Wielgus
1a271cd89c
Add `node_count == size` invariant for `Layout`
2023-09-15 01:30:23 +02:00
Mikolaj Wielgus
23311122b4
draw: Fix on-fail cleanup when drawing segbend
2023-09-05 07:51:27 +02:00
Mikolaj Wielgus
05fc42aa38
draw: Change direction depending on chosen guide tangent
2023-09-05 06:02:11 +02:00
Mikolaj Wielgus
f88636057f
draw: Choose the shortest guide tangent
2023-09-05 05:51:21 +02:00
Mikolaj Wielgus
49038a4ddb
Don't forget to reinsert bend into R-tree if bend extension fails
2023-09-05 04:23:26 +02:00
Mikolaj Wielgus
5f37ff7616
Unroute path whose routing failed in the middle
2023-09-05 02:03:32 +02:00
Mikolaj Wielgus
53c24b1a14
Remove created dot if drawing new seg or bend fails
2023-09-04 05:46:58 +02:00
Mikolaj Wielgus
84a5b81032
Iterate and filtermap over tangents in math module instead of for loop
2023-09-04 00:48:55 +02:00
Mikolaj Wielgus
7d76051cbf
Route to goal immediately if a straight path exists at any vertex
2023-09-03 05:43:08 +02:00
Mikolaj Wielgus
73a831ba6d
Visualize every routing search step
2023-09-03 01:56:46 +02:00
Mikolaj Wielgus
c492bd1dda
Parametrize routing using `RouteStrategy` trait
2023-09-02 06:05:13 +02:00
Mikolaj Wielgus
bea6d84878
Implement `AstarStrategy` trait to not borrow A* context multiple times
2023-09-02 01:44:35 +02:00
Mikolaj Wielgus
b5f9a5957a
Route with A* step by step instead of only after A*
2023-09-01 01:35:48 +02:00
Mikolaj Wielgus
1ac8dd2828
Only remove node when collision is detected during placement
...
As the node is inserted into the R-tree only afterwards.
2023-08-31 22:45:51 +02:00
Mikolaj Wielgus
cd5365c26f
Pass `width` as an argument instead of holding it in `Route`
2023-08-31 21:17:25 +02:00
Mikolaj Wielgus
e5ba7401c1
Move routing methods to the `Route` struct
...
Commented out shove/squeeze features for now.
2023-08-31 20:33:34 +02:00
Mikolaj Wielgus
9f201d2c3d
Make `Head`, `Segbend`, `Bow` copyable
...
Having to move or borrow tem, especially `Head`, makes it really
difficult to appease the borrow checker.
2023-08-31 07:27:42 +02:00
Mikolaj Wielgus
1d5b428bf9
Split out drawing routines from `Router` into `Draw`
2023-08-30 06:34:56 +02:00
Mikolaj Wielgus
0d7b10606a
Use `Option::map` instead of if-else
2023-08-30 05:12:11 +02:00
Mikolaj Wielgus
247b78087c
Add methods to unroute or undraw segbends
2023-08-29 21:11:03 +02:00
Mikolaj Wielgus
f2346eedb8
Run `cargo fix`
...
This hasn't cleaned up all the unused import, but it's a good start.
2023-08-29 05:02:45 +02:00
Mikolaj Wielgus
ceef3a7fb7
Take `&impl Interior` argument in path removal method
2023-08-29 01:59:11 +02:00
Mikolaj Wielgus
47aadfcdd3
Introduce `Segbend`, a seg-dot-bend triple
2023-08-29 01:49:37 +02:00
Mikolaj Wielgus
79a26cb324
Split `Walk` trait into `Interior` and `Ends` traits
2023-08-28 22:54:03 +02:00
Mikolaj Wielgus
84a7f5d873
Make `Bow` don't borrow the graph
2023-08-28 19:17:57 +02:00
Mikolaj Wielgus
47b3ffba08
Some small improvements to iteration in graph and layout code
2023-08-28 04:12:25 +02:00
Mikolaj Wielgus
14f6b9f870
Implement basic A* routing
2023-08-27 21:14:42 +02:00
Mikolaj Wielgus
270a7e857c
Provide means of converting dot index to vertex index
2023-08-27 05:00:15 +02:00
Mikolaj Wielgus
d1571c99f6
Wrap `FixedVertexHandle` in a `VertexIndex` struct
2023-08-27 04:03:04 +02:00
Mikolaj Wielgus
9196d95546
Triangulate only after drawing finishes
...
Otherwise we'll end up with the (not yet implemented) pathfinding
algorithm trying to route traces with themselves.
2023-08-26 22:25:01 +02:00
Mikolaj Wielgus
a1afd19fcb
Implement Petgraph's graph traits on a Spade's triangulation
2023-08-25 23:39:44 +02:00
Mikolaj Wielgus
658bb112c2
Move Delaunay triangulation to a new `Mesh` struct
2023-08-24 21:23:37 +02:00
Mikolaj Wielgus
8456259b38
Rename `Layout` to `Router`, `Mesh` to `Layout`
2023-08-24 03:32:50 +02:00
Mikolaj Wielgus
234a52f9e8
Rename "route" to "draw" and "shove" to "squeeze"
...
The terms "route" and "shove" will be reserved to functions on the
higher level of abstraction.
2023-08-23 19:00:47 +02:00
Mikolaj Wielgus
bbbd2f57fe
Add `Guide` struct to generate guide curves
2023-08-23 05:15:16 +02:00
Mikolaj Wielgus
356154c914
Make inner and outer circle obtainable from `Shape`
2023-08-22 21:40:10 +02:00
Mikolaj Wielgus
c7f89c9fb9
Delaunay triangulation using Spade library
2023-08-19 05:55:28 +02:00
Mikolaj Wielgus
c480111624
Display mesh edges
2023-08-18 22:37:21 +02:00
Mikolaj Wielgus
a077dfbca2
Don't collide with the same net
2023-08-18 02:39:11 +02:00
Mikolaj Wielgus
17d03bb9db
Add seg-bend and bend-bend collision detection
2023-08-17 03:33:22 +02:00
Mikolaj Wielgus
6e87f9c124
Fix dot-bend collision detection
...
Fixes bend AABB calculation and the actual circle-arc intersection
algorithm.
2023-08-16 21:39:24 +02:00
Mikolaj Wielgus
4f473bacec
Exclude mesh neighbors from collision detection
2023-08-16 19:55:12 +02:00
Mikolaj Wielgus
1a599951cd
Implement basic failure for moving dot to obstructed place
...
Intersection with bends isn't working yet.
2023-08-15 04:10:55 +02:00
Mikolaj Wielgus
c2a553c475
Incomplete implementation of low-level collision routines (untested)
2023-08-13 22:49:01 +02:00
Mikolaj Wielgus
14c3acb633
Change `Shape` from struct to enum
...
It's more readable to use a match rather than an odd if condition.
2023-08-08 02:28:41 +02:00
Mikolaj Wielgus
bdf3930894
Reinsert all bends into R-tree when moving a dot
...
This was causing a crash. Added some code that was used to debug this.
2023-08-02 00:28:52 +02:00
Mikolaj Wielgus
409cea61c0
Add macro to debug graph
2023-07-31 15:44:18 +02:00
Mikolaj Wielgus
0c32ea7e41
Partial implementation of releasing bends
...
There's a panic when releasing (unbending) any of the inner bends in the
demo (the outer one works for some reason).
2023-07-31 05:06:09 +02:00
Mikolaj Wielgus
f9ec5a0ef7
Implement basic interactive dragging and stretching
2023-07-29 22:29:08 +02:00
Mikolaj Wielgus
e5a1c52655
Rename `Stretch` to `Bow`
...
I wanted to name it `String` (as in bowstring), but it's taken in Rust,
and `Bowstring` is longer than just `Bow`, and the thing in question is
very much bow-shaped, so I went with `Bow`.
2023-07-26 02:29:54 +02:00
Mikolaj Wielgus
f563bc2c5a
Set up shoving demo
2023-07-25 22:49:45 +02:00
Mikolaj Wielgus
68c2863784
Implement basic shoving
2023-07-25 04:08:06 +02:00
Mikolaj Wielgus
7c86b902aa
Add `Stretch` object to hold bend together withs neighboring segs, bends
2023-07-23 03:45:16 +02:00
Mikolaj Wielgus
9c75151d3a
Implement .next() and .prev() methods to traverse along traces
2023-07-23 01:36:22 +02:00
Mikolaj Wielgus
925448802a
Create a new `Set` trait for collections of node indices
2023-07-22 20:55:25 +02:00
Mikolaj Wielgus
f1772ca0be
Store width and points instead of weights in `Shape`
2023-07-22 03:48:56 +02:00
Mikolaj Wielgus
dea65a3b43
Add `untag!` macro, move `.shape()` to `Primitive`
2023-07-21 23:31:26 +02:00
Mikolaj Wielgus
8b5cfb3686
Rename `Primitive` to `Shape`, introduce new `Primitive`
...
Move some `Mesh` methods into `Primitive`.
2023-07-21 23:31:20 +02:00
Mikolaj Wielgus
69317384dd
Separate dot and bend arounds. Keep an edge to the core from each bend
2023-07-21 05:40:04 +02:00
Mikolaj Wielgus
16990517b2
Make segs nodes instead of edges
...
This simplifies logic. Nodes store data as weights, while edges now only
describe relations between nodes with dataless enums -- labels.
2023-07-19 19:47:56 +02:00
Mikolaj Wielgus
b5f85068df
Store all relevant indexes as neighbors instead of in weights
2023-07-15 16:39:46 +02:00
Mikolaj Wielgus
26112724c7
Make bends nodes
...
This is necessary because bends may have more than two neighbors: apart
from the ends, there's also the node around which the bend is wrapped
(not yet made a neighbor, will be done in subsequent commits).
2023-07-14 12:40:30 +02:00
Mikolaj Wielgus
bedd7c744a
Add some utility functions for working with `Index`es and `Weight`s
2023-07-14 00:17:46 +02:00
Mikolaj Wielgus
dabe364420
Pass around routing state with a new `Head` struct
2023-07-13 18:18:46 +02:00
Mikolaj Wielgus
0770917a41
Implement bending on bends
...
There's some ugly constants added here and there, will clean this up
later.
2023-07-12 11:15:54 +02:00
Mikolaj Wielgus
dfcfc99413
Implement routing *into* dots
2023-07-12 01:01:59 +02:00
Mikolaj Wielgus
cf6460a3db
Initial commit
...
Very basic routing routines and data model. No pathfinding implemented
yet.
2023-07-12 01:01:25 +02:00