I want to use asymptote
to illustrate Stokes theorem as in the following figure.
Here is what I've done so far.
import three;
size(6cm,0);
path path2D = (1, 0) .. (2, 1) .. (0, 2) .. (-2.25, 1) .. (-1.5, 0) .. (-1, -1) .. (0, -1.75) .. (1, -2) .. cycle;
path3 path3D = path3(path2D, XYplane);
draw(path3D, red, arrow = Arrow3(emissive(black), position = Relative(.9)), L = Label("$\mathcal{C}$", align = S, position = Relative(.9)));
int imax = 10;
for(int i = 1; i < imax; ++i) {
draw(shift((0, 0, i / (imax / 2))) * scale3(sqrt((imax - i - .9)/imax)) * path3D);
}
-
How can I draw a surface "guided" by black paths and "lying" on the red path?
-
How can I "randomize" a bit more the black guides and, consequently, the surface (the Stokes theorem states that one can choose any surface lying on the path)?
-
Once the surface is defined, given a point M belonging to it, is it possible to get the normal vector in M (and then reuse the corkscrew question
:)
)?
Best Answer
In this solution the surface is defined by function
It takes two arguments:
z.x
defines a fraction of arclength of the horizontal path, andz.y
defines vertical shift.Given a point
M
on the surface asthe normal vector is constructed as a cross product of direction vectors of two paths on the surface (
u-path
andv-path
). at the pointM
.Complete code: