1
$\begingroup$

I have 2D plot:

p1 =ParametricPlot[{Sin[x],Cos[x]},{x,0,2*Pi}]

enter image description here

and another 2D plot:

p2=ParametricPlot[{(5-0.2*x)*Sin[x],Cos[x]},{x,0,2*Pi}]

enter image description here

and I want to make a 3D object out of that. It would have to merge from the front, which is p1 to the back, which is p2. How can I do it ? Thank you.

$\endgroup$
4
  • $\begingroup$ Something like a cylinder, but with different ends? $\endgroup$ Aug 10, 2016 at 15:19
  • $\begingroup$ @J.M. Yes, exactly. I give the two ends and Mathematica interpolates the surface between. $\endgroup$
    – henry
    Aug 10, 2016 at 15:51
  • $\begingroup$ For reference: this operation is sometimes called lofting. $\endgroup$ Aug 10, 2016 at 16:16
  • $\begingroup$ @J.M. Thanks !! $\endgroup$
    – henry
    Aug 10, 2016 at 16:24

1 Answer 1

6
$\begingroup$

ParametricPlot3D might help.

Defining your two 'end' functions:

f1[u_] := {Sin[u], Cos[u]}
f2[u_] := {(5 - 0.2 u) Sin[u], Cos[u]}

Then simply interpolate between the two as a function of length:

ParametricPlot3D[
 Append[v f1[u] + (1 - v) f2[u], v], {u, 0, 2 \[Pi]}, {v, 0, 1}, 
 BoxRatios -> {1, 1, 1}
]

enter image description here

$\endgroup$
6
  • 3
    $\begingroup$ One might also consider using a Hermite cubic instead of a linear function, as in this example. This is what you get. $\endgroup$ Aug 10, 2016 at 16:09
  • $\begingroup$ That's very nice!! $\endgroup$ Aug 10, 2016 at 16:11
  • $\begingroup$ @Quantum_oli Thank you very much! :) :) $\endgroup$
    – henry
    Aug 10, 2016 at 16:25
  • $\begingroup$ @Quantum_Oil can you try that: r[t_] := a + 1/bTanh[bSin[nt]] f1[t_] := 10*{r[t]*Cos[t], r[t]*Sin[t]} f2[t_] := {r[t]*Cos[t], r[t]*Sin[t]} (*Then simply interpolate between the two as a function of length:) ParametricPlot3D[ Append[v f1[u] + (1 - v) f2[u], v], {u, 0, 2 [Pi]}, {v, 0, 1}, Mesh -> 80, MeshFunctions -> Automatic] $\endgroup$
    – henry
    Aug 10, 2016 at 16:57
  • $\begingroup$ This does not work. $\endgroup$
    – henry
    Aug 10, 2016 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.