MCPcopy Index your code
hub / github.com/gonum/plot / rotatePoint

Function rotatePoint

text/text.go:167–180  ·  view source on GitHub ↗

rotatePoint applies rotation theta (in radians) about the origin to point p.

(theta float64, p vg.Point)

Source from the content-addressed store, hash-verified

165
166// rotatePoint applies rotation theta (in radians) about the origin to point p.
167func 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
182func max(d ...vg.Length) vg.Length {
183 o := vg.Length(math.Inf(-1))

Callers 1

RectangleMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected