| Contents | Index |
plot::Tube([x(t), y(t), z(t)], r(t), t = t_min..t_max) draws a tube around
with radius
.
Call:
plot::Tube([x, y, z], <r>, t =
..
, <a = amin .. amax>, Options)
Parameters:
|
x, y, z: |
the spine curve coordinates: real-valued expressions in t and the animation parameter. |
|
r: |
the tube radius: a real-valued expression in t and the animation parameter. Default is the constant |
|
t: |
the curve parameter: an (indexed) identifier. |
|
|
the range of the curve parameter: real-valued expressions in the animation parameter. |
See Also:
plot, plot::copy, plot::Curve3d, plot::Surface
Details:
plot::Tube creates generalized tubular plots, known as “canal surfaces”, with special cases known as “tube surface”, “pipe surface” or “tubular sufaces.”
Intuitively, canal surfaces are space curves with thickness. More formally, a canal surface plot::Tube([x(t), y(t), z(t)], r(t), t = t_min..t_max) is the envelope of spheres with center
and radius
, i.e., the thickness of the curve can vary with the curve parameter
.
Example 1
A torus can be drawn as a tube around a circle:
plot(plot::Tube([cos(t), sin(t), 0], 0.4,
t = 0..2*PI))

Varying the diameter of the tube, we deform the torus into a cyclide:
plot(plot::Tube([cos(t), sin(t), 0], 0.4 + 0.3*cos(t),
t = 0..2*PI))

Example 2
All surfaces of revolution are special cases of canal surfaces:
plot(plot::Scene3d(plot::XRotate(sin(u), u = 0..10)),
plot::Scene3d(plot::ZRotate(sin(u), u = 0..10)),
plot::Scene3d(plot::Tube([u, 0, 0], sin(u), u = 0..10)),
plot::Scene3d(plot::Tube([0, 0, sin(u)], u, u = 0..10)),
Width = 180 * unit::mm)

The last image shows that the defaults for the mesh are not always adequate and should be changed:
plot(plot::Tube([0, 0, sin(u)], u, u = 0..10,
Mesh = [20, 20]))

Example 3
The famous Klein bottle can be obtained from a “drop silhouette” by using an appropriate radius parametrization:
plot(plot::Tube([6*cos(u)*(sin(u) - 1), 0, 14*sin(u)],
4 - 2*cos(u), u = -PI..PI))

Example 4
Re-using the cyclide from above, we demonstrate coloring a canal surface:
color := (t, phi) -> RGB::fromHSV([(t+sin(4*phi))*180/PI, 1, 1]):
plot(plot::Tube([sin(t), cos(t), 0], 0.4 + 0.3*cos(t), t=0..2*PI,
FillColorFunction = color))

Example 5
Yet another variation of the cyclide, we use a non-constant AngleRange to “slice” it:
plot(plot::Tube([sin(t), cos(t), 0], 0.4 - 0.3*sin(t), t=0..2*PI,
AngleRange = 0 .. 2*PI*sin(abs(t-PI/2)/2)),
Axes = None, CameraDirection = [14, 1, 5])

Combining more than one tubular plot with identical spine curves but different angle ranges, we can achieve a braid-like effect:
braid := i ->
plot::Tube([sin(u), cos(u), 0], 0.2, u=0..2*PI,
AngleRange = i*PI/3 + 3*u .. i*PI/3 + 3*u + 1/2,
Color = RGB::EmeraldGreen, Mesh = [60, 2]):
torus := plot::Tube([sin(u), cos(u), 0], 0.18, u=0..2*PI,
Color = RGB::BlueLight,
Name = "Torus"):
plot(braid(i) $ i = 0..5,
torus,
ULinesVisible = FALSE, VLinesVisible = FALSE,
FillColorType = Flat,
Axes = None, CameraDirection = [0, 7, 10])

Example 6
The spine curve, the radius function, color functions etc. can be animated as usual:
plot(plot::Tube([sin(t)*sin(a), cos(t)*cos(a), sin(a)],
0.4 - 0.3*sin(t-a),
t = 0..2*PI, a = 0..2*PI,
Frames = 20, TimeRange = 0..5))


Example 7
Note that in the presence of a sharp bend (in relation to the tube diameter), the surface plotted my plot::Tube may self-intersect:
plot(plot::Tube([x, 0, x^2], 1.2, x = -1.4..1.4,
Mesh = [20, 10]),
Axes = None, CameraDirection = [-3, 1, 2])

This effect is unavoidable. Sharp bends also cause another effect which can be avoided by increasing the mesh density: The tube might not follow the curve quickly enough:
plot(plot::Tube([sin(x^2), x, 0], x = -5..0))

In this situation, you can set USubmesh to a positive value to request additional function evaluations:
plot(plot::Tube([sin(x^2), x, 0], x = -5..0, USubmesh = 5))


Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |