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.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
mola | mola | The vector to change. |
molelwane | palo | A nonnegative magnitude. |
Examples
Section titled “Examples”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();
}