// Draw the curve var G: tgpgraphics; P: tgppen; PTS: array [0 .. 4] of tgppoint; begin G: = tgpgraphics. create (canvas. handle); P: = tgppen. create (makecolor (255, 0, 0), 4); PTS [0]. x: = 11; PTS [0]. y: = 11; PTS [1]. x: = 66; PTS [1]. y: = 66; PTS [2]. x: = 88; PTS [2]. y: = 222; PTS [3]. x: = 111; PTS [3]. y: = 111; PTS [4]. x: = 222; PTS [4]. y: = 88; G. drawcurve (p, pgppoint (@ PTS), length (PTS); p. free; G. free; end;
// Specify the curvature var G: tgpgraphics; P: tgppen; PTS: array [0 .. 4] of tgppoint; begin G: = tgpgraphics. create (canvas. handle); P: = tgppen. create (makecolor (255, 0, 0), 4); PTS [0]. x: = 11; PTS [0]. y: = 11; PTS [1]. x: = 66; PTS [1]. y: = 66; PTS [2]. x: = 88; PTS [2]. y: = 222; PTS [3]. x: = 111; PTS [3]. y: = 111; PTS [4]. x: = 222; PTS [4]. y: = 88; G. drawcurve (p, pgppoint (@ PTS), length (PTS), 0.25); // specify the curvature to 0.25. The default value is 0.5 p. free; G. free; end;
// Plot the Curve Part var G: tgpgraphics; P: tgppen; PTS: array [0 .. 4] of tgppoint; begin G: = tgpgraphics. create (canvas. handle); P: = tgppen. create (makecolor (255, 0, 0), 4); PTS [0]. x: = 11; PTS [0]. y: = 11; PTS [1]. x: = 66; PTS [1]. y: = 66; PTS [2]. x: = 88; PTS [2]. y: = 222; PTS [3]. x: = 111; PTS [3]. y: = 111; PTS [4]. x: = 222; PTS [4]. y: = 88; G. drawcurve (p, pgppoint (@ PTS), length (PTS), 1, 2, 0); {parameter 3 specifies the number of points to start from; parameter 4 indicates the number of sections to be drawn; when parameter 5 is a curvature of 0, it becomes a continuous line} p. free; G. free; end;