From: Bruce S. <bas...@un...> - 2002-07-17 04:47:17
|
Currently when an arrow head length is greater than half the total length of the arrow, the head length (and shaft and head widths) are scaled down proportionally, preserving the correct total length but shrinking the lateral dimensions so that the arrow still looks like a reasonable arrow. Two users have asked for an option on the arrow object to not scale down the widths of the arrow shaft and arrow head when the head size is larger than half the total length of the arrow. A possible interpretation of this request is that when the head length is greater than half the total length, the head length should be made to be half the total length, and the lateral dimensions not be affected. In the extreme case of arrows whose total length is very small compared to the widths, the object will look like a box with a plane attached at one end. For some purposes this may be preferable to the shrinking currently done by Visual. I append a little program which displays standard arrows (cyan) and new-style arrows (red). The new-style arrows are mocked up by using box and convex. The shortest new-style arrow looks a bit like a thumbtack. If people think this is a good option to have, it would be possible to add a "fixedwidth" attribute to arrow which would give this effect if set to true (1). Suggestions are also welcome for other possible rules for the fixedwidth case. Note that there does have to be a rule for shortening the head length when necessary, because it is not acceptable for the head length to be longer than the total length of the arrow. Bruce Sherwood from visual import * # Display standard cyan arrow's, whose shaft and head widths shrink # for short lengths, next to proposed red arrows with fixed widths. def newarrow(pos=(0,0,0), axis=(1,0,0), color=color.white, shaftwidth=0.1, headwidth=2.*0.1, headlength=3.*0.1): pos = vector(pos) axis = vector(axis) L = mag(axis) sl = L-headlength hl = headlength if headlength > 0.5*L: sl = hl = 0.5*L fr = frame(pos=pos) box (frame=fr, pos=vector(sl/2.,0,0), size=(sl, shaftwidth, shaftwidth), color=color) p = vector(L,0,0) dx = -hl dy = headwidth/2. convex(frame=fr, pos=[p, p+vector(dx,dy,dy), p+vector(dx,dy,-dy), p+vector(dx,-dy,-dy), p+vector(dx,-dy,dy)], color=color) fr.axis = axis for y in arange(1, 10, 1): newarrow(pos=(0,y-5,0), axis=(y/4.,0,0), headlength=1, headwidth=1, shaftwidth=0.4, color=color.red) arrow(pos=(-2.6,y-5,0), axis=(y/4.,0,0), headlength=1, headwidth=1, shaftwidth=0.4, color=color.cyan) |