TikZ
compiles the following code to display two lines that intersect at right angles. A small square, drawn in black, with edge length 3mm and with a vertex at the point of intersection, indicates that the lines intersect at right angles. The right-angle mark bends around the dot at the origin, though. How can I keep I can avoid this distortion? (I want the right-angle mark to obscure the y-axis but not the dot at the origin.)
This is similar code that I had posted when I was asking about the clipping of arrowheads. I think one way to keep of doing this is to issue commands \path[name path=up] (-3.75,3.75) -- (3.75,3.75);
, ... \path[name path=left] (-3.75,-3.75) -- (-3.75,3.75);
, and to use the intersections
package to label the coordinates of the four intersections between the given lines and these four paths. I am not familiar with using the intersections
package, though.
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,quotes}
\begin{document}
\begin{tikzpicture}[outer sep=0pt,p/.style={circle, fill,inner sep=1.5pt}]
\draw[draw=gray!30,latex-latex] (-3.75,0) +(-0.25cm,0) -- (3.75,0) -- +(0.25cm,0) node[below right] {$x$};
\draw[draw=gray!30,latex-latex] (0,3.75) +(0,0.25cm) node[above right] {$y$} -- (0,-3.75) -- +(0,-0.25cm);
\clip (-3.75,-3.75) rectangle (3.75,3.75);
\draw[gray,dashed,line width=0.1pt] (-3.75,3.75) -- (3.75,3.75);
\draw[gray,dashed,line width=0.1pt] (-3.75,-3.75) -- (3.75,-3.75);
\draw[gray,dashed,line width=0.1pt] (-3.75,-3.75) -- (-3.75,3.75);
\draw[gray,dashed,line width=0.1pt] (3.75,-3.75) -- (3.75,3.75);
\draw[draw=blue!30,-latex] (0,0) -- (142:5);
\draw[draw=blue!30,-latex] (0,0) -- (-38:5);
\draw[draw=green!50,-latex] (0,0) -- (52:5);
\draw[draw=green!50,-latex] (0,0) -- (-128:5);
\coordinate[p,label={[fill=white]below right:$O$}] (O) at (0,0);
\coordinate (A) at (0:1);
\coordinate (B) at (52:1);
\path pic[draw, angle radius=5mm,"$\phi$",angle eccentricity=1.25] {angle = A--O--B};
\coordinate (a) at (180:1);
\coordinate (b) at (142:1);
\path pic[draw, angle radius=5mm,"$\theta$",angle eccentricity=1.25] {angle = b--O--a};
\coordinate (P) at (142:1);
\coordinate (Q) at (52:1);
\coordinate (R) at ($(O)!4mm! -45:(P)$);
\draw (R) -- ($(O)!(R)!(P)$);
\draw (R) -- ($(O)!(R)!(Q)$);
\filldraw[fill=white] (O) -- ($(O)!(R)!(P)$) -- (R) -- ($(O)!(R)!(Q)$) -- cycle;
\end{tikzpicture}
\end{document}
\end{tikzpicture}
to this:\draw (O.center)--($(O)!(R)!(P)$) -- (R) -- ($(O)!(R)!(Q)$)-- cycle;