# How to plot a surface over a given curve?

Suppose $\gamma$ be a given closed curve. Does anyone know how to plot a surface over the $\gamma$ with (Image of) the following equation: \begin{aligned} f:\gamma\times \gamma&\to \Bbb R^3\\ (x,y)&\mapsto \left(\frac{x+y}{2},\|x-y\|\right) \end{aligned} I have seen this function here.

• I think you need to provide a little bit of explanation. The curve seems to be a 2D curve because otherwise it is not clear what ((x+y)/2, ||x-y||) is. Also, a curve example is always a good idea (and clarifies the first issue automatically). – Kuba Jan 8 '18 at 11:11

Can't watch this episode now so I will focus only on what you've written.

I think what you ask can be done as follows:

γ[t_] := {Sin[t], Sin[2 t], 0};

Show[
ParametricPlot3D[γ[u], {u, 0, 2 Pi}, PlotStyle -> Red]
, ParametricPlot3D[(γ[u] + γ[v])/2 + {0, 0, Norm[γ[v] - γ[u]]}
, {u, 0, 2 Pi}, {v, 0, 2 Pi}
, PlotStyle -> Opacity@.7
]
, PlotRange -> All
]


• Thanks @Kuba. Is it possible to plot this surface in Maple? because I don't have Mathematica. – C.F.G Jan 8 '18 at 12:18
• @C.F.G I don't know :) this site is about Wolfram Mathematica software. But if there is something like parametricPlot3D there should be no problem. – Kuba Jan 8 '18 at 12:20
• Is it possible plot online in wolfram web as above? – C.F.G Jan 8 '18 at 12:24
• @C.F.G try sandbox.open.wolframcloud.com – Kuba Jan 8 '18 at 12:29

Consider this arbitrary simple closed curve (hand drawn):

This was parametrized as follows:

xs = cd[[All, 1]]~Join~{cd[[1, 1]]};
ys = cd[[All, 2]]~Join~{cd[[1, 2]]};
ix = Interpolation[xs];
iy = Interpolation[ys];
ixf[t_] := ix[Rescale[t, {0, 2 Pi}, {1, 85}]];
iyf[t_] := iy[Rescale[t, {0, 2 Pi}, {1, 85}]];
par[t_] := {ixf[t], iyf[t]};
ParametricPlot[par[t], {t, 0, 2 Pi}]


Now to simulate video:

func[f_, u_, v_] := ((f[u] + f[v])/2)~Join~{Norm[f[u] - f[v]]}
lns[f_, u_, v_] :=
With[{p1 = f[u]~Join~{0}, p2 = f[v]~Join~{0}},
Graphics3D[{PointSize[0.04], Red, Point[p1], Blue, Point[p2],
Line[{p1, p2}], Green, Point[(p1 + p2)/2], Black, Thick,
Line[{(p1 + p2)/2, (p1 + p2)/2 + {0, 0, Norm[p1 - p2]}}]}]]
Manipulate[Show[pp, lns[par, a, b]], {a, 0, 2 Pi}, {b, 0, 2 Pi},
Initialization :> (pp =
ParametricPlot3D[func[par, u, v], {u, 0, 2 Pi}, {v, 0, 2 Pi},
MeshFunctions -> {#3 &}, Mesh -> 10, PlotStyle -> Opacity[0.1],
PerformanceGoal -> "Quality", PlotPoints -> 25])]


For example let's take the closed curve

k[φ_] := {Cos[φ], Sin[φ ],Sin[2 φ]};
ParametricPlot3D[k[φ], {φ, 0, 2 Pi}, Axes -> False]


For two point k[φ1] , k[φ2] the projection you are looking for can be created using

Show[{
ParametricPlot3D[(k[\[CurlyPhi]1] + k[\[CurlyPhi]2])/2 + (k[\[CurlyPhi]1] +k[\[CurlyPhi]2])/    Sqrt[(k[\[CurlyPhi]1] + k[\[CurlyPhi]2]).(k[\[CurlyPhi]1]+k[\[CurlyPhi]2])]Sqrt[(k[\[CurlyPhi]1] - k[\[CurlyPhi]2]).(k[\[CurlyPhi]1] -k[\[CurlyPhi]2])]
, {\[CurlyPhi]1, 0, 2 Pi}, {\[CurlyPhi]2, 0,
2 Pi}, Mesh -> None, Boxed -> False, Axes -> False,PlotStyle -> Opacity[0.5]]
, ParametricPlot3D[k[\[CurlyPhi]], {\[CurlyPhi], 0, 2 Pi},Axes -> False,PlotStyle -> Red]


}]

• I'm not sure how to interpret the question for general 3D closed curve but your solution does not match mine in 2D case. I don't claim mine is correct though. – Kuba Jan 8 '18 at 11:14
• In my approach the surface point[k1,k2] is (k1+k2)/2+Normalize[k1+k2] |k1-k2] – Ulrich Neumann Jan 8 '18 at 11:33