[vtk-developers] vtkPlane DeepCopy?

David Doria daviddoria+vtk at gmail.com
Sat Dec 5 17:21:30 EST 2009


> Oh, there's a reason for that too.  I mean specifically, there's a
> reason for all these static computational methods in VTK.  VTK objects
> are "heavy".  You shouldn't create a VTK object just to do things like
> distance-to-plane computations.
>
> Instead, you should just create C array for the normal and origin for
> each plane you need.  Or, create your own lightweight object.
>
> class myplane
> {
> public:
>  double normal[3];
>  double origin[3];
> };
>
> vtkPlane::DistanceToPlane(point, plane.normal, plane.origin);
>
> Take a look at vtkObject and vtkObjectBase and you will see how
> "heavy" these classes are.  All vtkObjects support reference counting,
> observers, wrapping, etc, etc.  If you just need to store 6 numbers,
> don't use a vtkPlane.
>
> Just my 2 cents.
>
>   David
>

I know what you mean, but if you do already have a vtkPlane for some
reason, you shouldn't have to get the data out of it before using
functions on it, right?? Couldn't we just make

void vtkPlane::DistanceToPoint(double point[3])
{
 double n[3];
 double o[3];
 this->GetNormal(n);
 this->GetOrigin(o);
 return vtkPlane::DistanceToPlane(point, n, o);
}

for cases like this? It would alleviate many giant blocks of code like
this in my (and I'd assume most people's?) code to do simple, "one
line" things.

Also, as usual I will try to be the voice of new users (my constant
overarching motivation) - a new user (i.e. someone who doesn't
know/care about the "heavy weight-ness") would be very confused why
they can make a plane but not do anything reasonable with it; this
type of function would certainly ease some of that confusion.

Thanks,

David



More information about the vtk-developers mailing list