-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstrip.go
56 lines (44 loc) · 920 Bytes
/
strip.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
package texture
import (
"image/color"
"math"
)
type Strip struct {
Name string
Src Field
Value float64
}
func NewStrip(src Field, y float64) *Strip {
return &Strip{"Strip", src, y}
}
func (s *Strip) Eval2(x, y float64) float64 {
return s.Src.Eval2(x, s.Value)
}
func (s *Strip) Eval(x float64) float64 {
return s.Src.Eval2(x, s.Value)
}
func (s *Strip) Lambda() float64 {
return math.MaxFloat64
}
type StripCF struct {
Name string
Src ColorField
Value float64
}
func NewStripCF(src ColorField, y float64) *StripCF {
return &StripCF{"StripCF", src, y}
}
func (s *StripCF) Eval2(x, y float64) color.Color {
return s.Src.Eval2(x, s.Value)
}
type StripVF struct {
Name string
Src VectorField
Value float64
}
func NewStripVF(src VectorField, y float64) *StripVF {
return &StripVF{"StripVF", src, y}
}
func (s *StripVF) Eval2(x, y float64) []float64 {
return s.Src.Eval2(x, s.Value)
}