tan
→ tan()Returns the tangent of an angle — `sin` divided by `cos`.
tan(sekhutlo)tan is not a calm wave like sin and cos. Its results run from very large numbers below 0 to very large numbers above 0, and repeat.
The reason is that tan is sin divided by cos. As cos approaches 0, the number grows alarmingly fast: tan(SEPHATLO_PI) does not become Infinity — it becomes a number around 16 000 000 000 000 000, because a computer cannot hold SEPHATLO_PI exactly.
In art that means tan wants thibela or palopotlana close by, or a shape will fly off the canvas.
tan is most used to work out the slope of a line: given an angle, tan tells you how far it rises for each step across.
The name is left as it stands — see sin.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
sekhutlo | palo | The angle, in radians by default, or in degrees when seeloSaSekhutlo(DEGREES) is set. |
Examples
Section titled “Examples”tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(20, 24, 34);
boketeMothalo(2);
seeloSaSekhutlo(DEGREES);
gopheta (diri sekhutlo = 5; sekhutlo < 86; sekhutlo = sekhutlo + 5) {
// tan e naya serepodi: go tlhatloga go le kae mo kgatong ya 150
metlha go_tlhatloga = thibela(tan(sekhutlo) * 150, 0, 360);
mothaloMmala(lekanyetsa(sekhutlo, 0, 90, 70, 250), 170, 230);
thalaMothalo(40, 380, 190, 380 - go_tlhatloga);
}
}