Skip to content
ExamplesOpen editor ↗

thibelaMola

Caps a vector’s magnitude.

thibelaMola(mola, molelwane)

Shortens a vector only when its magnitude exceeds the maximum, keeping its direction. Shorter vectors stay unchanged. The maximum must be nonnegative. Mutates and returns the first vector.

NameTypeDescription
molamolaThe vector to change.
molelwanepaloA nonnegative magnitude.
Caps a vector’s magnitude
tiro setaLoeto() {
  thalaKanefase(320, 220);
  bokamorago(235);
  diri lebelo = bopaMola(150, 90);
  thibelaMola(lebelo, 90);
  thalaMothalo(40, 40, 40 + lebelo.x, 40 + lebelo.y);
  thalaSediko(40 + lebelo.x, 40 + lebelo.y, 12);
  emisaPoapoeletso();
}

boleeleJwaMola, atisaMola