What can number PI used for?

Hello!
So I am learning about, trigonometry, and radians and degrees, but, I was wondering what number PI could be used for? and how can I use it?

1 Like

To get the circumference of a circle, area of a circle / semi circle, rearrange to get the radius too, volume of cylindrical objects - uses are too many to be listed.

(post withdrawn by author, will be automatically deleted in 1 hour unless flagged)

How, it’s like the whole circumference of a circle?
And can you give me example of what can I use it for?

Pi which holds the value of 3.14159265359 can be used for circular functions, on roblox however, it’s most pratical use it transforming degrees into radians. (which is what the CFrame rotation matrix uses)

(θ*/180) * π

but I mean, we can use math.rad() for that? why would I use PI for transofrming degrees in radians if I have math.pi?

it’s the ratio of a circle’s circumference to its diameter, but what will concern you is its usage; which you shouldn’t force unless you fully understand what you’re doing with it, there’s often more than one way to accomplish something.

1 Like

It may be helpful to know that π is defined to be the ratio of a circle’s circumference to its diameter. That is, π = circumference / diameter - it doesn’t matter what size of circle you have, this ratio will always be the same for a perfect circle.

Now, in terms of trigonometry - radians are defined such that 2π radians is a full circle rotation. Degrees are defined such that 360 degrees is a full circle rotation. This means that you can translate between degrees and radians by using this ratio. Say you have an angle θ (spelled “theta” and pronounced “thay-ta”, a very common Greek symbol used for representing an angle) which is defined in radians. You could then convert that angle into degrees using the following formula: θ * (360 degrees / 2π radians). Similarly, if you had an angle φ (another common Greek symbol for angles, spelled “phi” and often pronounced “fy”) which is in degrees, you could convert it to radians using the formula φ * (2π radians / 360 degrees).

Keep in mind that in Roblox, you don’t have to memorize these formulas. Roblox provides two functions in the standard math library, math.deg and math.rad, which convert radians to degrees and degrees to radians, respectively. In other words, you could convert θ to degrees using math.deg(theta) and similarly you could convert φ to radians using math.rad(phi). Roblox also provides a wide breadth of trigonometric functions - e.g. math.sin, math.cos, math.tan, math.atan2, etc. It is important to know that each of these functions expects angles to be in radians, not degrees.

As you learn more trigonometry, you’ll learn that it is an incredibly powerful tool - especially in game development. Say, for instance, that you want to figure out the position of something given an angle and a distance. You can do this by using trigonometry and angles very easily. It’s a bit math heavy and I don’t think posting a lesson on sine, cosine, and tangent would be very useful in this thread, but it’s definitely a powerful tool. Despite having learned all of this several years ago, I still refer to “sohcahtoa” every time I’m doing any trigonometry - I highly recommend getting to know and understand this helpful mnemonic if you’re going to be learning trig :slight_smile:

It can be used to make custom animations. The Easing styles most likely use pi.

1 Like

@s1muIate Sure you aren’t confusing pi with huge? math.huge is what you use for “infinite” health, pi will set their health to 3.14 (pi is a mathematical constant).

@VegetationBush Easing styles actually use more than pi, depending on what they are. I’m not sure any of them even use pi because they’re mostly comprised of exponential functions (none are full-circle graphs). You can check out some of the equations here: Easing Functions Cheat Sheet