Skip to content

Instantly share code, notes, and snippets.

@faiface
Created May 21, 2017 20:39
Show Gist options
  • Save faiface/9b110cfe4bf75e528130a527f9ba0c8e to your computer and use it in GitHub Desktop.
Save faiface/9b110cfe4bf75e528130a527f9ba0c8e to your computer and use it in GitHub Desktop.
Operation complex128 struct
New vector pixel.V(x, y) pixel.Vec{X: x, Y: y} or pixel.V(x, y)
Get coord u.X() u.X
Set coord u = u.WithX(x) u.X = x
Add to coord u += pixel.X(x) u.X += x
Mul coord u = u.ScaledXY(pixel.V(c, 1)) u.X *= c
Add vectors u + v u.Add(v)
Scale vector u = u.Scaled(c) u = u.Scaled(c)
Mul vectors u = u.ScaledXY(v) u = u.ScaledXY(v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment