add tag
Anonymous 1123
Let be given a tetrahedron `COAB`. `M`, `N` be two points lies on segments `CO`, `CA`; `P` is inside triagle `OAB`. I want to find intersection of the plane `MNP` and tetrahedron `COAB` like this picture
![ScreenHunter 892.png](/image?hash=ce35621b85961e5d61af94d882f34c62d242ef21ffa25d59122bf3f2f25b8f30) 
I tried
```
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\usepackage{fouriernc}
\usetikzlibrary{patterns.meta}
\usetikzlibrary{3dtools,intersections,calc}
\begin{document}
	\tdplotsetmaincoords{70}{80}
	\begin{tikzpicture}[scale=1,tdplot_main_coords,line join = round, line cap = round,declare function={a = 1/3;b = 2/3;}]
		\path
		(0,0,0) coordinate (O)
		(0,5,0) coordinate (A)
		(0,3,-3) coordinate (B) 
		(3/2,3,5) coordinate (C)
		[3d coordinate = {(M) = b*(O) - b*(C) + (C)}, 
		3d coordinate = {(N) = a*(A)  - a *(C) + (C)},
		3d coordinate = {(P) = 0.33333*(A)  +  0.3333333*(B) + 0.3333*(O)}] ;
		\path[3d/line through={(O) and (A) named lOA}];
			\path[3d/line through={(O) and (B) named lOB}];
		\path[3d/line through={(A) and (B) named lAB}];
		\path[3d/plane through=(M) and (N) and (P) named pMNP];
		\path[3d/intersection of={lOA with pMNP}] coordinate (Q);
		\path[3d/intersection of={lAB with pMNP}] coordinate (R);
		\path[3d/intersection of={lOB with pMNP}] coordinate (S);
		\foreach \p in {O,A,B,C,M,N,P,Q,R,S}
		\draw[fill=black] (\p) circle (1pt);
				\foreach \p/\g in {O/90,A/90,B/90,C/90,M/90,N/90,P/90,Q/30,R/90,S/90}
		\path (\p)+(\g:3mm) node{$\p$};
		\draw (C) -- (O) -- (B) -- (A) -- cycle (C) - - (B) (M) -- (S) (R) -- (N);
		\draw[dashed] (O) -- (A);
		\draw[pattern={Lines[angle=45]}]  (M) -- (N) -- (R) -- (S) -- cycle;
	\end{tikzpicture}
\end{document} 
```
How to choose the option of the point `P` randomly inside the triale `OAB` (to get a nice view) and how to get dashed lines `MN` and `SR`?

![ScreenHunter 893.png](/image?hash=30171290539e597495ae3e8fee775684d5c2b3c81d6fe21913f7604da818c79d)

PS. When I used `declare function={a = 1/2;b = 1/2;}`, the line `OA` is parallel to the plane `MNP`. I still get the point `Q`.
```
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\usepackage{fouriernc}
\usetikzlibrary{patterns.meta}
\usetikzlibrary{3dtools,intersections,calc}
\begin{document}
	\tdplotsetmaincoords{70}{80}
	\begin{tikzpicture}[scale=1,tdplot_main_coords,line join = round, line cap = round,declare function={a = 1/2;b = 1/2;}]
		\path
		(0,0,0) coordinate (O)
		(0,5,0) coordinate (A)
		(0,3,-3) coordinate (B) 
		(3/2,3,5) coordinate (C)
		[3d coordinate = {(M) = b*(O) - b*(C) + (C)}, 
		3d coordinate = {(N) = a*(A)  - a *(C) + (C)},
		3d coordinate = {(P) = 0.33333*(A)  +  0.3333333*(B) + 0.3333*(O)}] ;
		\path[3d/line through={(O) and (A) named lOA}];
			\path[3d/line through={(O) and (B) named lOB}];
		\path[3d/line through={(A) and (B) named lAB}];
		\path[3d/plane through=(M) and (N) and (P) named pMNP];
		\path[3d/intersection of={lOA with pMNP}] coordinate (Q);
		\path[3d/intersection of={lAB with pMNP}] coordinate (R);
		\path[3d/intersection of={lOB with pMNP}] coordinate (S);
		\foreach \p in {O,A,B,C,M,N,P,Q,R,S}
		\draw[fill=black] (\p) circle (1pt);
				\foreach \p/\g in {O/90,A/90,B/90,C/90,M/90,N/90,P/90,Q/30,R/90,S/90}
		\path (\p)+(\g:3mm) node{$\p$};
		\draw (C) -- (O) -- (B) -- (A) -- cycle (C) - - (B) (M) -- (S) (R) -- (N);
		\draw[dashed] (O) -- (A);
		\draw[pattern={Lines[angle=45]}]  (M) -- (N) -- (R) -- (S) -- cycle;
	\end{tikzpicture}
\end{document} ```

