Skip to content
ExamplesOpen editor ↗

bayaBoleeleBongwe

Normalizes a vector to magnitude 1.

bayaBoleeleBongwe(mola)

Preserves direction and changes the magnitude to 1. A zero vector stays zero. Mutates and returns the first vector.

NameTypeDescription
molamolaThe vector to change.
Normalizes a vector to magnitude 1
tiro setaLoeto() {
  thalaKanefase(320, 220);
  bokamorago(235);
  diri lebelo = bopaMola(150, 90);
  bayaBoleeleBongwe(lebelo);
  atisaMola(lebelo, 90);
  thalaMothalo(40, 40, 40 + lebelo.x, 40 + lebelo.y);
  thalaSediko(40 + lebelo.x, 40 + lebelo.y, 12);
  emisaPoapoeletso();
}

boleeleJwaMola, atisaMola