4
$\begingroup$

Multivariate parameters appear to present a jagged appearance of integrands (using default Runge-Kutta ODE integration intervals?) in ParametricPlot3D plotting on a single argument.

Higher Mesh.. ing to 200 improves sectors' jagging (large step secants appearing instead of tangent) somewhat, but still color from PlotStyle for lines does not come through, e.g., like in case of the straight computed helical lines shown. How to get PlotStyle line colors with smoother lines?

thmax=6Pi ;
EQU={SI'[th]==Sin[PH[th]],SI[0]==.123,
PH'[th]==Cos[th],PH[0]==-1.234,
Z'[th]==2 Cos[PH[th]]Cos[SI[th]],
R'[th]==3 Sin[PH[th]] Cos[SI[th]],
R[0]==1.321,Z[0]==0.};
NDSolve[EQU,{SI,PH,R,Z},
  {th,0,thmax}];
  {ph[u_],si[u_],
  r[u_],z[u_]}={PH[u],
  SI[u],R[u],Z[u]}/.First[%];
ParametricPlot[{z[th],r[th]},{th,0,thmax},
   AspectRatio->Automatic,PlotLabel->MERIDIAN_,PlotStyle->{Thick,Magenta}]
ParametricPlot3D[{r[th] Cos[th+t],z[th],r[th] Sin[th+t]},{t,0,2 Pi},    
   {th,0,thmax},PlotLabel->SURFACE_]
SpC1=ParametricPlot3D[{r[th] Cos[th],z[th],r[th] Sin[th]},{t,0,2 Pi},
   {th,0,thmax},PlotStyle->{Thick,Magenta},PlotLabel->SPACE_CURVE,Mesh->20];
SpC2=ParametricPlot3D[{2 Sin[th],th,1.8 Cos[th]},{th,0,thmax/3},
   PlotLabel->HELIX_,PlotStyle->{Thick,Magenta}];
Show[SpC1,SpC2]
$\endgroup$
  • $\begingroup$ Please format your code by selecting it and pressing the code button ({}) in the toolbar. Right now it is difficult to read. $\endgroup$ – Rahul Nov 8 '14 at 10:06
  • $\begingroup$ Thanks Rahulji, will format it hereafter. $\endgroup$ – Narasimham Nov 10 '14 at 8:41
5
$\begingroup$

Remove {t, 0, 2 Pi} from your SpC1 to get a 3D parametrized line

SpC1b = ParametricPlot3D[{r[th] Cos[th], z[th], r[th] Sin[th]}, {th, 0, thmax},
           PlotStyle -> {Thick, Magenta}, PlotLabel -> "SPACE_CURVE"];
Show[SpC1b, SpC2]

enter image description here

Or, to get fancier,

Show[SpC1b /. {Magenta -> Orange, Line -> (Tube[#, .1] &)},
 SpC2 /. Line -> (Tube[#, .1] &), Background -> Black, Boxed -> False, Lighting -> "Neutral"]

enter image description here

and, increasing thmax to 36 Pi,

enter image description here

Note: As is, your code for SpC1produces a 3D surface parametrized by t and th. That is, it produces polygons. So, you can change the setting for PlotStyle in your code to PlotStyle -> EdgeForm[{Thick, Magenta}] to make the polygons "look like" a Magenta-colored line. However, this approach is both unnecessary and slow because of the number of polygons produced: In your original version with Mesh->20 it produces

Total@Cases[SpC1[[1]], Polygon[x_] :> Length[x], {0, Infinity}]
(* 10 471 *)

of them. Changing to Mesh->200 produces 90 643 polygons; and using the options settings Mesh -> 100, PlotPoints -> 200, MaxRecursion -> 1 produces 485 208 tiny polygons. Since each polygon is small, together they appear as a Line.

$\endgroup$
  • $\begingroup$ I like the like the fancy Part, +1. $\endgroup$ – user9660 Nov 8 '14 at 17:45
2
$\begingroup$

I´m not quite sure whether I understood your problem right, but I increased the Mesh, set the PlotPoints higher (I just choose a higher number) and MaxRecursion to 1, i.e.:

SpC1 = ParametricPlot3D[{r[th] Cos[th], z[th], r[th] Sin[th]}, {t, 0, 
   2 Pi}, {th, 0, thmax}, PlotStyle -> {Thick, Magenta}, 
  PlotLabel -> SPACE_CURVE, Mesh -> 100, PlotPoints -> 200, 
  MaxRecursion -> 1]

and

SpC2 = ParametricPlot3D[{2 Sin[th], th, 1.8 Cos[th]}, {th, 0, 
   thmax/3}, PlotLabel -> HELIX_, PlotStyle -> {Thick, Magenta}, 
  PlotPoints -> 200, MaxRecursion -> 1]

the result was than quite different

new picture

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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