Partly referring to the code of a previous question, this is an attempt to fill
with color a rectangle
in the 3D space. The plane has the points c
and d
as its extreme vertices:
\documentclass[border=2mm,tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,calc,intersections}
\begin{document}
\begin{tikzpicture}
\draw[->] (-3,0,0) -- (3,0,0) node[below right] {$x$};
\draw[->] (0,-3,0) -- (0,3,0) node[above right] {$y$};
\draw[->] (0,0,-3) -- (0,0,3) node[below right] {$z$};
\coordinate (o) at (0,0,0);
\coordinate (a) at (3.1,0,1.2);
\draw[dashed] (a) -- (o);
\path (a) -- coordinate[pos=0.32] (b) (o);
\draw [thick,-{Straight Barb},orange] (a) -- ($(a)!1.2cm!90:(o)$) coordinate[label={[black]above left:c}] (c);
\draw[thick,-{Straight Barb},gray] (a) -- node[pos=0.7, below=0.35em] {b} (b);
\draw [thick,-{Straight Barb},red] (a) -- ([shift={(0,1.5,0)}]a) coordinate[label={[black]above right:d}] (d);
\fill[blue!50,opacity=0.6] (c) rectangle (d);
\end{tikzpicture}
\end{document}
Only the x
and y
components of the points c
and d
have been considered, however, so that the rectangle is parallel to the (x,y) plane:
The use of \draw (c) rectangle (d);
instead of fill
gives the same result.
The rectangle should instead have the vectors d
and c
as its sides, therefore being orthogonal to vector b
.
1) How to accomplish this?
2) How to customly extend the rectangle surface beyond the vectors d
and c
, so drawing a greater area, keeping the same orientation in space?
As noticed in the answer, the above code does not use tikz-3dplot. If, however, this package can provide a solution besides the traditional TikZ-only approach, it is ok as well and it can be used here.