1

I need to draw in tikz something like to the two pictures bellow:

enter image description here enter image description here

that are inspire in Figura 34.8 of the book Gravitation (MTW).

enter image description here

Can anybody tell me how to draw these pictures?

  • If you have equations or tables you can generate a surface plot with pgfplots. However, obscuring parts with the horizontal planes will be more difficult. You can save screen coordinates for given 3D coordinates inside the axis environment, then continue drawing outside the axis environment. – John Kormylo Nov 09 '21 at 15:14
  • No, i don't have any equation or table to plot this figure. The ideia is not have a perfect description of the figure, but to obtain a similar image. – Daniel Borin Nov 09 '21 at 17:26
  • There are many example here of arbitrary 3D shapes. See https://tex.stackexchange.com/questions/255735/tikz-3dplot-draw-spheres-instead-of-circles-for-3d-diamond-lattice-site-visual, https://tex.stackexchange.com/questions/501274/tikz-3dplot-how-to-draw-small-circles-of-a-sphere-in-a-given-angle, https://tex.stackexchange.com/questions/295585/cube-in-tikz-not-drawn-correctly-possibly-a-bug-in-tikz, https://tex.stackexchange.com/questions/315726/image-with-tikz, and https://tex.stackexchange.com/questions/237712/truncated-octahedron-in-tikz. – John Kormylo Nov 09 '21 at 19:06

1 Answers1

7

I do not know Tikz, but here is a start with MetaPost/MetaFun that perhaps could get you up and running. Compiled with context. Have fun!

A picture of a black hole (omg!)

\starttext
\startMPpage[offset=3bp,instance=doublefun]
u:=1cm;% overall unit

% (theta,phi) spherical coordinates for viewpoint direction theta:=-80; phi:=15;

% scalar product primarydef u cdotprod v = redpart uredpart v + greenpart ugreenpart v + bluepart u*bluepart v enddef;

% Projection from 3D to 2D vardef P primary x = save ct,st,sp; ct:=cosd(theta); st:=sind(theta); sp:=sind(phi); (x cdotprod (-st,ct,0),x cdotprod (-ctsp,-stsp,cosd(phi))) enddef;

path S[],seam[],torso,waist,knee[],innerpants,outerpants[],grays[]; pair toe[],scrotch;

% The planes S[1] = (P(-3.5,-2.5,0) -- P(2,-2.5,0) -- P(2,2.5,0) -- P(-3.5,2.5,0) -- cycle) randomizedcontrols 0.75 scaled u;

S[2] = (P(-3.5,-2.5,3)

   P(2,-2.5,3)
   --
   P(2,2.5,3)
   --
   P(-3.5,2.5,3)
   --
   cycle)
   randomizedcontrols 0.75 scaled u;

% The body torso = (P(1,0,6) ... P(0,1,6) ... P(-1,0,6) ... P(0,-1,6) ... cycle) randomizedcontrols 0.2 scaled u;

waist = (P(1,0,3) ... P(0,1,3) ... P(-1,0,3) ... P(0,-1,3) ... cycle) randomizedcontrols 0.2 scaled u;

knee[1] = (P(1,0,0) ... P(0.75,0.4,0) ... P(0.5,0,0) ... P(0.75,-0.4,0) ... cycle) randomized 0.0 scaled u;

knee[2] = (P(-0.5,0,0) ... P(-0.75,0.4,0) ... P(-1,0,0) ... P(-0.75,-0.4,0) ... cycle) randomized 0.0 scaled u;

toe[1] = P(0.8,-0.3,-2.3) scaled u;

toe[2] = P(-0.9,0,-1.8) scaled u;

scrotch = P(0,0,1.5) scaled u;

outerpants[1] = (directionpoint dir 80 of torso){dir -100} .. {down}(directionpoint up of waist) .. (directionpoint up of knee[1]) .. toe[1];

outerpants[2] = (directionpoint dir -80 of torso){dir -80} .. {down}(directionpoint down of waist) .. (directionpoint down of knee[2]) .. {dir -80}toe[2];

innerpants = (toe[1] .. (directionpoint down of knee[1]) .. {dir 115}scrotch{dir -105} .. (directionpoint up of knee[2]) .. {dir -105}toe[2]);

for i=1 upto 5: seam[i] = (point 2.3+0.08i of torso){dir -87} .. (point 2.2+0.075i of waist) .. (point 2.35+0.2i of knee[2]) .. toe[2]; endfor;

for i=6 upto 10: seam[i] = (point 2.8+0.06i of torso){dir -90} .. (point 2.7+0.065i of waist) .. {dir -90}(point 2.3-0.1(i-5) of innerpants); endfor;

grays[1] = subpath(xpart(reverse outerpants[1] intersectiontimes waist), xpart(reverse outerpants[1] intersectiontimes torso)) of reverse outerpants[1] -- subpath(xpart(torso intersectiontimes outerpants[1]), xpart(torso intersectiontimes outerpants[2])) of torso -- subpath(xpart(outerpants[2] intersectiontimes torso), xpart(outerpants[2] intersectiontimes waist)) of outerpants[2] -- subpath(xpart(reverse waist intersectiontimes outerpants[2]), xpart(reverse waist intersectiontimes outerpants[1])) of reverse waist -- cycle;

