[vtk-developers] BestFitPlane function for vtkPlane

Karthik Krishnan karthik.krishnan at kitware.com
Wed Nov 4 08:28:20 EST 2009


Add a third redundancy to it :-). vtkDelaunay2D.

The class also does an in-house computation of the best fitting plane to
project the points onto, prior to triangulation.

The comments from line 1370 of vtkDelaunay2D.cxx even states :

  "This code was taken from the vtkTextureMapToPlane class and slightly
modified."

So if you do plan to contribute this code David, it would be a good idea to
factor all these bits out. We don't want 3 nearly same versions lying around

Thanks
--
karthik


On Wed, Nov 4, 2009 at 8:08 AM, Will Schroeder
<will.schroeder at kitware.com>wrote:

> David-
>
> Adding new good code is generally not a problem, but we should all endeavor
> to remove redundant, obsolete or dead code that results from new additions.
> Over time the debris accumulates and the code becomes harder to manage. We
> have the tests in place so that you can rework existing classes with the
> assurance that what you are replacing still works as expected.
>
> Will
>
>
> On Wed, Nov 4, 2009 at 7:53 AM, David Doria <daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> > wrote:
>
>> 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
>> _______________________________________________
>> 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
>>
>>
>
>
> --
> 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
>
> _______________________________________________
> 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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20091104/416e53b4/attachment.html>


More information about the vtk-developers mailing list