Skip to content
ExamplesOpen editor ↗

magarengKonego

→ splinePoint()

Returns one coordinate of a point along a smooth curve.

magarengKonego(a, b, c, d, t)

magarengKonego(a, b, c, d, t) does what magarengBezier does, but for a thalaKonego curve. It works one axis at a time, so you call it twice — once with the x coordinates, once with the y.

⚠ t = 0 is not the first point. This is the one that catches people: t runs from the second point to the third, not from the first to the fourth. Measured: magarengKonego(5, 73, 73, 15, 0) returns 73 — the second point — and magarengKonego(5, 73, 73, 15, 1) returns 73 as well, the third. The first and last points only steer.

⚠ It does not clamp t, like magarengBezier.

Tightness affects it. Change seeloSaKonego('tightness', ...) and the numbers magarengKonego returns change with it.

NameTypeDescription
apaloCoordinate of the first point.
bpaloCoordinate of the second point — this is where t = 0 is.
cpaloCoordinate of the third point — this is where t = 1 is.
dpaloCoordinate of the fourth point.
tpaloHow far along you are between the second and third points.
The part of the curve that is drawn
tiro setaLoeto() {
  thalaKanefase(400, 240);
  bokamorago(245);

  metlha ax = 40;
  metlha ay = 200;
  metlha bx = 120;
  metlha by = 60;
  metlha cx = 280;
  metlha cy = 190;
  metlha dx = 360;
  metlha dy = 60;

  tlogelaGoTlatsa();
  mothaloMmala(200);
  boketeMothalo(2);
  thalaKonego(ax, ay, bx, by, cx, cy, dx, dy);

  // Dintlha tse 21 magareng ga ntlha ya bobedi le ya boraro
  tlogelaMothalo();
  tlatsaMmala(220, 70, 90);
  gopheta (diri i = 0; i <= 20; i = i + 1) {
    metlha t = i / 20;
    thalaSediko(magarengKonego(ax, bx, cx, dx, t), magarengKonego(ay, by, cy, dy, t), 8);
  }

  tlhalosa('Konego e e bofefo e e menaganeng, le didiko tse dinnye tse dikhibidu tse di tshotseng fela karolo ya gare ya yona.');
}

thalaKonego, mothalokgomiKonego, magarengBezier, seeloSaKonego