contourline: Make line size configurable

This commit is contained in:
Cat /dev/Nulo 2022-05-05 11:49:04 -03:00
parent 50049f1530
commit d148b27426

View file

@ -1,21 +1,24 @@
package arts package arts
import ( import (
"math"
"math/rand"
"github.com/fogleman/gg" "github.com/fogleman/gg"
"github.com/jdxyw/generativeart" "github.com/jdxyw/generativeart"
"github.com/jdxyw/generativeart/common" "github.com/jdxyw/generativeart/common"
"math"
"math/rand"
) )
type contourLine struct { type contourLine struct {
lineNum int lineNum int
lineSize float64
} }
// NewContourLine returns a contourLine object. // NewContourLine returns a contourLine object.
func NewContourLine(lineNum int) *contourLine { func NewContourLine(lineNum int, lineSize float64) *contourLine {
return &contourLine{ return &contourLine{
lineNum: lineNum, lineNum: lineNum,
lineSize: lineSize,
} }
} }
@ -35,7 +38,7 @@ func (cl *contourLine) Generative(c *generativeart.Canva) {
y += math.Sin(theta) * 0.4 y += math.Sin(theta) * 0.4
ctex.SetColor(cls) ctex.SetColor(cls)
ctex.DrawEllipse(x, y, 2, 2) ctex.DrawEllipse(x, y, cl.lineSize, cl.lineSize)
ctex.Fill() ctex.Fill()
if x > float64(c.Width()) || x < 0 || y > float64(c.Height()) || y < 0 || rand.Float64() < 0.001 { if x > float64(c.Width()) || x < 0 || y > float64(c.Height()) || y < 0 || rand.Float64() < 0.001 {