Skip to content
ExamplesOpen editor ↗

bayaSekhutloSaMola

Sets a vector’s heading.

bayaSekhutloSaMola(mola, sekhutlo)

Mutates and returns the vector while preserving magnitude. Use a 2D vector with z equal to 0. A vector from bopaMola follows seeloSaSekhutlo; vectors from molaWaSekhutlo and molaOpe use radians.

NameTypeDescription
molamolaThe first vector.
sekhutlopaloThe new heading.
Sets a vector’s heading
tiro setaLoeto() {
  thalaKanefase(320, 220);
  bokamorago(235);
  diri a = bopaMola(3, 4);
  diri b = bopaMola(5, 1);
  diri sephetho = bayaSekhutloSaMola(a, PI / 4);
  atisaMola(sephetho, 20);
  thalaMothalo(90, 60, 90 + sephetho.x, 60 + sephetho.y);
  emisaPoapoeletso();
}

bopaMola, kopololaMola