-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathWind.go
64 lines (55 loc) · 1.79 KB
/
Wind.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
package externalballistics
import "github.com/gehtsoft-usa/go_ballisticcalc/bmath/unit"
//WindInfo structure keeps information about wind
type WindInfo struct {
untilDistance unit.Distance
velocity unit.Velocity
direction unit.Angular
}
//UntilDistance returns the distance from the shooter until which the wind blows
func (v WindInfo) UntilDistance() unit.Distance {
return v.untilDistance
}
//Velocity returns the wind velocity
func (v WindInfo) Velocity() unit.Velocity {
return v.velocity
}
//Direction returns the wind direction.
//
//0 degrees means wind blowing into the face
//90 degrees means wind blowing from the left
//-90 or 270 degrees means wind blowing from the right
//180 degrees means wind blowing from the back
func (v WindInfo) Direction() unit.Angular {
return v.direction
}
//CreateNoWind creates wind description with no wind
func CreateNoWind() []WindInfo {
return make([]WindInfo, 1)
}
//CreateOnlyWindInfo creates the wind information for the constant wind for the whole distance of the shot
func CreateOnlyWindInfo(windVelocity unit.Velocity, direction unit.Angular) []WindInfo {
w := WindInfo{
untilDistance: unit.MustCreateDistance(9999, unit.DistanceKilometer),
velocity: windVelocity,
direction: direction,
}
a := make([]WindInfo, 1)
a[0] = w
return a
}
//AddWindInfo creates description of one wind
func AddWindInfo(untilRange unit.Distance, windVelocity unit.Velocity, direction unit.Angular) WindInfo {
w := WindInfo{
untilDistance: untilRange,
velocity: windVelocity,
direction: direction,
}
return w
}
//CreateWindInfo creates a wind descriptor from multiple winds
//
//winds must be ordered from the closest to the muzzlepoint to the farest to the muzzlepoint
func CreateWindInfo(winds ...WindInfo) []WindInfo {
return winds
}