MCPcopy Create free account
hub / github.com/Kitware/VTK / normalize

Function normalize

Web/Python/vtkmodules/web/camera.py:8–13  ·  view source on GitHub ↗
(vect, tolerance=0.00001)

Source from the content-addressed store, hash-verified

6
7
8def normalize(vect, tolerance=0.00001):
9 mag2 = sum(n * n for n in vect)
10 if abs(mag2 - 1.0) > tolerance:
11 mag = sqrt(mag2)
12 vect = tuple(n / mag for n in vect)
13 return vect
14
15
16def q_mult(q1, q2):

Callers 2

axisangle_to_qFunction · 0.70
vectProductFunction · 0.70

Calls 3

sumFunction · 0.50
absFunction · 0.50
sqrtFunction · 0.50

Tested by

no test coverage detected