Skip to content

BEZIER ​

Draws a Bézier curve with multiple points and several Bézier segments.

Syntax ​

Syntax with a fixed amount of points:

leo-grammar
BEZIER intValue
    [ x1:measureValue ] [ y1:measureValue ]
    [ x2:measureValue ] [ y2:measureValue ]
    ...
    [ xn:measureValue ] [ yn:measureValue ] .

Syntax using an array of points:

leo-grammar
BEZIER arrayValue .

Parameters ​

Parameters for fixed amount of points:

  • <main-parameter> (intValue) - Used in the fixed amount of points version to specify the amount of points.
  • x<intValue> (measureValue, optional) - The x-coordinate of the n-th point where n-th is specified through <intValue>. The default is 0cm.
  • y<intValue> (measureValue, optional) - The y-coordinate of the n-th point where n-th is specified through <intValue>. The default is 0cm.

Parameters for array of points:

  • <main-parameter> (arrayValue) - Used in the array version to specify the points. The array must have an even amount of measure values.

Details ​

The style of this command is defined by the PEN command.

The Bézier curve is drawn with n points or k Bezier segments. The amount of points must be at least 4 and must be equal to 1 plus a multiple of 3 (4, 7, 10, 13 etc.). The amount of segments is (n-1) / 3 (1, 2, 3, 4 etc.). The drawn curve goes through the points 1, 4, 7, 10, and so on. The others are control points which pull the curve into their directions.

See Also ​

Examples ​

Draw an asymmetric wavy line.
A wavy line

leo
GRAPHREP
SHADOW off

BEZIER 4
    x1:-1cm y1:0cm x2:-0.25cm y2:-1cm
    x3:0.5cm y3:2.5cm x4:1cm y4:0cm

Draw an asymmetric wavy line using the points from an array.
A wavy line

leo
GRAPHREP
SHADOW off

BEZIER {-1cm, 0cm, -0.25cm, -1cm, 0.5cm, 2.5cm, 1cm, 0cm}

Draw an asymmetric wavy line and visualize the "virtual" points which pull the curve.
A wavy line and a polyline visualizing the "virtual" points

leo
GRAPHREP
SHADOW off

# Draw the "virtual" points which are used for the Bezier curve.
# Curve goes through 1st and 4th, 2nd and 3rd pull the curve.
PEN color:"gray"
POLYLINE 4
    x1:-1cm y1:0cm x2:-0.25cm y2:-1cm
    x3:0.5cm y3:2.5cm x4:1cm y4:0cm

# Draw the Bezier curve.
PEN
BEZIER 4
    x1:-1cm y1:0cm x2:-0.25cm y2:-1cm
    x3:0.5cm y3:2.5cm x4:1cm y4:0cm

Draw an icon consisting of a blue circle with three wavy lines inside of it resembling something like water waves.
A blue circle with three white wavy lines inside of it

leo
GRAPHREP
SHADOW off

PEN color:"$115599" w:0.2cm
FILL color:"$5599dd"
ELLIPSE rx:1.5cm ry:1.5cm

PEN color:"white" w:0.2cm
# Using a loop to draw the three wavy lines instead of specifying each separately.
FOR nI from:0 to:2 {
  SET dY:(-0.5cm + (nI * 0.5cm))
  BEZIER 4
      x1:-1cm y1:(dY) x2:-0.25cm y2:(dY - 1cm)
      x3:0.25cm y3:(dY + 1cm) x4:1cm y4:(dY)
}

Versions and Changes ​

Available since ADOxx 1.3