TransWikia.com

How to Draw 3D Labeled Graph

TeX - LaTeX Asked by user240220 on July 26, 2021

So I am currently working on making a couple mechanics problems and I don’t exactly want to just paste my scuffed drawings into my document if possible. I tried using Tikz but to be honest I have no clue what I am doing. Any one know how I could make this?
3D Disk

One Answer

It is possible to draw the figure with a couple of tikz commands. You only need to draw lines, circles, arcs, and put a node here an there with the labels. Also, the calc and 3d libraries can be useful with some scopes to change temporarily the frame of reference. Something like this:

documentclass[border=2mm]{standalone}
usepackage    {tikz}
usetikzlibrary{3d}
usetikzlibrary{calc}

begin{document}
begin{tikzpicture}[line cap=round,line join=round,
  x={(-0.5cm,-0.5cm)},y={(1cm,0cm)},z={(0cm,1cm)},        % cavalier axes 
%  x={(-0.86cm,-0.5cm)},y={(0.86cm,-0.5cm)},z={(0cm,1cm)}  % isometric axes
  ]
  defha{2.5}  % A height
  defhc{0.8}  % circle height
  defrc{1.5}  % circle radius
  defam{75}   % angle for m and B
  coordinate (O) at (0,0,0);
  coordinate (A) at (0,0,ha);
  coordinate (C) at (0,0,hc); % circle center
  coordinate (m) at ($(C)+(am:rc)$);
  coordinate (B) at ($(A)!1.4!(m)$);
  % AXES
  draw[-latex] (O) -- (1.5*ha,0,0) node [left]  {$x$};
  draw[-latex] (O) -- (0,1.5*ha,0) node [right] {$y$};
  draw         (O) -- (C);
  % circle (filled and not)
  draw[thick,blue,canvas is xy plane at z=hc,fill=blue!20,fill opacity=0.9] (0,0) circle (rc);
%  draw[thick,blue,canvas is xy plane at z=hc] (0,0) circle (rc);
  % angles
  begin{scope}[rotate around z=am, canvas is xz plane at y=0]
    draw[red]    ($(C)+(0.2,0)$)  |- ($(C)+(0,0.2)$);
    node[red] at ($(A)+(0,-0.4)$) [left] {$alpha$};
    clip (O) -- (A) -- (B) -- cycle;
    draw[red]   (A) circle (0.4);
    draw[red,dashed] (m) -- (C);
  end{scope}
  begin{scope}[canvas is xy plane at z=1.25*ha]
    draw[red,canvas is xy plane at z=1.25*ha,->] (0,-0.4) arc (-90:180:0.4);
    node[red] at (0,0.4) [right] {$omega$};
  end{scope}
  % line AB and points
  draw[-latex] (C) -- (0,0,1.5*ha) node [above] {$z$}; % top part of z axis
  draw[thick,gray] (A) node [black,left] {$A$} -- (B) node [black,below] {$B$};
  fill (m) circle (2pt) node [right] {$(x,y,z)$};
  node at (m) [below] {$m$};
  node at ($(A)!0.4!(m)$) [right] {$r$};
end{tikzpicture}
end{document}

I personally prefer the looks of the picture in isometric perspective rather than cavalier. I include both figures, and you can switch between one or another just commenting one set of axes x=..., y=..., z=.... enter image description here

EDIT: I added a filling to the disc, as @projetmbc suggested. I had to change the order of some elements, but the only real change is the filling. enter image description here

Answered by Juan Castaño on July 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP