Design an algorithm capable of predicting collisions to choose alternative path using `tikzpicture` environmentChecking whether or not a node has been previously definedHow to draw a diagram of custom subject correlativitiesHow to connect `pic`s through a set of colorful arrows using `tikzpicture` environmentUsing tikz command inside tikzpicture environment (alignment problem)Using gnuplot in tikzpicture environment using pgf-packageAlternative for tikz's scope environment outside tikzpictureTikZ/ERD: node (=Entity) label on the insideTikzpicture curvature in path issueDraw an ellipse into two parts using tikzpicture environmentalgorithm and tikzpicture side by sideHow to create an ER diagram using tikzpicture environmentHow to draw this rectangle using tikzpicture environmentHow to connect `pic`s through a set of colorful arrows using `tikzpicture` environment

How to get directions in deep space?

It grows, but water kills it

Has the laser at Magurele, Romania reached a tenth of the Sun's power?

How much theory knowledge is actually used while playing?

How do I fix the group tension caused by my character stealing and possibly killing without provocation?

Why does AES have exactly 10 rounds for a 128-bit key, 12 for 192 bits and 14 for a 256-bit key size?

How does electrical safety system work on ISS?

How to draw a matrix with arrows in limited space

What is the highest possible scrabble score for placing a single tile

C++ copy constructor called at return

What's the name of the logical fallacy where a debater extends a statement far beyond the original statement to make it true?

Which was the first story featuring espers?

Microchip documentation does not label CAN buss pins on micro controller pinout diagram

Does the reader need to like the PoV character?

A Trivial Diagnosis

What does "Scientists rise up against statistical significance" mean? (Comment in Nature)

Biological Blimps: Propulsion

Why is the "ls" command showing permissions of files in a FAT32 partition?

Why is it that I can sometimes guess the next note?

Are Captain Marvel's powers affected by Thanos breaking the Tesseract and claiming the stone?

The Digit Triangles

Is this toilet slogan correct usage of the English language?

Which Article Helped Get Rid of Technobabble in RPGs?

"It doesn't matter" or "it won't matter"?



Design an algorithm capable of predicting collisions to choose alternative path using `tikzpicture` environment


Checking whether or not a node has been previously definedHow to draw a diagram of custom subject correlativitiesHow to connect `pic`s through a set of colorful arrows using `tikzpicture` environmentUsing tikz command inside tikzpicture environment (alignment problem)Using gnuplot in tikzpicture environment using pgf-packageAlternative for tikz's scope environment outside tikzpictureTikZ/ERD: node (=Entity) label on the insideTikzpicture curvature in path issueDraw an ellipse into two parts using tikzpicture environmentalgorithm and tikzpicture side by sideHow to create an ER diagram using tikzpicture environmentHow to draw this rectangle using tikzpicture environmentHow to connect `pic`s through a set of colorful arrows using `tikzpicture` environment













1















This is and addendum of a previous question: How to connect pics through a set of colorful arrows using tikzpicture environment.



I would like to be able to draw arrows that do not overlap with nodes and/or pictures without having to manually modify each and every one of the arrows that collide with them using tikz.



The MWE is taken from marmot's nice answer:



documentclassarticle
usepackage[margin=0in,footskip=0in,paperwidth=60cm,paperheight=29cm]geometry
usepackage[english]babel
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagehyperref

