From b3ee1f8c8420751b5384f08d0c5289c81a613e86 Mon Sep 17 00:00:00 2001 From: Yongwei Xing Date: Tue, 22 Jun 2021 10:11:40 +0800 Subject: [PATCH] fix typo in comment --- common/perlinnoise.go | 6 +++--- common/utils.go | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/perlinnoise.go b/common/perlinnoise.go index 7ef7725..db5a9c3 100644 --- a/common/perlinnoise.go +++ b/common/perlinnoise.go @@ -15,7 +15,7 @@ const ( perlinAmpFalloff = 0.5 ) -// PerlinNoise is a perline noise struct to generate perlin noise. +// PerlinNoise is a perlin noise struct to generate perlin noise. type PerlinNoise struct { perlin []float64 } @@ -36,12 +36,12 @@ func (p *PerlinNoise) Noise1D(x float64) float64 { return p.noise(x, 0, 0) } -// Noise1D returns a float noise number on two dimensions. +// Noise2D returns a float noise number on two dimensions. func (p *PerlinNoise) Noise2D(x, y float64) float64 { return p.noise(x, y, 0) } -// Noise1D returns a float noise number on three dimensions. +// Noise3D returns a float noise number on three dimensions. func (p *PerlinNoise) Noise3D(x, y, z float64) float64 { return p.noise(x, y, z) } diff --git a/common/utils.go b/common/utils.go index ebe524e..599b425 100644 --- a/common/utils.go +++ b/common/utils.go @@ -81,6 +81,7 @@ func (hs HSV) ToRGB(mh, ms, mv int) color.RGBA { return rgb } +// ConvertCartesianToPixel converts cartesian coordinates to actual pixels in an image. func ConvertCartesianToPixel(x, y, xaixs, yaixs float64, h, w int) (int, int) { xr, yr := x/xaixs, y/yaixs var i, j int @@ -95,6 +96,7 @@ func ConvertCartesianToPolarPixel(x, y, xaixs, yaixs float64, h, w int) (int, in return ConvertPolarToPixel(r, theta, xaixs, yaixs, h, w) } +// ConvertCartesianToPolar converts points from cartesian coordinates to polar coordinates. func ConvertCartesianToPolar(x, y float64) (float64, float64) { r := math.Sqrt(x*x + y*y) theta := math.Atanh(y / x) @@ -102,6 +104,7 @@ func ConvertCartesianToPolar(x, y float64) (float64, float64) { return r, theta } +// ConvertPolarToPixel converts polar coordinates to actual pixels in an image. func ConvertPolarToPixel(r, theta, xaixs, yaixs float64, h, w int) (int, int) { x, y := r*math.Cos(theta), r*math.Sin(theta)