Re: Orientation of Arrowheads
- To: mathgroup at smc.vnet.net
- Subject: [mg108880] Re: Orientation of Arrowheads
- From: "David Park" <djmpark at comcast.net>
- Date: Mon, 5 Apr 2010 08:02:25 -0400 (EDT)
Roger, This kind of stuff is basically a mess because there is a lot of graphics level jumping, that is between graphics primitives and Graphics3D. It would make a lot more sense to me if PolyhedronData returned graphics primitives. In any case, the basic trick is: 1) Arrowhead works so that what points along the x-axis is rotated to point along the vector axis. (Help tells us that in MORE INFORMATION for Arrowheads.) 2) We have to undo this so we rotate the object such that what points along the vector axis is rotated to point along the x-axis. octo = PolyhedronData["Octahedron"] vector = {1, 1, 1}; octo2 = MapAt[Rotate[#, {vector, {1, 0, 0}}] &, octo, 1] Graphics3D[{Opacity[.75], Arrowheads[{{.06, 1, octo2}}], Arrow[Tube[{{0, 0, 0}, vector/Sqrt[3]}, .02]], Arrowheads[{{.01, 1, Graphics3D[Sphere[]]}}], Arrow[{{0, 0, 0}, {.577, .577, .1154}}], Polygon[{{0, 0, 0}, {0, 2, .2}, {2, 2, .4}, {2, 0, .2}}]}, PlotRange -> {{0, 2}, {0, 2}, {0, 2}}, Boxed -> True] David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: Roger Koenker [mailto:rkoenker at uiuc.edu] For a teaching demo, I'm trying to plot Arrowheads as Octahedrons, but --as documented-- Mathematica wants to orient the Arrowhead according to the orientation of the Arrow and I would like the Octahedron to be oriented "vertically". Here is my current version: << Graphics`polyhedra` octo = PolyhedronData["Octahedron"]; Graphics3D[{Opacity[.75], Arrowheads[{{.06, 1, octo}}], Arrow[Tube[{{0, 0, 0}, {1, 1, 1}/Sqrt[3]}, .02]], Arrowheads[{{.01, 1, Graphics3D[Sphere[]]}}], Arrow[{{0, 0, 0}, {.577, .577, .1154}}], Polygon[{{0, 0, 0}, {0, 2, .2}, {2, 2, .4}, {2, 0, .2}}]}, PlotRange -> {{0, 2}, {0, 2}, {0, 2}}, Boxed -> True] Any suggestions would be most welcome. url: www.econ.uiuc.edu/~roger Roger Koenker email rkoenker at uiuc.edu Department of Economics vox: 217-333-4558 University of Illinois fax: 217-244-6678 Urbana, IL 61801