drawing curves, i.e. collections of points, on a canvas in a tools tab
A point is defined by its coordinates (x, y and z), and the color assigned to
it (r, g, and b). A few constructors for points is given, for example
make_color_point. Selectors allow access to the coordinates and color
components, for example x_of.
A curve is a
unary function which takes a number argument within the unit interval [0,1]
and returns a point. If C is a curve, then the starting point of the curve
is always C(0), and the ending point is always C(1).
A curve transformation is a function that takes a curve as argument and
returns a curve. Examples of curve transformations are scale and translate.
A curve drawer is function that takes a number argument and returns
a function that takes a curve as argument and visualises it in the output screen is
shown in the Source Academy in the tab with the "Curves Canvas" icon (image).
The following example uses
the curve drawer draw_connected_full_view to display a curve called
unit_circle.
drawing curves, i.e. collections of points, on a canvas in a tools tab
A point is defined by its coordinates (x, y and z), and the color assigned to it (r, g, and b). A few constructors for points is given, for example
make_color_point
. Selectors allow access to the coordinates and color components, for examplex_of
.A curve is a unary function which takes a number argument within the unit interval
[0,1]
and returns a point. IfC
is a curve, then the starting point of the curve is alwaysC(0)
, and the ending point is alwaysC(1)
.A curve transformation is a function that takes a curve as argument and returns a curve. Examples of curve transformations are
scale
andtranslate
.A curve drawer is function that takes a number argument and returns a function that takes a curve as argument and visualises it in the output screen is shown in the Source Academy in the tab with the "Curves Canvas" icon (image). The following example uses the curve drawer
draw_connected_full_view
to display a curve calledunit_circle
.draws a full circle in the display tab.
Author
Lee Zheng Han
Author
Ng Yong Xiang