Graphics, Figures & TablesTikZ intersections

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
maxmax
Posts: 29
Joined: Sat Sep 03, 2011 11:19 am

TikZ intersections

Post by maxmax »

Hi all,

i'm rather new to TikZ and have some problems with the intersection package.

I want to draw the picture which i attached in the pdf-file (but without the surrounding box which i added for a better description of the actual problem). As you can see, i already figured out some code that works, but which does not please me. The code is:

Code: Select all

\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\usepackage{tikz}
\usetikzlibrary{intersections}

\begin{document}
\boxed{
	\begin{tikzpicture}
	
		\coordinate (a) at (3,0);
		
		\draw[thick, name path = mirror] (-1,-1) -- (1,1) node[midway, above, sloped] {Plasma mirror};

		\path[name path = wall] (-1,-5) -- (1,-5);
		\path[name path = ray1] (a) -- ++(175:3);
		\path[name path = ray2] (a) -- ++(185:3.5);  
		\draw[|-|] (a) -- ++(2,0) node[midway, above] {$\sim 1cm$} node[midway, below] {$L_{acc}$};
	
		\path[	name intersections={of = mirror and ray1, by=m1},
						name intersections={of = mirror and ray2, by=m2}	];

		\path[name path = ray1m] (m1) -- ++ (275:6);
		\path[name path = ray2m] (m2) -- ++ (265:6);
	
		\path[	name intersections={of = wall and ray1m, by=w1},
						name intersections={of = wall and ray2m, by=w2}	];

		\draw (a) -- (m2) -- (w2);
		\draw (a) -- (m1) -- (w1) node[midway,right] {$\sim 1m$};

	\end{tikzpicture}
	}
\end{document}
The problem is, that in order to find the intersection points of the rays and the mirror or the invisible wall (to make the rays end at the same y-position), i created longer, invisible lines, that start at the left end of the L_{acc} line and have to intersect the mirror. The problem is the length of these invisible lines. The surrounding box always includes these invisible lines, so that i have to figure out the smallest possible line length for the invisible paths by hand.

Is there a possibility to get the intersection of a path with a virtual infinite straight line?

Regards,
Max
Attachments
FigureTest.pdf
(35.95 KiB) Downloaded 311 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply