BEZIER_TO ​
Adds a Bézier curve with multiple points and several Bézier segments as part of the path.
Syntax ​
Syntax with a fixed amount of points:
BEZIER_TO intValue
[ x1:measureValue ] [ y1:measureValue ]
[ x2:measureValue ] [ y2:measureValue ]
...
[ xn:measureValue ] [ yn:measureValue ] .
Syntax using an array of points:
BEZIER_TO 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. Note that the first point is given by the previous point of the path, so the value must be a multiple of 3 (3, 6, 9, 12 etc.).x<intValue>
(measureValue, optional) - The x-coordinate of the n-th point where n-th is specified through<intValue>
. The default is0cm
.y<intValue>
(measureValue, optional) - The y-coordinate of the n-th point where n-th is specified through<intValue>
. The default is0cm
.
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 ​
When thinking of defining a path as "drawing with an invisible pen", then this command draws a Bézier curve starting from the last point of the path along the points specified.
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.). However, the first point for the Bézier curve is given by the last point of the path, so the number of points this command provides must be a multiple of 3 (3, 6, 9, 12 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.
The order in which the lines of a path are specified is relevant when the path is later used to draw a shape, as their order determines the filled areas when a path's lines intersect.
This command should only be used after a BEGIN_PATH
and before an END_PATH
command.
See Also ​
Examples ​
Draw an asymmetric wavy line.
GRAPHREP
SHADOW off
# Define the path.
BEGIN_PATH
MOVE_TO x:-1cm y:0cm
# The 1st point of the curve is specified by the previous MOVE_TO,
# so the following command only has to specify 3 points.
BEZIER_TO 3
x1:-0.25cm y1:-1cm x2:0.5cm y2:2.5cm x3:1cm y3:0cm
END_PATH
# Draw the path.
DRAW_PATH mode:stroke
Draw a blue document symbol with an exaggerated wavy line at the bottom using a dashed line ("fixed amount of points" version).
GRAPHREP
# Note: SHADOW is on by default.
# Define the path.
BEGIN_PATH
MOVE_TO x:-1cm y:-1cm
LINE_TO x:-1cm y:0cm
BEZIER_TO 3
x1:-0.25cm y1:-1cm x2:0.5cm y2:2.5cm x3:1cm y3:0cm
LINE_TO x:1cm y:-1cm
END_PATH
# Draw the path as a shape.
PEN style:dash
FILL color:"lightblue"
DRAW_PATH
Draw two vertical lines that are connected at the bottom with an exaggerated wavy line (array version).
GRAPHREP
# Note: SHADOW is on by default.
# Define the path.
BEGIN_PATH
MOVE_TO x:-1cm y:-1cm
LINE_TO x:-1cm y:0cm
BEZIER_TO 3
x1:-0.25cm y1:-1cm x2:0.5cm y2:2.5cm x3:1cm y3:0cm
LINE_TO x:1cm y:-1cm
END_PATH
# Draw the path only as an outline.
PEN w:3pt
DRAW_PATH mode:stroke
Draw a purple hour-glass shape and a lying hour-glass shape to the right of it. The order of the points influences which areas are filled as part of the shape.
GRAPHREP
SHADOW off
FILL color:"purple"
# Left hour-glass shape.
# 1st: top-left, 2nd: top-right, 3rd: bottom-left, 4th: bottom-right.
BEGIN_PATH
MOVE_TO x:-0.5cm y:-0.5cm
LINE_TO x:0.5cm y:-0.5cm
LINE_TO x:-0.5cm y:0.5cm
LINE_TO x:0.5cm y:0.5cm
END_PATH
DRAW_PATH
# Right hour-glass shape.
# A different order of the points causes different areas to be filled in.
# 1st: top-left, 2nd: bottom-left, 3rd: top-right, 4th: bottom-right.
BEGIN_PATH
MOVE_TO x:0.6cm y:-0.5cm
LINE_TO x:0.6cm y:0.5cm
LINE_TO x:1.6cm y:-0.5cm
LINE_TO x:1.6cm y:0.5cm
END_PATH
DRAW_PATH
Versions and Changes ​
Available since ADOxx 1.3