usepackagetikz
usetikzlibrarypositioning,fit,calc
pgfdeclarelayerbehind
pgfdeclarelayerbackground
pgfdeclarelayerforeground
pgfsetlayersbehind,background,main,foreground
tikzset
text field/.style=text height=1.5ex,align=center,rounded corners,
nonfillable title field/.style=text height=2ex,text depth=0.3em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
fillable title field/.style=text height=3.14ex,text depth=0em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
pics/fillable subject/.style=code=%
node[text field] (-TF)
hspace*-0.5emTextField[align=1,name=#1-day,width=1em,charsize=7pt,maxlen=2,bordercolor=1 1 1]~~/hspace*-0.15emTextField[align=1,name=#1-month,width=1em,charsize=7pt,maxlen=2,bordercolor=1 1 1]~~/hspace*-0emTextField[align=1,name=#1-year,width=2em,charsize=7pt,maxlen=4,bordercolor=1 1 1]~;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) #1;
draw[rounded corners] (-TF.south west) ,
pics/nonfillable subject/.style=code=%
node[text field] (-TF)
hspace1.2em~/~hspace1.15em~/~hspace2.35em;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) #1;
draw[rounded corners] (-TF.south west) ,
pics/fillable elective subject/.style=code= (-TF.south east)
-- cycle;
draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
,
pics/nonfillable elective subject/.style=code=%
node[text field] (-TF)
hspace1.2em~/~hspace1.15em~/~hspace2.35em;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) ;
draw[rounded corners] (-TF.south west) ,
manoooh/.style=column sep=-1.75cm,row sep=5mm,
manooohE/.style=column sep=-2.25cm,row sep=5mm,anchor=south,
electives/.style=column sep=-7.25cm,row sep=5mm,
fit sep/.initial=4pt, % change width of node (big rectangle shape)
fit dist/.initial=40pt, % change node distance (big rectangle shape)
inlay top sep/.initial=24pt,
matrix top sep/.initial=24pt,
manoooh curve/.style=to path=let p1=($(tikztotarget)-(tikztostart)$)
in (tikztostart) .. controls ($(tikztostart)+(#1*x1,0)$)
and ($(tikztotarget)+(-#1*x1,0)$) .. (tikztotarget),
manoooh curve/.default=0.3
% From https://tex.stackexchange.com/a/478723/152550

makeatletter% from https://tex.stackexchange.com/a/85531/121799
longdefifnodedefined#1#2#3%
@ifundefinedpgf@sh@ns@#1#3#2%

makeatother

begindocument
thispagestyleempty % To suppress page number
noindent
begintikzpicture
fill[white,fill=orange] (0,0) rectangle (paperwidth,-2cm) node[midway,align=center,font=Huge] bfseries Some text here\LARGE More text here;
endtikzpicture

ifdefinedmymatbottom
else
typeoutPleasespace recompilespace yourspace file!
defmymatbottom-150pt
fi
ifdefinedmyheight
else
defmyheight0
typeoutPleasespace recompilespace yourspace file!
fi
ifdefinedLstMatYShifts
else
defLstMatYShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi
ifdefinedLstMatXShifts
else
defLstMatXShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi

%typeoutheight:myheight
%typeoutxshifts(in):LstMatXShifts

vfill
centering
beginForm
begintikzpicture
% step 1: add the matrices, name them mat0, mat1 etc.
beginscope[local bounding box=matrices]
matrix[manoooh] (mat0) at (LstMatXShifts[0],LstMatYShifts[0])
pic[local bounding box=A] (0) nonfillable subject=Subject A; \
pic (1) nonfillable subject=Subject B; \
;
matrix[manoooh] (mat1) at (LstMatXShifts[1],LstMatYShifts[1])

pic (2) nonfillable subject=Subject C; \
pic (3) nonfillable subject=Subject D; \
pic (4) nonfillable subject=Subject E; \
pic (5) nonfillable subject=Subject F; \
pic (6) nonfillable subject=Subject G; \
pic (7) nonfillable subject=Subject H; \
pic (8) nonfillable subject=Subject I; \
pic[draw=red] (9) nonfillable subject=Subject J; \
;
matrix[manoooh] (mat2) at (LstMatXShifts[2],LstMatYShifts[2])
pic[draw=red] (10) nonfillable subject=Subject K; \
pic (11) nonfillable subject=Subject L; \
pic (12) nonfillable subject=Subject A; \
pic (13) nonfillable subject=Subject N; \
pic (14) nonfillable subject=Subject O; \
pic (15) nonfillable subject=Subject P; \
pic (16) nonfillable subject=Subject Q; \
pic (17) nonfillable subject=Subject R; \
;
matrix[manoooh] (mat3) at (LstMatXShifts[3],LstMatYShifts[3])
pic[draw=red] (18) nonfillable subject=Subject S; \
pic (19) nonfillable subject=Subject T; \
pic (20) nonfillable subject=Subject U; \
pic (21) nonfillable subject=Subject V; \
pic (22) nonfillable subject=Subject W; \
pic (23) nonfillable subject=Subject X; \
pic (24) nonfillable subject=Subject Y; \
pic (25) nonfillable subject=Subject Z; \
;
matrix[manooohE] (matE3) at (LstMatXShifts[3],mymatbottom)
pic (L3E1) nonfillable elective subject=Subject; & &
pic (L3E2) nonfillable elective subject=Subject; \
& pic (L3E3) nonfillable elective subject=Subject; & \
;
matrix[manoooh] (mat4) at (LstMatXShifts[4],LstMatYShifts[4])
& pic[draw=red] (26) nonfillable subject=Subject AA; & \
pic (27) nonfillable subject=Subject AB; & & pic (28) nonfillable subject=Subject AC; \
& pic (29) nonfillable subject=Subject AD; & \
& pic (30) nonfillable subject=Subject AE; & \
& pic (31) nonfillable subject=Subject AF; & \
& pic (32) nonfillable subject=Subject AG; & \
;
matrix[manooohE] (matE4) at (LstMatXShifts[4],mymatbottom)
pic (L4E1) nonfillable elective subject=Subject; \
;
matrix[manoooh] (mat5) at (LstMatXShifts[5],LstMatYShifts[5])
pic (33) nonfillable subject=Subject AH; \
pic (34) nonfillable subject=Subject AI; \
pic[draw=red] (35) nonfillable subject=Subject AJ; \
pic (36) nonfillable subject=Subject AK; \
;
matrix[manooohE] (matE5) at (LstMatXShifts[5],mymatbottom)
pic (L5E1) nonfillable elective subject=Subject; \
pic (L5E2) nonfillable elective subject=Subject; \
pic (L5E3) nonfillable elective subject=Subject; \
pic (L5E4) nonfillable elective subject=Subject; \
pic (L5E5) nonfillable elective subject=Subject; \
;
endscope
pgfmathsetmacrogroupwidth0
pgfmathsetmacrolastwidth0
foreach X in 0,...,5 %<- if you have more or less matrices, adjust 3

node[anchor=south,yshift=1cm,align=center,font=LARGEbfseriesboldmath]
at (matX
makeatletter
immediatewrite@mainauxxdefstringmymatbottom-mymatbottomrelax
immediatewrite@mainauxxdefstringmyheightmyheightrelax
immediatewrite@mainauxxdefstringLstMatYShiftsLstMatYShiftsrelax
immediatewrite@mainauxxdefstringLstMatXShiftsLstMatXShiftsrelax
makeatother

newcommandtotalnodes5 % Define the total of subjects that need arrows-1

% From https://tex.stackexchange.com/a/480685/152550

% now add the arrows.

defLstCon%

"2,...,9",%subjects that 0 links
"2,10,13,14",%subjects that 1 links
"11,14",%subjects that 2 links
"10,13,14,25",%subjects that 3 links
"36",%subjects that 8 links


foreach X in 0,...,totalnodes
pgfmathsetmacrohuenumX*0.75*(1/totalnodes)
definecolormycolorhsbhuenum,1,1
pgfmathsetmacromylstLstCon[X]
foreach Y in mylst
draw[-latex,mycolor,very thick] (X-Title.east)
to[manoooh curve] (Y-Title.west);


endtikzpicture
endForm

vfill

enddocument


MWE



We would be able to see those arrows using something like this paths:



What I want



As you can see, some yellow, lightblue and the blue arrows have undergone changes due to the collision of one (or more) pics.



It is preferable that the algorithm detects that if many colors circulate in the same path, choose another one, since it would be visually confusing to have many colors in the same passage. For example:



Example of what I want



Thanks!!









share

















  • 1





    I do not think there will be an easy algorithm that detects if some path already travelled through the same gap. What is possible is to add some style that draws a curve through gaps that you specify,

    – marmot
    2 mins ago











  • @marmot I do not think it is feasible to specify the path, since the diagram may suffer alterations in the positions of the objects, so the paths must be modified manually. If the detection of a lot of arrow traffic is a computational problem, leave it, it is not very important, I am satisfied with the automatic paths.

    – manooooh
    just now















1















This is and addendum of a previous question: How to connect pics through a set of colorful arrows using tikzpicture environment.



I would like to be able to draw arrows that do not overlap with nodes and/or pictures without having to manually modify each and every one of the arrows that collide with them using tikz.



The MWE is taken from marmot's nice answer:



documentclassarticle
usepackage[margin=0in,footskip=0in,paperwidth=60cm,paperheight=29cm]geometry
usepackage[english]babel
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagehyperref

usepackagetikz
usetikzlibrarypositioning,fit,calc
pgfdeclarelayerbehind
pgfdeclarelayerbackground
pgfdeclarelayerforeground
pgfsetlayersbehind,background,main,foreground
tikzset
text field/.style=text height=1.5ex,align=center,rounded corners,
nonfillable title field/.style=text height=2ex,text depth=0.3em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
fillable title field/.style=text height=3.14ex,text depth=0em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
pics/fillable subject/.style=code=%
node[text field] (-TF)
hspace*-0.5emTextField[align=1,name=#1-day,width=1em,charsize=7pt,maxlen=2,bordercolor=1 1 1]~~/hspace*-0.15emTextField[align=1,name=#1-month,width=1em,charsize=7pt,maxlen=2,bordercolor=1 1 1]~~/hspace*-0emTextField[align=1,name=#1-year,width=2em,charsize=7pt,maxlen=4,bordercolor=1 1 1]~;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) #1;
draw[rounded corners] (-TF.south west) ,
pics/nonfillable subject/.style=code=%
node[text field] (-TF)
hspace1.2em~/~hspace1.15em~/~hspace2.35em;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) #1;
draw[rounded corners] (-TF.south west) ,
pics/fillable elective subject/.style=code= (-TF.south east)
-- cycle;
draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
,
pics/nonfillable elective subject/.style=code=%
node[text field] (-TF)
hspace1.2em~/~hspace1.15em~/~hspace2.35em;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) ;
draw[rounded corners] (-TF.south west) ,
manoooh/.style=column sep=-1.75cm,row sep=5mm,
manooohE/.style=column sep=-2.25cm,row sep=5mm,anchor=south,
electives/.style=column sep=-7.25cm,row sep=5mm,
fit sep/.initial=4pt, % change width of node (big rectangle shape)
fit dist/.initial=40pt, % change node distance (big rectangle shape)
inlay top sep/.initial=24pt,
matrix top sep/.initial=24pt,
manoooh curve/.style=to path=let p1=($(tikztotarget)-(tikztostart)$)
in (tikztostart) .. controls ($(tikztostart)+(#1*x1,0)$)
and ($(tikztotarget)+(-#1*x1,0)$) .. (tikztotarget),
manoooh curve/.default=0.3
% From https://tex.stackexchange.com/a/478723/152550

makeatletter% from https://tex.stackexchange.com/a/85531/121799
longdefifnodedefined#1#2#3%
@ifundefinedpgf@sh@ns@#1#3#2%

makeatother

begindocument
thispagestyleempty % To suppress page number
noindent
begintikzpicture
fill[white,fill=orange] (0,0) rectangle (paperwidth,-2cm) node[midway,align=center,font=Huge] bfseries Some text here\LARGE More text here;
endtikzpicture

ifdefinedmymatbottom
else
typeoutPleasespace recompilespace yourspace file!
defmymatbottom-150pt
fi
ifdefinedmyheight
else
defmyheight0
typeoutPleasespace recompilespace yourspace file!
fi
ifdefinedLstMatYShifts
else
defLstMatYShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi
ifdefinedLstMatXShifts
else
defLstMatXShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi

%typeoutheight:myheight
%typeoutxshifts(in):LstMatXShifts

vfill
centering
beginForm
begintikzpicture
% step 1: add the matrices, name them mat0, mat1 etc.
beginscope[local bounding box=matrices]
matrix[manoooh] (mat0) at (LstMatXShifts[0],LstMatYShifts[0])
pic[local bounding box=A] (0) nonfillable subject=Subject A; \
pic (1) nonfillable subject=Subject B; \
;
matrix[manoooh] (mat1) at (LstMatXShifts[1],LstMatYShifts[1])

pic (2) nonfillable subject=Subject C; \
pic (3) nonfillable subject=Subject D; \
pic (4) nonfillable subject=Subject E; \
pic (5) nonfillable subject=Subject F; \
pic (6) nonfillable subject=Subject G; \
pic (7) nonfillable subject=Subject H; \
pic (8) nonfillable subject=Subject I; \
pic[draw=red] (9) nonfillable subject=Subject J; \
;
matrix[manoooh] (mat2) at (LstMatXShifts[2],LstMatYShifts[2])
pic[draw=red] (10) nonfillable subject=Subject K; \
pic (11) nonfillable subject=Subject L; \
pic (12) nonfillable subject=Subject A; \
pic (13) nonfillable subject=Subject N; \
pic (14) nonfillable subject=Subject O; \
pic (15) nonfillable subject=Subject P; \
pic (16) nonfillable subject=Subject Q; \
pic (17) nonfillable subject=Subject R; \
;
matrix[manoooh] (mat3) at (LstMatXShifts[3],LstMatYShifts[3])
pic[draw=red] (18) nonfillable subject=Subject S; \
pic (19) nonfillable subject=Subject T; \
pic (20) nonfillable subject=Subject U; \
pic (21) nonfillable subject=Subject V; \
pic (22) nonfillable subject=Subject W; \
pic (23) nonfillable subject=Subject X; \
pic (24) nonfillable subject=Subject Y; \
pic (25) nonfillable subject=Subject Z; \
;
matrix[manooohE] (matE3) at (LstMatXShifts[3],mymatbottom)
pic (L3E1) nonfillable elective subject=Subject; & &
pic (L3E2) nonfillable elective subject=Subject; \
& pic (L3E3) nonfillable elective subject=Subject; & \
;
matrix[manoooh] (mat4) at (LstMatXShifts[4],LstMatYShifts[4])
& pic[draw=red] (26) nonfillable subject=Subject AA; & \
pic (27) nonfillable subject=Subject AB; & & pic (28) nonfillable subject=Subject AC; \
& pic (29) nonfillable subject=Subject AD; & \
& pic (30) nonfillable subject=Subject AE; & \
& pic (31) nonfillable subject=Subject AF; & \
& pic (32) nonfillable subject=Subject AG; & \
;
matrix[manooohE] (matE4) at (LstMatXShifts[4],mymatbottom)
pic (L4E1) nonfillable elective subject=Subject; \
;
matrix[manoooh] (mat5) at (LstMatXShifts[5],LstMatYShifts[5])
pic (33) nonfillable subject=Subject AH; \
pic (34) nonfillable subject=Subject AI; \
pic[draw=red] (35) nonfillable subject=Subject AJ; \
pic (36) nonfillable subject=Subject AK; \
;
matrix[manooohE] (matE5) at (LstMatXShifts[5],mymatbottom)
pic (L5E1) nonfillable elective subject=Subject; \
pic (L5E2) nonfillable elective subject=Subject; \
pic (L5E3) nonfillable elective subject=Subject; \
pic (L5E4) nonfillable elective subject=Subject; \
pic (L5E5) nonfillable elective subject=Subject; \
;
endscope
pgfmathsetmacrogroupwidth0
pgfmathsetmacrolastwidth0
foreach X in 0,...,5 %<- if you have more or less matrices, adjust 3

node[anchor=south,yshift=1cm,align=center,font=LARGEbfseriesboldmath]
at (matX
makeatletter
immediatewrite@mainauxxdefstringmymatbottom-mymatbottomrelax
immediatewrite@mainauxxdefstringmyheightmyheightrelax
immediatewrite@mainauxxdefstringLstMatYShiftsLstMatYShiftsrelax
immediatewrite@mainauxxdefstringLstMatXShiftsLstMatXShiftsrelax
makeatother

newcommandtotalnodes5 % Define the total of subjects that need arrows-1

% From https://tex.stackexchange.com/a/480685/152550

% now add the arrows.

defLstCon%

"2,...,9",%subjects that 0 links
"2,10,13,14",%subjects that 1 links
"11,14",%subjects that 2 links
"10,13,14,25",%subjects that 3 links
"36",%subjects that 8 links


foreach X in 0,...,totalnodes
pgfmathsetmacrohuenumX*0.75*(1/totalnodes)
definecolormycolorhsbhuenum,1,1
pgfmathsetmacromylstLstCon[X]
foreach Y in mylst
draw[-latex,mycolor,very thick] (X-Title.east)
to[manoooh curve] (Y-Title.west);


endtikzpicture
endForm

vfill

enddocument


MWE



We would be able to see those arrows using something like this paths:



What I want



As you can see, some yellow, lightblue and the blue arrows have undergone changes due to the collision of one (or more) pics.



It is preferable that the algorithm detects that if many colors circulate in the same path, choose another one, since it would be visually confusing to have many colors in the same passage. For example:



Example of what I want



Thanks!!









share

















  • 1





    I do not think there will be an easy algorithm that detects if some path already travelled through the same gap. What is possible is to add some style that draws a curve through gaps that you specify,

    – marmot
    2 mins ago











  • @marmot I do not think it is feasible to specify the path, since the diagram may suffer alterations in the positions of the objects, so the paths must be modified manually. If the detection of a lot of arrow traffic is a computational problem, leave it, it is not very important, I am satisfied with the automatic paths.

    – manooooh
    just now













1












1








1








This is and addendum of a previous question: How to connect pics through a set of colorful arrows using tikzpicture environment.



I would like to be able to draw arrows that do not overlap with nodes and/or pictures without having to manually modify each and every one of the arrows that collide with them using tikz.



The MWE is taken from marmot's nice answer:



documentclassarticle
usepackage[margin=0in,footskip=0in,paperwidth=60cm,paperheight=29cm]geometry
usepackage[english]babel
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagehyperref

usepackagetikz
usetikzlibrarypositioning,fit,calc
pgfdeclarelayerbehind
pgfdeclarelayerbackground
pgfdeclarelayerforeground
pgfsetlayersbehind,background,main,foreground
tikzset
text field/.style=text height=1.5ex,align=center,rounded corners,
nonfillable title field/.style=text height=2ex,text depth=0.3em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
fillable title field/.style=text height=3.14ex,text depth=0em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
pics/fillable subject/.style=code=%
node[text field] (-TF)
hspace*-0.5emTextField[align=1,name=#1-day,width=1em,charsize=7pt,maxlen=2,bordercolor=1 1 1]~~/hspace*-0.15emTextField[align=1,name=#1-month,width=1em,charsize=7pt,maxlen=2,bordercolor=1 1 1]~~/hspace*-0emTextField[align=1,name=#1-year,width=2em,charsize=7pt,maxlen=4,bordercolor=1 1 1]~;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) #1;
draw[rounded corners] (-TF.south west) ,
pics/nonfillable subject/.style=code=%
node[text field] (-TF)
hspace1.2em~/~hspace1.15em~/~hspace2.35em;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) #1;
draw[rounded corners] (-TF.south west) ,
pics/fillable elective subject/.style=code= (-TF.south east)
-- cycle;
draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
,
pics/nonfillable elective subject/.style=code=%
node[text field] (-TF)
hspace1.2em~/~hspace1.15em~/~hspace2.35em;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) ;
draw[rounded corners] (-TF.south west) ,
manoooh/.style=column sep=-1.75cm,row sep=5mm,
manooohE/.style=column sep=-2.25cm,row sep=5mm,anchor=south,
electives/.style=column sep=-7.25cm,row sep=5mm,
fit sep/.initial=4pt, % change width of node (big rectangle shape)
fit dist/.initial=40pt, % change node distance (big rectangle shape)
inlay top sep/.initial=24pt,
matrix top sep/.initial=24pt,
manoooh curve/.style=to path=let p1=($(tikztotarget)-(tikztostart)$)
in (tikztostart) .. controls ($(tikztostart)+(#1*x1,0)$)
and ($(tikztotarget)+(-#1*x1,0)$) .. (tikztotarget),
manoooh curve/.default=0.3
% From https://tex.stackexchange.com/a/478723/152550

makeatletter% from https://tex.stackexchange.com/a/85531/121799
longdefifnodedefined#1#2#3%
@ifundefinedpgf@sh@ns@#1#3#2%

makeatother

begindocument
thispagestyleempty % To suppress page number
noindent
begintikzpicture
fill[white,fill=orange] (0,0) rectangle (paperwidth,-2cm) node[midway,align=center,font=Huge] bfseries Some text here\LARGE More text here;
endtikzpicture

ifdefinedmymatbottom
else
typeoutPleasespace recompilespace yourspace file!
defmymatbottom-150pt
fi
ifdefinedmyheight
else
defmyheight0
typeoutPleasespace recompilespace yourspace file!
fi
ifdefinedLstMatYShifts
else
defLstMatYShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi
ifdefinedLstMatXShifts
else
defLstMatXShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi

%typeoutheight:myheight
%typeoutxshifts(in):LstMatXShifts

vfill
centering
beginForm
begintikzpicture
% step 1: add the matrices, name them mat0, mat1 etc.
beginscope[local bounding box=matrices]
matrix[manoooh] (mat0) at (LstMatXShifts[0],LstMatYShifts[0])
pic[local bounding box=A] (0) nonfillable subject=Subject A; \
pic (1) nonfillable subject=Subject B; \
;
matrix[manoooh] (mat1) at (LstMatXShifts[1],LstMatYShifts[1])

pic (2) nonfillable subject=Subject C; \
pic (3) nonfillable subject=Subject D; \
pic (4) nonfillable subject=Subject E; \
pic (5) nonfillable subject=Subject F; \
pic (6) nonfillable subject=Subject G; \
pic (7) nonfillable subject=Subject H; \
pic (8) nonfillable subject=Subject I; \
pic[draw=red] (9) nonfillable subject=Subject J; \
;
matrix[manoooh] (mat2) at (LstMatXShifts[2],LstMatYShifts[2])
pic[draw=red] (10) nonfillable subject=Subject K; \
pic (11) nonfillable subject=Subject L; \
pic (12) nonfillable subject=Subject A; \
pic (13) nonfillable subject=Subject N; \
pic (14) nonfillable subject=Subject O; \
pic (15) nonfillable subject=Subject P; \
pic (16) nonfillable subject=Subject Q; \
pic (17) nonfillable subject=Subject R; \
;
matrix[manoooh] (mat3) at (LstMatXShifts[3],LstMatYShifts[3])
pic[draw=red] (18) nonfillable subject=Subject S; \
pic (19) nonfillable subject=Subject T; \
pic (20) nonfillable subject=Subject U; \
pic (21) nonfillable subject=Subject V; \
pic (22) nonfillable subject=Subject W; \
pic (23) nonfillable subject=Subject X; \
pic (24) nonfillable subject=Subject Y; \
pic (25) nonfillable subject=Subject Z; \
;
matrix[manooohE] (matE3) at (LstMatXShifts[3],mymatbottom)
pic (L3E1) nonfillable elective subject=Subject; & &
pic (L3E2) nonfillable elective subject=Subject; \
& pic (L3E3) nonfillable elective subject=Subject; & \
;
matrix[manoooh] (mat4) at (LstMatXShifts[4],LstMatYShifts[4])
& pic[draw=red] (26) nonfillable subject=Subject AA; & \
pic (27) nonfillable subject=Subject AB; & & pic (28) nonfillable subject=Subject AC; \
& pic (29) nonfillable subject=Subject AD; & \
& pic (30) nonfillable subject=Subject AE; & \
& pic (31) nonfillable subject=Subject AF; & \
& pic (32) nonfillable subject=Subject AG; & \
;
matrix[manooohE] (matE4) at (LstMatXShifts[4],mymatbottom)
pic (L4E1) nonfillable elective subject=Subject; \
;
matrix[manoooh] (mat5) at (LstMatXShifts[5],LstMatYShifts[5])
pic (33) nonfillable subject=Subject AH; \
pic (34) nonfillable subject=Subject AI; \
pic[draw=red] (35) nonfillable subject=Subject AJ; \
pic (36) nonfillable subject=Subject AK; \
;
matrix[manooohE] (matE5) at (LstMatXShifts[5],mymatbottom)
pic (L5E1) nonfillable elective subject=Subject; \
pic (L5E2) nonfillable elective subject=Subject; \
pic (L5E3) nonfillable elective subject=Subject; \
pic (L5E4) nonfillable elective subject=Subject; \
pic (L5E5) nonfillable elective subject=Subject; \
;
endscope
pgfmathsetmacrogroupwidth0
pgfmathsetmacrolastwidth0
foreach X in 0,...,5 %<- if you have more or less matrices, adjust 3

node[anchor=south,yshift=1cm,align=center,font=LARGEbfseriesboldmath]
at (matX
makeatletter
immediatewrite@mainauxxdefstringmymatbottom-mymatbottomrelax
immediatewrite@mainauxxdefstringmyheightmyheightrelax
immediatewrite@mainauxxdefstringLstMatYShiftsLstMatYShiftsrelax
immediatewrite@mainauxxdefstringLstMatXShiftsLstMatXShiftsrelax
makeatother

newcommandtotalnodes5 % Define the total of subjects that need arrows-1

% From https://tex.stackexchange.com/a/480685/152550

% now add the arrows.

defLstCon%

"2,...,9",%subjects that 0 links
"2,10,13,14",%subjects that 1 links
"11,14",%subjects that 2 links
"10,13,14,25",%subjects that 3 links
"36",%subjects that 8 links


foreach X in 0,...,totalnodes
pgfmathsetmacrohuenumX*0.75*(1/totalnodes)
definecolormycolorhsbhuenum,1,1
pgfmathsetmacromylstLstCon[X]
foreach Y in mylst
draw[-latex,mycolor,very thick] (X-Title.east)
to[manoooh curve] (Y-Title.west);


endtikzpicture
endForm

vfill

enddocument


MWE



We would be able to see those arrows using something like this paths:



What I want



As you can see, some yellow, lightblue and the blue arrows have undergone changes due to the collision of one (or more) pics.



It is preferable that the algorithm detects that if many colors circulate in the same path, choose another one, since it would be visually confusing to have many colors in the same passage. For example:



Example of what I want



Thanks!!









share














This is and addendum of a previous question: How to connect pics through a set of colorful arrows using tikzpicture environment.



I would like to be able to draw arrows that do not overlap with nodes and/or pictures without having to manually modify each and every one of the arrows that collide with them using tikz.



The MWE is taken from marmot's nice answer:



documentclassarticle
usepackage[margin=0in,footskip=0in,paperwidth=60cm,paperheight=29cm]geometry
usepackage[english]babel
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagehyperref

usepackagetikz
usetikzlibrarypositioning,fit,calc
pgfdeclarelayerbehind
pgfdeclarelayerbackground
pgfdeclarelayerforeground
pgfsetlayersbehind,background,main,foreground
tikzset
text field/.style=text height=1.5ex,align=center,rounded corners,
nonfillable title field/.style=text height=2ex,text depth=0.3em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
fillable title field/.style=text height=3.14ex,text depth=0em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
pics/fillable subject/.style=code=%
node[text field] (-TF)
hspace*-0.5emTextField[align=1,name=#1-day,width=1em,charsize=7pt,maxlen=2,bordercolor=1 1 1]~~/hspace*-0.15emTextField[align=1,name=#1-month,width=1em,charsize=7pt,maxlen=2,bordercolor=1 1 1]~~/hspace*-0emTextField[align=1,name=#1-year,width=2em,charsize=7pt,maxlen=4,bordercolor=1 1 1]~;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) #1;
draw[rounded corners] (-TF.south west) ,
pics/nonfillable subject/.style=code=%
node[text field] (-TF)
hspace1.2em~/~hspace1.15em~/~hspace2.35em;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) #1;
draw[rounded corners] (-TF.south west) ,
pics/fillable elective subject/.style=code= (-TF.south east)
-- cycle;
draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
,
pics/nonfillable elective subject/.style=code=%
node[text field] (-TF)
hspace1.2em~/~hspace1.15em~/~hspace2.35em;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) ;
draw[rounded corners] (-TF.south west) ,
manoooh/.style=column sep=-1.75cm,row sep=5mm,
manooohE/.style=column sep=-2.25cm,row sep=5mm,anchor=south,
electives/.style=column sep=-7.25cm,row sep=5mm,
fit sep/.initial=4pt, % change width of node (big rectangle shape)
fit dist/.initial=40pt, % change node distance (big rectangle shape)
inlay top sep/.initial=24pt,
matrix top sep/.initial=24pt,
manoooh curve/.style=to path=let p1=($(tikztotarget)-(tikztostart)$)
in (tikztostart) .. controls ($(tikztostart)+(#1*x1,0)$)
and ($(tikztotarget)+(-#1*x1,0)$) .. (tikztotarget),
manoooh curve/.default=0.3
% From https://tex.stackexchange.com/a/478723/152550

makeatletter% from https://tex.stackexchange.com/a/85531/121799
longdefifnodedefined#1#2#3%
@ifundefinedpgf@sh@ns@#1#3#2%

makeatother

begindocument
thispagestyleempty % To suppress page number
noindent
begintikzpicture
fill[white,fill=orange] (0,0) rectangle (paperwidth,-2cm) node[midway,align=center,font=Huge] bfseries Some text here\LARGE More text here;
endtikzpicture

ifdefinedmymatbottom
else
typeoutPleasespace recompilespace yourspace file!
defmymatbottom-150pt
fi
ifdefinedmyheight
else
defmyheight0
typeoutPleasespace recompilespace yourspace file!
fi
ifdefinedLstMatYShifts
else
defLstMatYShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi
ifdefinedLstMatXShifts
else
defLstMatXShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi

%typeoutheight:myheight
%typeoutxshifts(in):LstMatXShifts

vfill
centering
beginForm
begintikzpicture
% step 1: add the matrices, name them mat0, mat1 etc.
beginscope[local bounding box=matrices]
matrix[manoooh] (mat0) at (LstMatXShifts[0],LstMatYShifts[0])
pic[local bounding box=A] (0) nonfillable subject=Subject A; \
pic (1) nonfillable subject=Subject B; \
;
matrix[manoooh] (mat1) at (LstMatXShifts[1],LstMatYShifts[1])

pic (2) nonfillable subject=Subject C; \
pic (3) nonfillable subject=Subject D; \
pic (4) nonfillable subject=Subject E; \
pic (5) nonfillable subject=Subject F; \
pic (6) nonfillable subject=Subject G; \
pic (7) nonfillable subject=Subject H; \
pic (8) nonfillable subject=Subject I; \
pic[draw=red] (9) nonfillable subject=Subject J; \
;
matrix[manoooh] (mat2) at (LstMatXShifts[2],LstMatYShifts[2])
pic[draw=red] (10) nonfillable subject=Subject K; \
pic (11) nonfillable subject=Subject L; \
pic (12) nonfillable subject=Subject A; \
pic (13) nonfillable subject=Subject N; \
pic (14) nonfillable subject=Subject O; \
pic (15) nonfillable subject=Subject P; \
pic (16) nonfillable subject=Subject Q; \
pic (17) nonfillable subject=Subject R; \
;
matrix[manoooh] (mat3) at (LstMatXShifts[3],LstMatYShifts[3])
pic[draw=red] (18) nonfillable subject=Subject S; \
pic (19) nonfillable subject=Subject T; \
pic (20) nonfillable subject=Subject U; \
pic (21) nonfillable subject=Subject V; \
pic (22) nonfillable subject=Subject W; \
pic (23) nonfillable subject=Subject X; \
pic (24) nonfillable subject=Subject Y; \
pic (25) nonfillable subject=Subject Z; \
;
matrix[manooohE] (matE3) at (LstMatXShifts[3],mymatbottom)
pic (L3E1) nonfillable elective subject=Subject; & &
pic (L3E2) nonfillable elective subject=Subject; \
& pic (L3E3) nonfillable elective subject=Subject; & \
;
matrix[manoooh] (mat4) at (LstMatXShifts[4],LstMatYShifts[4])
& pic[draw=red] (26) nonfillable subject=Subject AA; & \
pic (27) nonfillable subject=Subject AB; & & pic (28) nonfillable subject=Subject AC; \
& pic (29) nonfillable subject=Subject AD; & \
& pic (30) nonfillable subject=Subject AE; & \
& pic (31) nonfillable subject=Subject AF; & \
& pic (32) nonfillable subject=Subject AG; & \
;
matrix[manooohE] (matE4) at (LstMatXShifts[4],mymatbottom)
pic (L4E1) nonfillable elective subject=Subject; \
;
matrix[manoooh] (mat5) at (LstMatXShifts[5],LstMatYShifts[5])
pic (33) nonfillable subject=Subject AH; \
pic (34) nonfillable subject=Subject AI; \
pic[draw=red] (35) nonfillable subject=Subject AJ; \
pic (36) nonfillable subject=Subject AK; \
;
matrix[manooohE] (matE5) at (LstMatXShifts[5],mymatbottom)
pic (L5E1) nonfillable elective subject=Subject; \
pic (L5E2) nonfillable elective subject=Subject; \
pic (L5E3) nonfillable elective subject=Subject; \
pic (L5E4) nonfillable elective subject=Subject; \
pic (L5E5) nonfillable elective subject=Subject; \
;
endscope
pgfmathsetmacrogroupwidth0
pgfmathsetmacrolastwidth0
foreach X in 0,...,5 %<- if you have more or less matrices, adjust 3

node[anchor=south,yshift=1cm,align=center,font=LARGEbfseriesboldmath]
at (matX
makeatletter
immediatewrite@mainauxxdefstringmymatbottom-mymatbottomrelax
immediatewrite@mainauxxdefstringmyheightmyheightrelax
immediatewrite@mainauxxdefstringLstMatYShiftsLstMatYShiftsrelax
immediatewrite@mainauxxdefstringLstMatXShiftsLstMatXShiftsrelax
makeatother

newcommandtotalnodes5 % Define the total of subjects that need arrows-1

% From https://tex.stackexchange.com/a/480685/152550

% now add the arrows.

defLstCon%

"2,...,9",%subjects that 0 links
"2,10,13,14",%subjects that 1 links
"11,14",%subjects that 2 links
"10,13,14,25",%subjects that 3 links
"36",%subjects that 8 links


foreach X in 0,...,totalnodes
pgfmathsetmacrohuenumX*0.75*(1/totalnodes)
definecolormycolorhsbhuenum,1,1
pgfmathsetmacromylstLstCon[X]
foreach Y in mylst
draw[-latex,mycolor,very thick] (X-Title.east)
to[manoooh curve] (Y-Title.west);


endtikzpicture
endForm

vfill

enddocument


MWE



We would be able to see those arrows using something like this paths:



What I want



As you can see, some yellow, lightblue and the blue arrows have undergone changes due to the collision of one (or more) pics.



It is preferable that the algorithm detects that if many colors circulate in the same path, choose another one, since it would be visually confusing to have many colors in the same passage. For example:



Example of what I want



Thanks!!







tikz-pgf positioning diagrams arrows





share












share










share



share










asked 5 mins ago









manoooohmanooooh

1,1471517




1,1471517







  • 1





    I do not think there will be an easy algorithm that detects if some path already travelled through the same gap. What is possible is to add some style that draws a curve through gaps that you specify,

    – marmot
    2 mins ago











  • @marmot I do not think it is feasible to specify the path, since the diagram may suffer alterations in the positions of the objects, so the paths must be modified manually. If the detection of a lot of arrow traffic is a computational problem, leave it, it is not very important, I am satisfied with the automatic paths.

    – manooooh
    just now












  • 1





    I do not think there will be an easy algorithm that detects if some path already travelled through the same gap. What is possible is to add some style that draws a curve through gaps that you specify,

    – marmot
    2 mins ago











  • @marmot I do not think it is feasible to specify the path, since the diagram may suffer alterations in the positions of the objects, so the paths must be modified manually. If the detection of a lot of arrow traffic is a computational problem, leave it, it is not very important, I am satisfied with the automatic paths.

    – manooooh
    just now







1




1





I do not think there will be an easy algorithm that detects if some path already travelled through the same gap. What is possible is to add some style that draws a curve through gaps that you specify,

– marmot
2 mins ago





I do not think there will be an easy algorithm that detects if some path already travelled through the same gap. What is possible is to add some style that draws a curve through gaps that you specify,

– marmot
2 mins ago













@marmot I do not think it is feasible to specify the path, since the diagram may suffer alterations in the positions of the objects, so the paths must be modified manually. If the detection of a lot of arrow traffic is a computational problem, leave it, it is not very important, I am satisfied with the automatic paths.

– manooooh
just now





@marmot I do not think it is feasible to specify the path, since the diagram may suffer alterations in the positions of the objects, so the paths must be modified manually. If the detection of a lot of arrow traffic is a computational problem, leave it, it is not very important, I am satisfied with the automatic paths.

– manooooh
just now










0






active

oldest

votes











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f480836%2fdesign-an-algorithm-capable-of-predicting-collisions-to-choose-alternative-path%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f480836%2fdesign-an-algorithm-capable-of-predicting-collisions-to-choose-alternative-path%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How should I use the fbox command correctly to avoid producing a Bad Box message?How to put a long piece of text in a box?How to specify height and width of fboxIs there an arrayrulecolor-like command to change the rule color of fbox?What is the command to highlight bad boxes in pdf?Why does fbox sometimes place the box *over* the graphic image?how to put the text in the boxHow to create command for a box where text inside the box can automatically adjust?how can I make an fbox like command with certain color, shape and width of border?how to use fbox in align modeFbox increase the spacing between the box and it content (inner margin)how to change the box height of an equationWhat is the use of the hbox in a newcommand command?

152 Atala Notae | Nexus externi | Tabula navigationis"Discovery Circumstances: Numbered Minor Planets"2000152Small-Body Database

Doxepinum Nexus interni Notae | Tabula navigationis3158DB01142WHOa682390"Structural Analysis of the Histamine H1 Receptor""Transdermal and Topical Drug Administration in the Treatment of Pain""Antidepressants as antipruritic agents: A review"