I've been trying to look for a 3d triangle with 3 points labeled like this :
but I just need 3 points like; (1,0,2), (0,-1,1) and (2,1,2). How to do this?
Asked
Active
Viewed 205 times
1 Answers
2
The code below is in noway a complete answer but intends to give a start point in plotting 3D coordinates in LaTeX/Tikz-3dplot
The vertex shown as A2 was originally shown as
\coordinate[label=above right:{$(0,0,5)$}] (A) at (0,0,5);
I have simplly changed it to A2 to suit your requirement
Similarly for the vertices marked as A1 and C2--Check out if all clear or more help required
% !TeX program = pdflatex
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{tikz,tikz-3dplot}
\tdplotsetmaincoords{60}{120}
\begin{document}
\begin{tikzpicture}[>=stealth,tdplot_main_coords]
\coordinate (O) at (0,0,0);
\coordinate[label=above right:{A2}] (A2) at (0,0,5);
\coordinate[label=above left:{C2}] (C2) at (2,0,2);
\coordinate[label=above right:{$(0,3,3)$}] (C) at (0,3,3);
\coordinate[label=above left:{A1}] (A1) at (5,0,0);
\coordinate[label=above right:{$(0,5,0)$}] (E) at (0,5,0);
\draw[->] (O) -- (6,0,0);
\draw[->] (O) -- (0,6,0);
\draw[->] (O) -- (0,0,6);
\filldraw[draw=brown,fill=brown,fill opacity=0.1] (A2) -- (C2) -- (2,3,0) -- (C) -- cycle;
\filldraw[draw=brown,fill=brown,fill opacity=0.1] (C2) -- (2,0,0) -- (2,3,0)-- cycle;
\filldraw[draw=brown,fill=brown,fill opacity=0.1] (C) -- (0,3,0) -- (2,3,0)-- cycle;
\fill[fill=blue,fill opacity=0.1] (C2) -- (A2) -- (2,3,0)-- cycle;
\fill[fill=blue,fill opacity=0.1] (C) -- (E) -- (2,3,0)-- cycle;
\draw[blue] (C2) -- (A1) -- (E) -- (C);
\end{tikzpicture}
\end{document}
Courtesy--https://www.latex4technics.com/?note=5qq
EDIT
In line with the suggestion @Sebastiano
color fill
has been done and @Sigur
standalone
deployed
\documentclass{standalone}
\usepackage[T1]{fontenc}
\usepackage{tikz,tikz-3dplot}
\tdplotsetmaincoords{60}{120}
\begin{document}
\begin{tikzpicture}[>=stealth,tdplot_main_coords]
\coordinate (O) at (0,0,0);
\coordinate[label=above right:{$(0,0,5)$}] (A) at (0,0,5);
\coordinate[label=above left:{$(2,0,2)$}] (B) at (2,0,2);
\coordinate[label=above right:{$(0,3,3)$}] (C) at (0,3,3);
\coordinate[label=above left:{$(5,0,0)$}] (D) at (5,0,0);
\coordinate[label=above right:{$(0,5,0)$}] (E) at (0,5,0);
\draw[->] (O) -- (6,0,0);
\draw[->] (O) -- (0,6,0);
\draw[->] (O) -- (0,0,6);
\filldraw[draw=brown,fill=brown,fill opacity=0.3] (A) -- (B) -- (2,3,0) -- (C) -- cycle;
\filldraw[draw=blue,fill=blue,fill opacity=0.5] (B) -- (2,0,0) -- (2,3,0)-- cycle;
\filldraw[draw=red,fill=red,fill opacity=0.5] (C) -- (0,3,0) -- (2,3,0)-- cycle;
\filldraw[draw=blue,fill=blue,fill opacity=0.3] (B) -- (D) -- (2,3,0)-- cycle;
\filldraw[draw=red,fill=red,fill opacity=0.3] (C) -- (E) -- (2,3,0)-- cycle;
\end{tikzpicture}
\end{document}
EDIT
Added a bit more symmetry to the triangle--A'--B'--C'--D'--E' are the respective mid points of the triangle sides
\documentclass{standalone}
\usepackage[T1]{fontenc}
\usepackage{tikz,tikz-3dplot}
\usepackage{calc}
\tdplotsetmaincoords{60}{120}
\begin{document}
\begin{tikzpicture}[>=stealth,tdplot_main_coords]
\coordinate (O) at (0,0,0);
\coordinate[label=above right:{$(0,0,5)$}] (A) at (0,0,5);
\coordinate[label=above left:{$(5,0,0)$}] (D) at (5,0,0);
\coordinate[label=above right:{$(0,5,0)$}] (E) at (0,5,0);
\coordinate[label=above right:{$(0,0,0)$}] (O) at (0,0,0);
\draw[->] (O) -- (6,0,0);
\draw[->] (O) -- (0,6,0);
\draw[->] (O) -- (0,0,6);
\filldraw[draw=red,fill=red, fill opacity=0.1] (A)--(D)--(E)--cycle;
\coordinate[label=above right:$A’$] (Aprime) at ($(A)!0.5!(E)$);
\coordinate[label=above left:$B’$] (Bprime) at ($(A)!0.5!(D)$);
\coordinate[label=below right:$C’$] (Cprime) at ($(D)!0.5!(E)$);
\coordinate[label=above left:$D’$] (Dprime) at ($(O)!0.5!(D)$);
\coordinate[label=above right:$E’$] (Eprime) at ($(O)!0.5!(E)$);
\filldraw[draw=red, fill=red,fill opacity=.5] (Bprime)--(Dprime)--(Cprime)--cycle;
\filldraw[draw=blue, fill=blue,fill opacity=.5] (Aprime)--(Eprime)--(Cprime)--cycle;
\end{tikzpicture}
\end{document}
js bibra
- 21,280
-
Maybe you should change the colors and give the correct fill. I appreciate your answer. – Sebastiano Jan 13 '20 at 21:32
-
1
-
1
-
1



\arccosinstead ofarccosand\iffinstead of\Leftrightarrow(looks better, and tells more - "what you see is what you mean" paradigm). – ivankokan Jan 14 '20 at 00:43