2
$\begingroup$

How do I extract the tube style (including lighting, viewpoint, ...) from KnotData["Trefoil"]

trefoil knot

and apply it to a space curve, such as

ParametricPlot3D[{Cos[θ], Sin[θ], Cos[2 θ]}, {θ, 0, 2 π}] ?

$\endgroup$
4
$\begingroup$
Options@KnotData["Trefoil"]
(* {Boxed -> False, PlotRange -> {All, All, All}, 
 PlotRangePadding -> {Automatic, Automatic, Automatic}, 
 ViewPoint -> {0, 0.01, 5}} *)

You can see the ViewPoint above. Since the lighting is not mentioned, it has the default value.

Generally, for any Graphics3D, just paste it in the middle of an Options[...] or Options[..., ViewPoint].

$\endgroup$
4
$\begingroup$
thickness = 0.1;
ParametricPlot3D[{Cos[\[Theta]], Sin[\[Theta]], 
   Cos[2 \[Theta]]}, {\[Theta], 0, 2 \[Pi]},
  PlotPoints -> 360,
  PlotStyle -> White,
  PlotRangePadding -> 2 thickness] /. Line[x__] :> Tube[x, thickness]

enter image description here

The tubes are white, actually. The colors result from the defaults for the graphics option Lighting.

$\endgroup$
  • $\begingroup$ Great. But HOW did you extract the data? Just guess and check? $\endgroup$ – David G. Stork Nov 27 '17 at 23:00
  • $\begingroup$ Graphics3D objects can be inspected. The one created by KnotData["Trefoil"] just contains a GraphicsComplex and the standard color for a GraphicsComplex is White. That's about the color. ParametricPlot3D creates Graphics3D objects containing Line primitives (if you plot curves) and these can be changed into Tube primitives just as above. The thickness was a pure guess. $\endgroup$ – Henrik Schumacher Nov 27 '17 at 23:04
  • 1
    $\begingroup$ Note that PlotStyle -> {White, Tube[thickness]} may be used instead of post-processing the Line objects. $\endgroup$ – Michael E2 Nov 27 '17 at 23:31
  • $\begingroup$ @MichaelE2 Good to know! And it is rendered with VertexNormals! However, do you also see that the ends of the curve are visible this way? $\endgroup$ – Henrik Schumacher Nov 27 '17 at 23:38
  • $\begingroup$ @MichaelE2 I mean: Can something to be done about that? I wrote my own tubification function long time ago, but it would be nice to know if there is a built-in alternative. $\endgroup$ – Henrik Schumacher Nov 27 '17 at 23:45

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.