[vtk-developers] BestFitPlane function for vtkPlane

David Doria daviddoria+vtk at gmail.com
Wed Nov 4 07:53:50 EST 2009


On Wed, Nov 4, 2009 at 7:32 AM, Will Schroeder
<will.schroeder at kitware.com> wrote:
> David-
>
> In the class vtkTextureMapToPlane there is some machinery for fitting a
> plane to a set of points. In the interest of not replicating code, can these
> methods be consolidated?
>
> Will


Sure - I think it makes more sense to have the plane fitting in the
vtkPlane class though - then the TextureMapping class will only have
code relating to texture mapping and these geometric "helper"
functions will be accessible from elsewhere as well.

A quick look through vtkTextureMapToPlane looks like all it needs is
the normal of the plane. This is ok - we can just compute the best fit
plane and simply not use the origin that is returned.
vtkTextureMapToPlane also seems to have some extra things such as
using the bounding box to compute the normals - I'm not sure how much
of that can/should be replaced by the more general "best fit plane"
function. I am not familiar with this class though so I'm not sure
it's a good idea to start poking around without a good example so I
can be sure the functionality does not change.

I'm not sure of the standard practices related to code replication -
but to me it seems bad if you rewrite parts of a good general function
in your new class, but it doesn't seem so bad (like in this case) if
you add a good general function and then slowly replace old code to
use it where possible. Is this not a good plan?

Thanks,

David



More information about the vtk-developers mailing list