示例#1
0
文件: types.go 项目: gitchander/gofra
// relative value
func (p *Parameters) MoveRelativeLocation(x, y float64) {

	normRelativeValue := func(x float64) float64 {
		if x < -1 {
			x = -1
		}
		if x > 1 {
			x = 1
		}
		return x
	}

	x = normRelativeValue(x)
	y = normRelativeValue(y)

	loc := &(p.FractalInfo.Location)

	var m mth2d.Matrix
	m.InitIdendity()
	m.Scale(loc.Radius, loc.Radius)
	m.Rotate(degToRad(loc.Angle))
	m.Translate(loc.Center.Re, loc.Center.Im)

	loc.Center.Re, loc.Center.Im = m.TransformPoint(x, y)
}