[vtkusers] Wrap of vtkMath.Cross / vtkMath.Normalize
Charl P. Botha
c.p.botha at ewi.tudelft.nl
Wed Sep 10 10:22:48 EDT 2003
On Wed, 2003-09-10 at 15:55, Mathieu Malaterre wrote:
> Am I missing something or is there a problem with those methods:
> vtkMath.Normalize & vtkMath.Cross
You're missing something. :) Check the vtkMath documentation:
Normalize() normalises in-place and returns the magnitude. Your "a" is
a tuple, and Normalize() can't insert the new values, because tuples are
immutable. Rather try this:
aTuple = tuple(a)
vtk.vtkMath.Normalize(aTuple)
>
> ##########################
> import vtk
> a=1,2,3
> vtk.vtkMath.Norm(a) #ok
> vtk.vtkMath.Normalize(a)
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: object doesn't support item assignment
> ##########################
--
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/
More information about the vtkusers
mailing list