File: handle_tubeplot.html

package info (click to toggle)
freemat 4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 174,756 kB
  • ctags: 67,023
  • sloc: cpp: 351,059; ansic: 255,892; sh: 40,590; makefile: 4,387; perl: 4,058; asm: 3,313; pascal: 2,718; fortran: 1,722; ada: 1,681; ml: 1,360; cs: 879; csh: 795; python: 430; sed: 162; lisp: 160; awk: 5
file content (85 lines) | stat: -rw-r--r-- 2,471 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<HTML>
<HEAD>
<TITLE>TUBEPLOT Creates a Tubeplot
</TITLE>
</HEAD>
<BODY>
<H2>TUBEPLOT Creates a Tubeplot
</H2>
<P>
Section: <A HREF=sec_handle.html> Handle-Based Graphics </A>
<H3>Usage</H3>
This <code>tubeplot</code> function is from the tubeplot package
written by Anders Sandberg. The simplest syntax for the
<code>tubeplot</code> routine is
<PRE>
    tubeplot(x,y,z)
</PRE>
<P>
plots the basic tube with radius 1, where <code>x,y,z</code> are
vectors that describe the tube.  If the radius of the
tube is to be varied, use the second form
<PRE>
    tubeplot(x,y,z,r) 
</PRE>
<P>
which plots the basic tube with variable radius r (either 
a vector or a scalar value).  The third form allows you
to specify the coloring using a vector of values:
<PRE>
    tubeplot(x,y,z,r,v)
</PRE>
<P>
where the coloring is now dependent on the values in the 
vector <code>v</code>.  If you want to create a tube plot with 
a greater degree of tangential subdivisions (i.e.,
the tube is more circular, use the form
<PRE>
    tubeplot(x,y,z,r,v,s)
</PRE>
<P>
where <code>s</code> is the number of tangential subdivisions (default is 6)
You can also use <code>tubeplot</code> to calculate matrices to feed to <code>mesh</code>
and <code>surf</code>.
<PRE>
    [X,Y,Z]=tubeplot(x,y,z)
</PRE>
<P>
returns <code>N x 3</code> matrices suitable for mesh or surf.

Note that the tube may pinch at points where the normal and binormal 
misbehaves. It is suitable for general space curves, not ones that 
contain straight sections. Normally the tube is calculated using the
Frenet frame, making the tube minimally twisted except at inflexion points.

To deal with this problem there is an alternative frame:
<PRE>
    tubeplot(x,y,z,r,v,s,vec)
</PRE>
<P>
calculates the tube by setting the normal to
the cross product of the tangent and the vector vec. If it is chosen so 
that it is always far from the tangent vector the frame will not twist unduly.
<H3>Example</H3>
Here is an example of a <code>tubeplot</code>.
<PRE>
--&gt; t=0:(2*pi/100):(2*pi);
--&gt; x=cos(t*2).*(2+sin(t*3)*.3);
--&gt; y=sin(t*2).*(2+sin(t*3)*.3);
--&gt; z=cos(t*3)*.3;
--&gt; tubeplot(x,y,z,0.14*sin(t*5)+.29,t,10);
</PRE>
<P>
<P>
<DIV ALIGN="CENTER">
<IMG SRC="tubeplot1.png">
</DIV>
<P>

 Written by Anders Sandberg, asa@nada.kth.se, 2005
 Website says the package is free for anybody to use.
 www.nada.kth.se/~asa/Ray/Tubeplot/tubeplot.html
</BODY>
</HTML>