Forum

> > CS2D > Scripts > What is math.pi used for?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch What is math.pi used for?

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt What is math.pi used for?

The Dark Shadow
User Off Offline

Zitieren
us Hello guys again,
I came up with a math question, I would like to know everything about
math.pi
and how to use it in lua? Probably could some of you give me some examples of using it, please? As far as i know it has a fair connection with
math.rad
,
math.sin
,
math.cos
and
math.tan
.
1× editiert, zuletzt 22.03.20 20:04:46

alt Re: What is math.pi used for?

DC
Admin Off Offline

Zitieren
math.pi is basically a constant value. The value of pi (3.14159...)
https://en.wikipedia.org/wiki/Pi

It's required for all sorts of trigonometric calculations. Including sin/cos/tan which require an angle in radians in Lua. pi is equal to an angle of 180°. pi/2 is equal to 90° etc.

math.rad converts an angle in degrees to an angle in radians.
math.deg converts an angle in radians to an angle in degrees.

e.g.
math.sin(math.pi)

is equal to
math.sin(math.rad(180))


Also see http://lua-users.org/wiki/MathLibraryTutorial

Additional mathematical background information
https://math.libretexts.org/Bookshelves/Precalculus/Map%3A_Elementary_Trigonometry_(Corral)/04%3A_Radian_Measure/4.01%3A_Radians_and_Degrees
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht