[vtk-developers] Proposed CenterOfMass function for vtkPoints

Will Schroeder will.schroeder at kitware.com
Thu Apr 1 08:52:03 EDT 2010


David-

The phrase center of mass is an issue for many reasons, first if the
dataset has cells that are curved (higher order cells) your assumption
may not hold. Second, there is no mention of mass in the dataset API
and this will confuse people.

As far as using Get__(), we strive for consistency in VTK. Yes you can
argue that the "get" methods could be better named in this case. But
what's done is done (e.g., GetBounds()) and unless there are
compelling reasons let's be consistent with what's there.

Whenever you muck with .h files that many classes depend on you get
widespread recompilation. That's life; use Python (or other
interpreted language) if you want to avoid this :-)

W



On Thu, Apr 1, 2010 at 8:35 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
> On Thu, Apr 1, 2010 at 6:18 AM, Will Schroeder
> <will.schroeder at kitware.com> wrote:
>> I see what you are doing but of course it is not really the center of
>> mass, also it is not consistent with the names of the methods
>> GetBounds(), GetCenter() that exist in vtkDataSet, so I think the
>> method is misnamed. However, I am not sure what to call it...maybe
>> GetWeightedCenter(), GetComputedCenter(), GetPointsCenter()? Also, you
>> may want to cache the computation like GetBounds() does (it first does
>> a mtime check against the compute time).
>
>
> John,
>
> Good idea - done.
>
> Will,
>
> - Why is it not the center of mass (assuming all the points have "unit" mass)?
>
> - I typically don't like functions named Get* that are not simple
> accessors, but if that's what it needs to be, that's fine.
> GetPointsCenter() seems to be the best I've heard so far.
>
> - Done - I cached the computation.
>
> - When making changes like this, is there anyway to try them out
> without completely recompiling VTK?
>
> The new files are attached.
>
> Thanks,
>
> David
>



-- 
William J. Schroeder, PhD
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
will.schroeder at kitware.com
http://www.kitware.com
(518) 881-4902



More information about the vtk-developers mailing list