fix typo in comment

This commit is contained in:
Yongwei Xing 2021-06-22 10:11:40 +08:00
parent 2d2721379b
commit b3ee1f8c84
2 changed files with 6 additions and 3 deletions

View file

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

View file

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