Skip to content
ExamplesOpen editor ↗

asin

→ asin()

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

asin(boleng)

Where sin gives you a number from an angle, asin gives you an angle from a number.

It needs a number between -1 and 1 — those are the only ones sin can return. Give it anything else and you get NaN.

By default the result lies between -SEPHATLO_PI (about -1.57) and SEPHATLO_PI (about 1.57). With seeloSaSekhutlo(DEGREES) set, between -90 and 90.

The name is left as it stands. The “a-” before “sin” is mathematical notation meaning “the angle whose sine is…”. See sin.

NameTypeDescription
bolengpaloA number between -1 and 1.
From a height back to an angle
tiro setaLoeto() {
  thalaKanefase(400, 400);
  bokamorago(242);
  tlogelaMothalo();

  seeloSaSekhutlo(DEGREES);

  gopheta (diri i = 0; i <= 20; i = i + 1) {
    // Bogodimo bo tswa go -1 go ya go 1
    metlha bogodimo = lekanyetsa(i, 0, 20, -1, 1);

    // asin e re bolelela sekhutlo se se tlisitseng bogodimo joo
    metlha sekhutlo = asin(bogodimo);
    kwala(atametsa(sekhutlo));

    tlatsaMmala(lekanyetsa(sekhutlo, -90, 90, 70, 240), 150, 210);
    thalaSediko(40 + i * 16, 200 - bogodimo * 130, 16);
  }
}

sin, acos, atan, atan2, seeloSaSekhutlo