Skip to content
ExamplesOpen editor ↗

acos

→ acos()

Turns `cos` around: takes a number between -1 and 1 and returns an angle.

acos(boleng)

acos is cos turned around, just as asin turns sin around.

It needs a number between -1 and 1. By default the result lies between 0 and PI (about 3.14); with seeloSaSekhutlo(DEGREES) set, between 0 and 180.

Note the difference from asin: acos never returns a number below 0. acos(0) is SEPHATLO_PI, and acos(1) is 0.

The name is left as it stands — see sin.

NameTypeDescription
bolengpaloA number between -1 and 1.
An angle read back from a width
tiro setaLoeto() {
  thalaKanefase(400, 400);
  bokamorago(19, 23, 33);
  tlogelaGoTlatsa();
  boketeMothalo(2);

  seeloSaSekhutlo(DEGREES);

  gopheta (diri i = 0; i <= 18; i = i + 1) {
    metlha b = lekanyetsa(i, 0, 18, -1, 1);

    // acos e busa 0..180 — mothalo o retologa ka iketlo
    metlha sekhutlo = acos(b);

    mothaloMmala(lekanyetsa(sekhutlo, 0, 180, 240, 70), 170, 220);
    thalaMothalo(200, 200, 200 + cos(sekhutlo) * 160, 200 - sin(sekhutlo) * 160);
  }
}

cos, asin, atan, atan2, seeloSaSekhutlo