[vtk-developers] New function: vtkMath::ProjectVector

David Doria daviddoria+vtk at gmail.com
Tue Sep 14 19:40:18 EDT 2010


On Tue, Sep 14, 2010 at 6:37 PM, Moreland, Kenneth <kmorel at sandia.gov>wrote:

>  You can get the magnitude squared of any vector by taking the dot product
> with itself.  That’s basically what you are doing to compute the bSquared
> variable although I would suggest using vtkMath::Dot(b,b) instead.
>
> -Ken
>

Thanks John and Ken,

I changed it to use the dot product of b with itself instead of the squared
norm. I also changed the function to return a bool. If b is a zero vector it
returns false and 'projected' is invalid' (I put a note in the function
description about this behavior). Otherwise, it computes the projection and
returns true.

Here is the latest commit:
http://github.com/daviddoria/daviddoria-vtk/commit/e227a729bbd8062c434894d23cc65f72213470c8
<http://github.com/daviddoria/daviddoria-vtk/commit/e227a729bbd8062c434894d23cc65f72213470c8>
Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100914/6a3e8c28/attachment.html>


More information about the vtk-developers mailing list