Top Answer
user 3.14159
You already did all the hard work. All I did was to randomize the position of `P`. To see how that works, consider first a parallelogram spanned by `(e1)=(A)-(O)` and `(e2)=(B)-(O)`. A random point is then given by `(P)=(O)+rA*(e1)+rB*(e2)`. For a triangle we need to mirror any point with `rA+rB>1` at the line `(A)--(B)`. 
```
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\usepackage{fouriernc}
\usetikzlibrary{patterns.meta}
\usetikzlibrary{3dtools,intersections,calc}
\begin{document}
\foreach \X in {1,...,20}
{\tdplotsetmaincoords{70}{80}
\begin{tikzpicture}[scale=1,tdplot_main_coords,line join=round, 
	line cap=round,declare function={a=1/3;b=2/3;}]
	\pgfmathsetseed{\X}
	\pgfmathsetmacro{\rndA}{rnd}
	\pgfmathsetmacro{\rndB}{rnd}
	\pgfmathtruncatemacro{\itest}{(\rndA+\rndB>1)}
	\ifnum\itest=1
	 \edef\tmp{\rndA}
	 \pgfmathsetmacro{\rndA}{1-\rndB}
	 \pgfmathsetmacro{\rndB}{1-\tmp}
	\fi
	\path
	(0,0,0) coordinate (O)
	(0,5,0) coordinate (A)
	(0,3,-3) coordinate (B) 
	(3/2,3,5) coordinate (C)
	[3d coordinate={(M)=b*(O) - b*(C) + (C)}, 
	3d coordinate={(N)=a*(A)  - a *(C) + (C)},
	3d coordinate={(P)=(O)+\rndA*(A)-\rndA*(O)+\rndB*(B)-\rndB*(O)}] ;
	\path[3d/line through={(O) and (A) named lOA}];
	\path[3d/line through={(O) and (B) named lOB}];
	\path[3d/line through={(A) and (B) named lAB}];
	\path[3d/plane through=(M) and (N) and (P) named pMNP];
	\path[3d/intersection of={lOA with pMNP}] coordinate (Q);
	\path[3d/intersection of={lAB with pMNP}] coordinate (R);
	\path[3d/intersection of={lOB with pMNP}] coordinate (S);
	\foreach \p in {O,A,B,C,M,N,P,Q,R,S}
	\draw[fill=black] (\p) circle (1pt);
			\foreach \p/\g in {O/90,A/90,B/90,C/90,M/90,N/90,P/90,Q/30,R/90,S/90}
	\path (\p)+(\g:3mm) node{$\p$};
	\draw (C) -- (O) -- (B) -- (A) -- cycle (C) - - (B) (M) -- (S) (R) -- (N);
	\draw[dashed] (O) -- (A);
	\path[pattern={Lines[angle=45]}]  (M) -- (N) -- (R) -- (S) -- cycle;
	\path[dashed] (M) edge (N) (S) edge (R);
\end{tikzpicture}}
\end{document} 
```
![ani.gif](/image?hash=24f1f7b60e35225104422eabdf1c9f2c361b74e94d01c7c98fd74da6ad52ce01)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.