Created
May 24, 2017 19:11
-
-
Save leingang/5afe373909f5cf584080dffbfbb25f10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[png]{standalone} | |
\usepackage{tikz} | |
\usetikzlibrary{calc} | |
% See http://tex.stackexchange.com/questions/276935/tikz-projection-parallel-to-given-line | |
\makeatletter | |
\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/.style={ | |
from coordinate=#1 | |
} | |
} | |
\tikzdeclarecoordinatesystem{parallel}{ | |
\tikzset{/tikz/parallel cs/.cd,#1} | |
\tikz@scan@one@point\pgfutil@firstofone% | |
(intersection of \tikz@parallelcs@from --$(\tikz@parallelcs@toA)!(\tikz@parallelcs@from)!90:(\tikz@parallelcs@toB)$ and \tikz@parallelcs@onA--\tikz@parallelcs@onB)% | |
\relax | |
} | |
\makeatother | |
\begin{document} | |
%\begin{tikzpicture} | |
% \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); | |
%\end{tikzpicture} | |
\begin{tikzpicture} | |
\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) {}; | |
} | |
\end{tikzpicture} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment