-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswoophysix.js
77 lines (77 loc) · 1.42 KB
/
swoophysix.js
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
class Swoophysix {
constructor(gravity=9.81) {
this.gravity = gravity
}
//heat conversion
convertFtoC(value){
return (value-32)*5/9;
}
convertCtoF(value){
return (value*9/5)+32;
}
convertCtoK(value){
return value+273.15;
}
convertKtoC(value){
return value-273.15;
}
convertFtoK(value){
return (value-32)*5/9+273.15
}
convertKtoF(value){
return (value-273.15)*9/5+32
}
//length conversion
convertMtoFT(value){
return value*3.28084;
}
convertFTtoM(value){
return value*(1/3.28084);
}
convertINtoCM(value){
return value*2.54;
}
convertCMtoIN(value){
return value/2.54;
}
convertMtoIN(value){
return value/0.0254;
}
convertINtoM(value){
return value*0.0254;
}
convertCMtoM(value){
return value/100;
}
convertMtoCM(value){
return value*100;
}
//physics calculation
force(mass,acceleration) {
return mass*acceleration;
}
pressure(force,area){
return force/area;
}
energy(mass,velocity){
return 0.5*mass*velocity**2;
}
momentum(mass,velocity){
return mass*velocity;
}
liquid_pressure(area,height,density){
return area*height*this.gravity*density;
}
friction(force,coeff){
return force*coeff;
}
acceleration(velocity,time){
return velocity*time;
}
potential_energy(mass,height){
return mass*this.gravity*height;
}
torque(radii,force){
return radii*force;
}
}