/
velocity_generated.go
116 lines (95 loc) · 3.92 KB
/
velocity_generated.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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// This code is generated by units-codegen; do not manualy edit this file.
package linear
import (
"time"
)
// Units for Velocity values. Always multiply with a unit when setting the initial value like you would for
// time.Time. This prevents you from having to worry about the internal storage format.
const (
Knot Velocity = Velocity(NauticalMile) / Velocity(time.Hour)
NanometerPerSecond Velocity = Velocity(Nanometer) / Velocity(time.Second)
MicrometerPerSecond Velocity = Velocity(Micrometer) / Velocity(time.Second)
MillimeterPerSecond Velocity = Velocity(Millimeter) / Velocity(time.Second)
CentimeterPerSecond Velocity = Velocity(Centimeter) / Velocity(time.Second)
DecimeterPerSecond Velocity = Velocity(Decimeter) / Velocity(time.Second)
MeterPerSecond Velocity = Velocity(Meter) / Velocity(time.Second)
KilometerPerSecond Velocity = Velocity(Kilometer) / Velocity(time.Second)
FootPerSecond Velocity = Velocity(Foot) / Velocity(time.Second)
KilometerPerHour Velocity = Velocity(Kilometer) / Velocity(time.Hour)
MilePerHour Velocity = Velocity(Mile) / Velocity(time.Hour)
)
// Knots returns v as a floating point number of knots.
func (v Velocity) Knots() float64 {
return float64(v / Knot)
}
// NanometersPerSecond returns v as a floating point number of nanometerspersecond.
func (v Velocity) NanometersPerSecond() float64 {
return float64(v / NanometerPerSecond)
}
// MicrometersPerSecond returns v as a floating point number of micrometerspersecond.
func (v Velocity) MicrometersPerSecond() float64 {
return float64(v / MicrometerPerSecond)
}
// MillimetersPerSecond returns v as a floating point number of millimeterspersecond.
func (v Velocity) MillimetersPerSecond() float64 {
return float64(v / MillimeterPerSecond)
}
// CentimetersPerSecond returns v as a floating point number of centimeterspersecond.
func (v Velocity) CentimetersPerSecond() float64 {
return float64(v / CentimeterPerSecond)
}
// DecimetersPerSecond returns v as a floating point number of decimeterspersecond.
func (v Velocity) DecimetersPerSecond() float64 {
return float64(v / DecimeterPerSecond)
}
// MetersPerSecond returns v as a floating point number of meterspersecond.
func (v Velocity) MetersPerSecond() float64 {
return float64(v / MeterPerSecond)
}
// KilometersPerSecond returns v as a floating point number of kilometerspersecond.
func (v Velocity) KilometersPerSecond() float64 {
return float64(v / KilometerPerSecond)
}
// FeetPerSecond returns v as a floating point number of feetpersecond.
func (v Velocity) FeetPerSecond() float64 {
return float64(v / FootPerSecond)
}
// KilometersPerHour returns v as a floating point number of kilometersperhour.
func (v Velocity) KilometersPerHour() float64 {
return float64(v / KilometerPerHour)
}
// MilesPerHour returns v as a floating point number of milesperhour.
func (v Velocity) MilesPerHour() float64 {
return float64(v / MilePerHour)
}
// Abs returns the absolute value of v as a copy.
func (v Velocity) Abs() Velocity {
if v < 0 {
return -v
}
return v
}
// Mul returns the product of v * x as a new Velocity.
func (v Velocity) Mul(x float64) Velocity {
return v * Velocity(x)
}
// Div returns the quotient of v / x as a new Velocity.
func (v Velocity) Div(x float64) Velocity {
return v / Velocity(x)
}
// DivVelocity returns the quotient of v / x as a floating point number.
func (v Velocity) DivVelocity(x Velocity) float64 {
return float64(v / x)
}
// DivDuration returns the quotient of v / t as a Acceleration.
func (v Velocity) DivDuration(t time.Duration) Acceleration {
return Acceleration(float64(v) / float64(t))
}
// DivAcceleration returns the quotient of v / x as a time.Duration.
func (v Velocity) DivAcceleration(x Acceleration) time.Duration {
return time.Duration(float64(v) / float64(x))
}
// MulDuration returns the product of v * t as a Distance.
func (v Velocity) MulDuration(t time.Duration) Distance {
return Distance(float64(v) * float64(t))
}