grays[2] = subpath(xpart(outerpants[1] intersectiontimes knee[1]), xpart(outerpants[1] intersectiontimes subpath(0,1) of S[2])) of outerpants[1] -- reverse subpath(xpart(S[2] intersectiontimes reverse outerpants[1]), xpart(S[2] intersectiontimes reverse outerpants[2])) of S[2] -- subpath(xpart(outerpants[2] intersectiontimes (subpath(0,1) of S[2])), xpart(outerpants[2] intersectiontimes knee[2])) of outerpants[2] -- subpath(xpart(knee[2] intersectiontimes outerpants[2]), xpart(knee[2] intersectiontimes innerpants)) of knee[2] -- subpath(xpart(reverse innerpants intersectiontimes knee[2]), xpart(reverse innerpants intersectiontimes knee[1])) of reverse innerpants -- subpath(xpart(knee[1] intersectiontimes innerpants), xpart(knee[1] intersectiontimes outerpants[1])) of knee[1] -- cycle;

grays[3] = subpath(0, xpart(reverse outerpants[1] intersectiontimes S[1])) of reverse outerpants[1] -- reverse subpath(xpart(S[1] intersectiontimes reverse subpath(0,1) of innerpants), xpart(S[1] intersectiontimes reverse outerpants[1])) of S[1] -- reverse subpath(0, xpart(innerpants intersectiontimes S[1])) of innerpants -- cycle;

grays[4] = subpath(0, xpart(reverse innerpants intersectiontimes S[1])) of reverse innerpants -- reverse subpath(xpart (S[1] intersectiontimes reverse outerpants[2]), xpart (S[1] intersectiontimes reverse innerpants)) of S[1] -- reverse subpath(0, xpart (reverse outerpants[2] intersectiontimes S[1])) of (reverse outerpants[2]) -- cycle;

% Drawing time

% The planes draw S[1]; draw S[2];

% Fill for i = 1 upto 4: fill grays[i] withcolor 0.75white; endfor;

draw grays[3]; draw grays[4];

% Fix parts that were filled draw subpath(xpart (S[2] intersectiontimes reverse outerpants[2]), xpart (S[2] intersectiontimes reverse outerpants[1])) of S[2];

draw subpath(xpart (S[1] intersectiontimes reverse outerpants[2]), xpart (S[1] intersectiontimes reverse innerpants)) of S[1];

draw subpath(xpart (S[1] intersectiontimes innerpants), xpart (S[1] intersectiontimes reverse outerpants[1])) of S[1];

% Draw the rest of the parts draw torso;

draw subpath(0, xpart(outerpants[1] intersectiontimes waist)) of outerpants[1];

draw subpath(xpart(reverse outerpants[1] intersectiontimes knee[1]), xpart(reverse outerpants[1] intersectiontimes S[2])) of reverse outerpants[1];

draw subpath(0, xpart(reverse outerpants[1] intersectiontimes S[1])) of reverse outerpants[1];

draw subpath(0, xpart(innerpants intersectiontimes S[1])) of innerpants;

draw subpath(xpart(innerpants intersectiontimes knee[1]), xpart(innerpants intersectiontimes knee[2])) of innerpants;

draw subpath(xpart(outerpants[2] intersectiontimes torso), xpart(outerpants[2] intersectiontimes waist)) of outerpants[2];

draw subpath(xpart(reverse outerpants[2] intersectiontimes knee[2]), xpart(reverse outerpants[2] intersectiontimes S[2])) of reverse outerpants[2];

for i=1 upto 10: draw subpath(0, xpart(seam[i] intersectiontimes reverse waist)) of seam[i]; endfor;

for i=1 upto 5: draw subpath(xpart(reverse seam[i] intersectiontimes reverse knee[2]), xpart(reverse seam[i] intersectiontimes S[2])) of reverse seam[i]; draw subpath(0, xpart(reverse seam[i] intersectiontimes S[1])) of reverse seam[i]; endfor;

for i=6 upto 10: draw subpath(0, xpart(reverse seam[i] intersectiontimes S[2])) of reverse seam[i]; endfor;

\stopMPpage \stoptext

mickep
  • 8,685
  • I don't know the MetaPost @mickep, thank you to introduce that for me . I'm trying to insert this in my tex file in the same way of link, but it isn't work. Do you know a way to do this? – Daniel Borin Nov 11 '21 at 13:03
  • I haven't done that. but I think you could load the luamplib package. But then you should probably add beginfig(1); and endfig; as well. I do not know if the macro randomizedcontrols is from metapost or if it is in the metafun extension, though. My answer was more meant to be some kind of hint on how you could code the image, possibly in your favorite tool tikz(?). – mickep Nov 11 '21 at 16:36