Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.5K Views
|
1 Reply
|
1 Total Like
View groups...
Share
Share this post:

Plot a Tube around a circular arc

Posted 4 years ago

I want to plot a Tube around a circular arc.

Tube has the built in syntax that accepts a curve in 3D:

 Tube[curve,…] 

And Circle can plot a circular arc:

 Circle[{x,y},…,{θ1,θ2}] 
(* gives a circular or ellipse arc from angle θ1 to θ2. *)

But Circle is for 2D graphics, and Tube is for 3D.

Can I make use of both? Or am I missing a geometrical object that can solve the problem?

I came across this answer, that suggests using BSplineCurve:

BSplineCurve[Table[{Cos[x], Sin[x]}, {x, 0, Pi, Pi/10}]]

But I prefer an object that is built-in in the Wolfram language.

Any help would be appreciated.

POSTED BY: Ehud Behar
Posted 4 years ago

Hi Ehud,

I don't think there is a built-in function / primitive for a "3D circle". Apart from BSplineCurve, you can use the parametric form of a circle

plot = ParametricPlot3D[{Sin[u], Cos[u], 0}, {u, 0, 2 Pi}, 
         PlotRange -> All, 
         Axes -> False,
         Boxed -> False,
         PlotStyle -> Magenta];

and post-process to replace the Line segments with Tube

plot /. Line[points_, anything___] :> Tube[points, 0.1, anything]

Or use the parametric form of a torus

ParametricPlot3D[{(10 + Cos[\[Theta]]) Cos[x], (10 + Cos[\[Theta]]) Sin[x], Sin[\[Theta]]},
  {x, -Pi,  Pi}, {\[Theta], -Pi, Pi},
  Axes -> False, 
  Boxed -> False,
  Mesh -> None,
  PlotPoints -> 40,
  ColorFunction -> Hue]
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard