Reasonable
User: Why should I use Arrow3 when there are many other
solutions on the File Exchange, most notably Erik Johnson's Arrow.m?
Arrow3
Apologist: Arrow.m is an excellent tool for labeling
because it draws two-dimensional patches in a plane. Arrow3.m,
on the other hand, draws cones and spheres in 3-space. The
programmer says it draws an "astonishing" number of vectors with a
"bewildering" variety of colors in "practically no time at all," and
that
it "looks real pretty when you twirl 'em around."
Reasonable
User: That is not what I want to do.
Arrow3
Apologist:
Oh, OK. Sorry.
Reasonable
User:
I want to use Arrow3 to indicate the path of a
particle that moves along the helix in fig. 1.
|
t=0:pi/40:8*pi;
plot3(20*t,cos(t),sin(t))
axis([0,600,-1.5,1.5,-1.5,1.5])
grid on, view(35,40)
Arrow3
Apologist:
Well OK, but it's gonna mess up your plot because you didn't fix the
aspect
ratio.
|
t=0:pi/40:8*pi;
plot3(20*t,cos(t),sin(t))
axis([0,600,-1.5,1.5,-1.5,1.5])
grid on, view(35,40)
hold on
arrow3([0,0,0],[600,0,0],'',2,[],0)
hold off
Reasonable
User:
Fig. 2 does not look anything like fig. 1.
Arrow3
Apologist:
Sure it does ... sort of. Arrow3 is graphically similar to the
coneplot
function: only with a fixed aspect ratio can the
surfaces be properly rendered. Arrow3 overrides stretch-to-fill
behavior by setting DataAspectRatioMode, PlotBoxAspectRatioMode, and
CameraViewAngleMode to manual. You can restore stretch-to-fill
scaling with axis normal ,
but that will warp the surfaces. |
t=0:pi/40:8*pi;
plot3(20*t,cos(t),sin(t))
axis([0,600,-1.5,1.5,-1.5,1.5])
grid on, view(35,40)
hold on
arrow3([0,0,0],[600,0,0],'',2,[],0)
hold off
axis normal
Reasonable
User:
Now the arrowhead and origin marker are distorted.
Arrow3
Apologist:
Yep, they're squished. If you set
pbaspect
and change view , you can get a plot with a manual aspect
ratio that fills the plot box in much the same fashion as fig. 1. |
t=0:pi/40:8*pi;
plot3(20*t,cos(t),sin(t))
axis([0,600,-1.5,1.5,-1.5,1.5])
grid on, view(35,25)
hold on
pbaspect([1.8,1.4,1])
% similar results may be
obtained by using
% daspect([111,0.7,1])
arrow3([0,0,0],[600,0,0],'',1.25,[],0)
hold off
Reasonable
User: Why doesn't the
program accommodate stretch-to-fill
scaling automatically?
Arrow3
Apologist:
I asked the programmer, and he said that the stretch-to-fill thing is
"really hard" and "awfully
complicated." Personally, I think he just can't figure it out.
Reasonable
User:
Alright, but what I really wanted was low-impact coordinate axes with
dark blue little arrows at quarter pi increments along the helix.
Arrow3
Apologist:
Oh, OK. Sorry.
|
t=(0:pi/40:8*pi)';
u=cos(t); v=sin(t);
plot3(20*t,u,v)
axis([0,600,-1.5,1.5,-1.5,1.5])
grid on, view(35,25)
hold on
pbaspect([1.8,1.4,1])
arrow3(zeros(3),diag([500,1.5,1.5]),'l',0.7,[],0)
p=[20*t,u,v]; ndx=11:10:length(t);
p2=p(ndx,:); p1=p(ndx-3,:);
arrow3(p1,p2,'0_b',0.7)
hold off