automated snapshot
This commit is contained in:
@@ -9,11 +9,13 @@ type Signal interface {
|
||||
}
|
||||
|
||||
type Const struct{ V float64 }
|
||||
|
||||
func (s Const) Eval(t float64) float64 { return s.V }
|
||||
|
||||
type Sine struct {
|
||||
Amp, Freq, Phase, Bias float64
|
||||
}
|
||||
|
||||
func (s Sine) Eval(t float64) float64 {
|
||||
return s.Bias + s.Amp*math.Sin(2*math.Pi*s.Freq*t+s.Phase)
|
||||
}
|
||||
@@ -21,8 +23,8 @@ func (s Sine) Eval(t float64) float64 {
|
||||
type Saw struct {
|
||||
Min, Max, Period float64
|
||||
}
|
||||
|
||||
func (s Saw) Eval(t float64) float64 {
|
||||
u := math.Mod(t, s.Period) / s.Period // 0..1
|
||||
return s.Min + (s.Max-s.Min)*u
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user