rotatePoint applies rotation theta (in radians) about the origin to point p.
(theta float64, p vg.Point)
| 165 | |
| 166 | // rotatePoint applies rotation theta (in radians) about the origin to point p. |
| 167 | func rotatePoint(theta float64, p vg.Point) vg.Point { |
| 168 | if theta == 0 { |
| 169 | return p |
| 170 | } |
| 171 | x := float64(p.X) |
| 172 | y := float64(p.Y) |
| 173 | |
| 174 | sin, cos := math.Sincos(theta) |
| 175 | |
| 176 | return vg.Point{ |
| 177 | X: vg.Length(x*cos - y*sin), |
| 178 | Y: vg.Length(y*cos + x*sin), |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | func max(d ...vg.Length) vg.Length { |
| 183 | o := vg.Length(math.Inf(-1)) |