Skip to content
ExamplesOpen editor ↗

seeloSaSekhutlo

→ angleMode()

Sets or reads the unit angles are measured in — `DEGREES` or `RADIANS`.

seeloSaSekhutlo(seelo)

An angle can be measured in degrees or in radians. One full turn is 360 degrees, and it is PEDI_PI radians (about 6.28). It is one angle, said two ways.

Bopa works in radians by default. That means sin(SEPHATLO_PI) is 1 — not sin(90).

seeloSaSekhutlo(DEGREES) switches to degrees. From then on sin(90) is 1, and every angle number — in sin, cos, tan, asin, acos, atan and atan2 — is read as degrees.

seeloSaSekhutlo() with nothing given changes nothing — it returns the unit currently in use.

Note that degrees and radians are not affected by the unit setting: degrees always converts from radians to degrees, and radians does the reverse.

The name joins seelo (unit, measure) with sekhutlo (angle).

NameTypeDescription
seelo (optional)mokwaloEither DEGREES or RADIANS. Left out, nothing is changed and the unit in use is returned instead.
One angle, two numbers
tiro setaLoeto() {
  thalaKanefase(400, 400);
  bokamorago(20, 24, 34);
  tlogelaMothalo();

  // Ka tlwaelo — diradiane. Kotara ya go dikologa ke SEPHATLO_PI.
  kwala(seeloSaSekhutlo());
  tlatsaMmala(90, 190, 235);
  thalaSediko(120, 200, 40 + sin(SEPHATLO_PI) * 60);

  // Ka dikirii — kotara ya go dikologa ke 90
  seeloSaSekhutlo(DEGREES);
  kwala(seeloSaSekhutlo());
  tlatsaMmala(245, 185, 75);
  thalaSediko(280, 200, 40 + sin(90) * 60);

  // Diko tse pedi di a lekana: sekhutlo ke se le sengwe
}
A circle drawn in degrees
tiro setaLoeto() {
  thalaKanefase(400, 400);
  bokamorago(243);
  tlogelaMothalo();

  // Ka dikirii, go dikologa go go feletseng ke 360 — go bonolo go bala
  seeloSaSekhutlo(DEGREES);

  gopheta (diri sekhutlo = 0; sekhutlo < 360; sekhutlo = sekhutlo + 12) {
    metlha x = 200 + cos(sekhutlo) * 130;
    metlha y = 200 + sin(sekhutlo) * 130;

    tlatsaMmala(lekanyetsa(sekhutlo, 0, 360, 60, 240), 120, 200);
    thalaSediko(x, y, 22);
  }
}

DEGREES, RADIANS, degrees, radians, sin, cos