Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LazySmoothSurface ¶
type LazySmoothSurface struct { *geo.Surface // contains filtered or unexported fields }
LazySmoothSurface provides ValueAt and GradientAt function based on a surface vertically and horizontally smoothed using the given kernel. The values are smoothed on request and cached. Note that is takes 3x the memory, but using arrays vs maps with locking was 2x faster. Cache hit rate for a 100 iteration sample was 50% for the grid value and 99+% for the Intermediate vertical smoothing values.
func New ¶
func New(surface *geo.Surface, kernel []float64) *LazySmoothSurface
New creates a new smooth service using the kernel.
func (*LazySmoothSurface) GradientAt ¶
func (s *LazySmoothSurface) GradientAt(point *geo.Point) *geo.Point
GradientAt is the same as for a normal surface but with the smoothing kernel applied.
func (*LazySmoothSurface) SetKernel ¶
func (s *LazySmoothSurface) SetKernel(kernel []float64)
SetKernel allows the updating of the kernel used. The cache is cleared.
func (*LazySmoothSurface) SmoothedGrid ¶
func (s *LazySmoothSurface) SmoothedGrid(x, y int) float64
SmoothedGrid provides the same stuff as surface.Grid[x][y] but smoothed vertically and horizontally by the given kernel. Computed values are cached.
func (*LazySmoothSurface) ValueAt ¶
func (s *LazySmoothSurface) ValueAt(point *geo.Point) float64
ValueAt is the same as for a normal surface but with the smoothing kernel applied.