Rotate adds a rotation transformation with rot in degree counter clockwise.
(rot float64)
| 654 | |
| 655 | // Rotate adds a rotation transformation with rot in degree counter clockwise. |
| 656 | func (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. |
| 666 | func (m Matrix) RotateAbout(rot, x, y float64) Matrix { |