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

Method Norm

util.go:337–343  ·  view source on GitHub ↗

Norm normalises OP to be of given length.

(length float64)

Source from the content-addressed store, hash-verified

335
336// Norm normalises OP to be of given length.
337func (p Point) Norm(length float64) Point {
338 d := p.Length()
339 if d == 0.0 {
340 return Point{}
341 }
342 return Point{p.X / d * length, p.Y / d * length}
343}
344
345// Transform transforms the point by affine transformation matrix m.
346func (p Point) Transform(m Matrix) Point {

Callers 10

TestPointFunction · 0.95
directionMethod · 0.80
CoordDirectionsMethod · 0.80
ellipseNormalFunction · 0.80
cubicBezierNormalFunction · 0.80
EigenMethod · 0.80
intersectionRayCircleFunction · 0.80
JoinMethod · 0.80
JoinMethod · 0.80
offsetMethod · 0.80

Calls 1

LengthMethod · 0.95

Tested by 1

TestPointFunction · 0.76