MCPcopy Create free account
hub / github.com/tdewolff/canvas / Rotate

Method Rotate

util.go:656–663  ·  view source on GitHub ↗

Rotate adds a rotation transformation with rot in degree counter clockwise.

(rot float64)

Source from the content-addressed store, hash-verified

654
655// Rotate adds a rotation transformation with rot in degree counter clockwise.
656func (m Matrix) Rotate(rot float64) Matrix {
657 // TODO: this accepts degrees but Point.Angle returns radians
658 sintheta, costheta := math.Sincos(rot * math.Pi / 180.0)
659 return m.Mul(Matrix{
660 {costheta, -sintheta, 0.0},
661 {sintheta, costheta, 0.0},
662 })
663}
664
665// RotateAbout adds a rotation transformation about (x,y) with rot in degrees counter clockwise.
666func (m Matrix) RotateAbout(rot, x, y float64) Matrix {

Callers 1

RotateAboutMethod · 0.45

Calls 1

MulMethod · 0.95

Tested by

no test coverage detected