W
W
WTFAYD2018-10-04 12:51:50
Algorithms
WTFAYD, 2018-10-04 12:51:50

How to implement an algorithm for constructing a line with obstacle avoidance?

Our company is developing a program that allows you to build block diagrams. My task is to create an algorithm for constructing lines connecting circuit elements, and at the same time it is necessary to minimize the intersection of lines with other lines and blocks. That is, if the line meets, for example, a block on its way, it must bypass it and move on.
I tried to adapt the pathfinding algorithms A * and the Lee wave algorithm for this and assumed 1 pixel = 1 graph node, but with a large circuit size (for example, 1000x1000 gives a million graph nodes), the algorithms slow down (500x500 is processed in 300-500 ms, depending on the selected algorithm).
Can you please tell me how to implement this functionality for lines? I thought about using more efficient A* implementations - HPA* or JPS, but it seems to me that using pathfinding algorithms for this purpose is irrational and there is a simpler and more efficient solution method.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
X
xmoonlight, 2018-10-04
@xmoonlight

1. Algorithm for flat graph stacking: here
2. Hierarchical approach for automatic laying of acyclic graphs: here
This should help: https://flowchart.js.org/

L
longclaps, 2018-10-04
@longclaps

Dig towards graph drawing algorithms .

A
Alex-1917, 2018-10-11
@alex-1917

did something similar - grid 1000*1000,
you can choose an area of ​​any size, for example 20*49.
the next selection is handled with respect to not allow it to intersect with already selected areas.
plus a choice of SIZES, i.e. I set the size - for example, 1 * 4 - the script itself selects the first place from the top in terms of capacity among the already selected areas.
there all the cells were stored in the database, the script pulled out free and then insane calculations)))
if you are interested, then I will look, there is no desire to climb in the bins just like that)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question