WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   viz.Vector and normalize method (https://forum.worldviz.com/showthread.php?t=4698)

shivanangel 07-27-2013 02:41 PM

viz.Vector and normalize method
 
Vizard Support,

This is a suggestion and not a question.

Any chance you could make the normalize method in the viz.Vector class return the normalized vector so we can use the result in a single lined expression?

So I can do things like this in one line:

circleVec = (viz.Vector(1,0,0) + viz.Vector(0,1,0)).normalize() + offsetFromCenterVector

It has always kind of bothered me that I can't do this, especially after writing GLSL code where I get the result of the normalized vector in an expression.

Thanks,
George

farshizzo 08-02-2013 09:07 AM

Thanks for the suggestion. In a future version vector.normalize will return itself so it can be passed directly to a function. However, you can currently normalize a vector during creation:
Code:

v = viz.Vector([0,3,0],normalize=True)
You can also set the length to a specific value:
Code:

v = viz.Vector([0,3,0],length=5)


All times are GMT -7. The time now is 05:36 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC