On Tue, 25 Aug 2009 22:06:22 +1000 (EST)
"damien dunlop" <[email protected]> wrote:

| Thanks once again to Anthony. My previous example demonstrated a complete
| misunderstanding of  "ImageMagick: Convert, Edit, and Compose Images" in
| relation to aspects of the -draw option. ImagMagick is very
| powerful but the result is a bewildering array of commands and options,
| beyond the range of normal mortal's time and effort.
| 
| So I revise the`vanilla' version of creating and using
| a standard arrow head:
| 
| # Locate the arrow head at 0,0, draw the standard, rotate it,
| # shift it to where it is required and scale it to the size required.
| # Here the arrow tail is incorporated in the head so that
| # both are rotated and scaled together. Performing this individually
| # requires a complete extra option or finding the slide rule
| # to calculate the coordinates for arbitrary angles (eg 37 deg).
| 
| points="0,150 0,100 41,100 0,0 -41,100 0,100"
| 
| convert -size 300x300 xc:skyblue \
|         -draw "translate 50,100 rotate -45 scale 0.15,0.15 polyline
| $points" \
|         show:
| 
| For this particular case, I fail to see that the SVG version is superior.
| 
| > Of course the above [see previous post] is now being added to the
| > Draw Symbols section of IM Examples  (give it a few hours)
| 
| When you do this Anthony, please incorporate the tail in at least one
| example so that duplicate commands and slide rule calculations will not be
| required.
| 
I can see three basic uses of arrows.

  1/ Measurement Arrows.  These would have no tail, and the 0,0 point
     is the point of the arrow.  This is what I demonstrated, probably
     due to my engineering background where such diagrams are common.

     See my current examples at
        http://www.imagemagick.org/Usage/draw/#arrow

  2/ Vectors, showing direction and intensity of some value.
     For example in a weather wind chart. A tail is required and the
     0,0 point is the end of the tail.  Often a large grid of such
     vectors is created.

     This appears what you are wanting

  3/ Indicators, that point out some detail.  For this the 0,0
     point probably should be either the tip, or some distance in front
     of the arrow itself.


You appear to be wanting vectors, and not measurement arrows, whcih is 

Vectors are tricky as they may be any length.  But you don't want to simply 
define them as a single unit and scale it to the right length as that will 
also scale the arrow head, and line thickness.

The solution is to draw the vectors length as a horizontal line of the right 
length in a rotated space.  When that line is in place, translate the drawing
space again to the end of the line, but leave the rotation in place.  You can
now draw the 'arrow' of the vector as normal.

  arrow_head="path 'M 0,0  l -15,-5  +5,+5  -5,+5  +15,-5 z'"

  convert -size 100x100 xc: \
          -draw "stroke black fill none
                 translate 90,10  rotate 85
                 line 0,0  60,0
                 translate 60,0
                 stroke blue fill skyblue
                 $arrow_head
                " \
          show:

This draws a 60 pixel length line at 85 degree angle, then adds a arrow
head.

the example has been added, with the third type of arrow.  It should
appear in an hour or so.



NOTE SVG is basically very simpler to the MVG language I have been
using above.  In fact Im has an internal convertor for SVG to MVG!

SVG could generate the same things, but just does so with far more
complexity and probably more calculations.  I would not completely
rule it out, as SVG is a good way of saving vector images so they
can be 'drawn' at any scale.

MVG is only a internal IM vector format.



  Anthony Thyssen ( System Programmer )    <[email protected]>
 -----------------------------------------------------------------------------
    If it is not one thing, it is another.   It is always something.
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to