TeX - LaTeX Asked by Joe S on March 5, 2021
I have a scalar field f(x,y)=1-x and a curve C given as the graph of g(x)=4x(1-x). My goal is to fill the area between the curve (x,g(x),f(x,g(x))) and its projection (x,g(x),0). Up to this point, I’m only able to draw some (many) support lines, but this keeps looking weird. I’m looking for a solution, that uses fillbetween or clip or maybe a plot of the resulting parametric surface y=4x(1-x) with x between 0 and 1 and z between 0 and 1-x.
The picture serves as a graphical interpretation of a standard line integral of a scalar field along a parametrized curve.
My ideas so far:
documentclass{standalone}
usepackage{tikz,pgfplots}
usetikzlibrary{calc}
pgfplotsset{compat=1.16}
usepgfplotslibrary{fillbetween}
begin{document}
begin{tikzpicture}
begin{axis}[
declare function={f(x,y)=1-x;},
declare function={g(x)=4*x*(1-x);},
view={60}{30},
enlargelimits=false,
ticks=none
]
pgfplotsinvokeforeach{0,0.001,...,1}{
draw[gray] (#1,{g(#1)},{f(#1,#1)}) -- (#1,{g(#1)},0);
}
addplot3[
name path=B,
variable=t,
mesh,
gray,
domain=0:1,
domain y=0:1,
] (t,{g(t)},0);
addplot3[
name path=A,
variable=t,
mesh,
domain=0:1,
domain y=0:1,
] (t,{g(t)},{f(t,{g(t)})}); %closedcycle;
%addplot3[blue!50] fill between[of=B and A];
end{axis}
end{tikzpicture}
end{document}
The loop is not satisfying as it allows the coordinate axis/box lines to shine through. Any ideas, how to accomplish this goal?
As an alternative, Asymptote
version:
//
// param3d.asy
//
// to get a standalone param3d.png, run
// asy -f png -render=4 param3d.asy
//
import graph3;
size(200,0);
currentlight.background=paleyellow+opacity(0.0);
currentprojection=orthographic(camera=(65,-36,25),up=Z,target=(0,0,0),zoom=1);
triple fs1(pair t){
real u=t.x, v=t.y;
return (u,4*u*(1-u),(1-u)*(1-v));
}
surface s1=surface(fs1,(0,0),(1,1),nu=100,nv=100);
draw(s1,orange+opacity(0.8),meshpen=nullpen,render(merge=true));
draw(surface((0,0,0)--(1,0,0)--(1,1,0)--(0,1,0)--cycle),lightblue+thick());
Answered by g.kov on March 5, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP