Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
% See
\tikzset{/tikz/parallel cs/.cd,
to line initial coordinate/.store in=\tikz@parallelcs@toA,
to line final coordinate/.store in=\tikz@parallelcs@toB,
on line initial coordinate/.store in=\tikz@parallelcs@onA,
on line final coordinate/.store in=\tikz@parallelcs@onB,
from coordinate/.store in=\tikz@parallelcs@from,
to/.style args={#1--#2}{
to line initial coordinate=#1,
to line final coordinate=#2,
on/.style args={#1--#2}{
on line initial coordinate=#1,
on line final coordinate=#2,
from coordinate=#1
\tikzset{/tikz/parallel cs/.cd,#1}
(intersection of \tikz@parallelcs@from --$(\tikz@parallelcs@toA)!(\tikz@parallelcs@from)!90:(\tikz@parallelcs@toB)$ and \tikz@parallelcs@onA--\tikz@parallelcs@onB)%
% \node[point,label=$P$] (P) at (3,3) {};
% \draw[blue] (1.75,0) node[point,label=$A$] (A) {} -- (3,1) node[point,label=$B$] (B) {};
% \draw (0,1) node[point,label=$C$] (C) {} -- (2,3) node[point,label=$D$] (D) {};
% \draw[red] (P) -- (parallel cs:from=P,to=A--B,on=C--D) node [point,label=$Q$] (Q) {};
% \draw[black!30!white] (Q) -- (C)
% (D) -- (intersection of C--D and current bounding box.north west--current bounding box.north east);
% \draw[blue!30!white]
% (intersection of A--B and current bounding box.south west--current bounding box.south east) -- (A)
% (B) -- (intersection of A--B and current bounding box.north east--current bounding box.south east);
\tikzset{point/.style={draw,circle,inner sep=0pt,outer sep=0pt,minimum width=1pt,fill}}
\coordinate (P) at (0,4);
\coordinate (B-0) at (1,0);
\coordinate (A-1) at (2,0);
\coordinate (B-1) at (intersection of P--B-0 and 0,1--1,1);
\draw (P) -- (B-0) (P) -- (A-1);
\foreach[remember=\i as \lasti (initially 1)] \i in {2,...,15} {
\draw (B-\lasti)
-- (parallel cs:from=B-\lasti,to=B-0--A-1,on=P--A-1)
node[point] (A-\i) {}
-- (parallel cs:from=A-\i,to=A-1--B-1,on=P--B-0)
node[point] (B-\i) {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.