MCPcopy
hub / github.com/tdewolff/canvas / Rot

Method Rot

util.go:290–296  ·  view source on GitHub ↗

Rot rotates the line OP by phi radians CCW.

(phi float64, p0 Point)

Source from the content-addressed store, hash-verified

288
289// Rot rotates the line OP by phi radians CCW.
290func (p Point) Rot(phi float64, p0 Point) Point {
291 sinphi, cosphi := math.Sincos(phi)
292 return Point{
293 p0.X + cosphi*(p.X-p0.X) - sinphi*(p.Y-p0.Y),
294 p0.Y + sinphi*(p.X-p0.X) + cosphi*(p.Y-p0.Y),
295 }
296}
297
298// Hadamard returns the Hadamard product, or the element-wise product, of the point.
299func (p Point) Hadamard(q Point) Point {

Callers 7

TestPointFunction · 0.95
TestMatrixFunction · 0.95
intersectionLineLineFunction · 0.80
intersectionLineEllipseFunction · 0.80
RhombusCellFunction · 0.80
ParallelogramCellFunction · 0.80
NewCrossHatchFunction · 0.80

Calls

no outgoing calls

Tested by 2

TestPointFunction · 0.76
TestMatrixFunction · 0.76