-
Notifications
You must be signed in to change notification settings - Fork 0
/
Conversions.cs
44 lines (40 loc) · 871 Bytes
/
Conversions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//C# code
using System;
class Conversions
{
public class Ratios
{
///<summary>
///Converts degrees to radians
///</summary>
public ConvertToRadians(float degrees)
{
return degrees * Mathf.PI / 180;
}
///<summary>
///Converts radians to degrees
///</summary>
public ConvertRadiansToDegrees(float radians)
{
return radians * 180 / radians;
}
}
public class Proportions
{
///<summary>
///Finds the missing proportion when to ratios equal eachother
///Algebra:cross multiply and isolate x by itself by dividing by denom1 (basic algebra rules)
//Time Complexity O(n)
///<summary>
public Convert(num1,denom1,denom2)
{
return (num1 * denom2)/denom1;
}
//Math
//1/5 = x/20
//1*20 = 20
//5*x = 5x
//5x = 20
//20/5 = 4
}
}