On this page:
30.1 Arrows
draw-arrow
9.0.0.1

30 Drawing Conveniences🔗ℹ

This section presents higher-level APIs that provide additional conveniences over the racket/draw API.

30.1 Arrows🔗ℹ

 (require racket/draw/arrow) package: draw-lib

procedure

(draw-arrow dc    
  start-x    
  start-y    
  end-x    
  end-y    
  dx    
  dy    
  [#:pen-width pen-width    
  #:arrow-head-size arrow-head-size    
  #:arrow-root-radius arrow-root-radius    
  #:%age %age]    
  #:bb bb)  void?
  dc : (is-a?/c dc<%>)
  start-x : real?
  start-y : real?
  end-x : real?
  end-y : real?
  dx : real?
  dy : real?
  pen-width : (or/c real? #f) = #f
  arrow-head-size : real? = 8
  arrow-root-radius : real? = 2.5
  %age : #f = (or/c #f "leftup" (real-in -1 1))
  bb : 
(or/c (list/c (or/c #f real?)
              (or/c #f real?)
              (or/c #f real?)
              (or/c #f real?))
      #f)
Draws an arrow on dc from (start-x, start-y) to (end-x, end-y). (dx, dy) is the top-left location for drawing. If pen-width is #f, the current pen width is used.

If %age is not #f, then the arrows are drawn with a curve. When %age is "leftup", then the arrows will curve leftwards and upwards from the end point to the start point. When %age is a number, the number controls the angle coming out of the starting point. If the number is negative, the arrows comes out to the left and if it is positive, it comes out to the right. The precise angle depends on the absolute value of the number. If the absolute value is close to 1, the angle is close to straight out to the sides. If the absolute value is close to 0, the angle is close to straight down or straight down.

When the arrow curves (because %age is not #f) and bb is not #f, it specifies a bounding box that can cause the arrow not to curve. Specifically, if the curve would go outside the bounding box, then the attempt to curve is abandoned, and a straight line is drawn.

Added in version 1.9 of package draw-lib.