automated snapshot

This commit is contained in:
sumi
2025-12-16 17:45:21 -06:00
parent 73c0471d54
commit 5ad740b15f
5 changed files with 116 additions and 64 deletions

View File

@@ -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
}