[vtk-developers] vtkMath::Dot2D

Moreland, Kenneth kmorel at sandia.gov
Wed Dec 9 18:11:21 EST 2009


My guess would be that that is a copy-paste error.  Change it to 2-vectors is probably the right thing to do.

AFAIK, the array declaration in a function/method argument is treated just like a pointer.  C++ does not do any range checking.  I think it just serves to help document what size array you expect.

-Ken


On 12/9/09 3:57 PM, "David Doria" <daviddoria+vtk at gmail.com> wrote:

Is there any reason:

  // Description:
  // Dot product of two 2-vectors. The third (z) component is
  // ignored (double-precision version).
  static double Dot2D(const double x[3], const double y[3]) {
    return ( x[0] * y[0] + x[1] * y[1] );};

needs to accept 3-vectors and talk about how it ignores the last
component? Couldn't it just be:

  // Description:
  // Dot product of two 2-vectors. (double-precision version).
  static double Dot2D(const double x[2], const double y[2]) {
    return ( x[0] * y[0] + x[1] * y[1] );};

Thanks,

David
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers





   ****      Kenneth Moreland
    ***      Sandia National Laboratories
***********
*** *** ***  email: kmorel at sandia.gov
**  ***  **  phone: (505) 844-8919
    ***      web:   http://www.cs.unm.edu/~kmorel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20091209/a7835c9c/attachment.html>


More information about the vtk-developers mailing list