Skip to content
ExamplesOpen editor ↗

mothalokgomiKonego

→ splineTangent()

Returns one coordinate on the line that touches a smooth curve.

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

mothalokgomiKonego(a, b, c, d, t) does what mothalokgomiBezier does, for a thalaKonego curve. It returns the direction the curve is running at that place, one axis at a time.

⚠ Like magarengKonego, t runs from the second point to the third — not from the first to the fourth.

It is useful when you want to turn something to face the way the curve is going — an aeroplane, a fly, or an arrowhead.

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.
An arrowhead facing the way the curve goes
tiro setaLoeto() {
  thalaKanefase(400, 240);
  bokamorago(245);

  metlha ax = 30;
  metlha ay = 190;
  metlha bx = 110;
  metlha by = 60;
  metlha cx = 290;
  metlha cy = 180;
  metlha dx = 370;
  metlha dy = 50;

  tlogelaGoTlatsa();
  mothaloMmala(60, 140, 110);
  boketeMothalo(3);
  thalaKonego(ax, ay, bx, by, cx, cy, dx, dy);

  tlogelaMothalo();
  tlatsaMmala(220, 70, 90);
  gopheta (diri i = 0; i <= 6; i = i + 1) {
    metlha t = i / 6;
    metlha x = magarengKonego(ax, bx, cx, dx, t);
    metlha y = magarengKonego(ay, by, cy, dy, t);
    metlha tx = mothalokgomiKonego(ax, bx, cx, dx, t);
    metlha ty = mothalokgomiKonego(ay, by, cy, dy, t);

    baya();
    sutisa(x, y);
    dikolosa(atan2(ty, tx));
    thalaKhutlotharo(-6, -5, -6, 5, 8, 0);
    tsaya();
  }

  tlhalosa('Konego e talatala e e menaganeng, le dikhutlotharo tse dinnye tse dikhibidu tse supang kwa konego e yang teng mo mafelong a le supa.');
}

thalaKonego, magarengKonego, mothalokgomiBezier, atan2