Re: 3D Arrows
- To: mathgroup at smc.vnet.net
- Subject: [mg88255] Re: 3D Arrows
- From: "peter.steneteg at gmail.com" <peter.steneteg at gmail.com>
- Date: Wed, 30 Apr 2008 04:21:55 -0400 (EDT)
- References: <fus8fk$842$1@smc.vnet.net>
On 25 Apr, 11:32, "Robert M. Lurie" <RMLU... at ALUM.MIT.EDU> wrote:
> Apparently Arrows is only a 2D graphic. Is there a way to make an arrow
> in 3D?
> Robert M Lurie
Wanted the same thing, made a quick implementation...
Between[a_, b_, x_] := b - (b - a)/Norm[b - a]*x;
Cone3D[s_, e_, w_] := Module[{v, b, b1, b2, A, r},
v = e - s;
A = RotationMatrix[\[Pi]/10, v];
b = {v[[2]], -v[[1]], 0};
b = b/Norm[b]*w;
r = {};
For[i = 0, i < 20, i++,
b1 = RotationMatrix[i*\[Pi]/10, v].b;
b2 = RotationMatrix[(i + 1)*\[Pi]/10, v].b;
AppendTo[r, Polygon[{e, s + b1, s + b2}]];
AppendTo[r, Polygon[{s, s + b1, s + b2}]];
];
r
];
Arrow3D[s_, e_, cw_, aw_, al_] := Module[{m},
m = Between[s, e, al];
{Cylinder[{s, m}, cw], Cone3D[m, e, aw]}
];
Graphics3D[{EdgeForm[], Arrow3D[{2, 0, 0}, {0, 0, 0}, 0.1, 0.3, 0.4]}]