-
Notifications
You must be signed in to change notification settings - Fork 22
/
acceleration.go
38 lines (31 loc) · 1.28 KB
/
acceleration.go
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
package unit
// Acceleration represents a SI unit of acceleration (in meter per second squared, m/s²)
type Acceleration Unit
// ...
const (
CentimeterPerSecondSquared = MeterPerSecondSquared * 1e-2 // SI
MeterPerSecondSquared Acceleration = 1e0 // SI
FootPerSecondSquared = MeterPerSecondSquared * 0.304800 // US
StandardGravity = MeterPerSecondSquared * 9.80665 // space
Gal = CentimeterPerSecondSquared // alias
)
// CentimetersPerSecondSquared returns the acceleration in cm/s²
func (a Acceleration) CentimetersPerSecondSquared() float64 {
return float64(a / CentimeterPerSecondSquared)
}
// MetersPerSecondSquared returns the acceleration in m/s²
func (a Acceleration) MetersPerSecondSquared() float64 {
return float64(a / MeterPerSecondSquared)
}
// FeetPerSecondSquared returns the acceleration in ft/s²
func (a Acceleration) FeetPerSecondSquared() float64 {
return float64(a / FootPerSecondSquared)
}
// StandardGravity returns the acceleration in ɡ₀
func (a Acceleration) StandardGravity() float64 {
return float64(a / StandardGravity)
}
// Gals returns the acceleration in Gal
func (a Acceleration) Gals() float64 {
return float64(a / Gal)
}