[vtkusers] RE: plane approximation

Rasmus Reinhold Paulsen rrp at imm.dtu.dk
Thu Aug 1 13:38:29 EDT 2002


Hi Ebner and Leo

On Thu, 1 Aug 2002, CPBuid: ljvanruijven wrote:

> For every point x,y,z calculate xx, xy, xz, yy, yz and zz. Add all terms, and 
> put the sums in a symmetric 3 by 3 matrix (xx,xy,xz; xy,yy,yz; xz,yz,zz). 
> This matrix represents an ellipsoid whose shape corresponds with the shape of 
> your points. From this matrix you can calculate the eigenvalues and 
> eigenvectors (see vtkMath). These eigenvectors and eigenvalues define the 
> directions and lengths of the main axes of this ellipsoid. The vectors 
> belonging to the largest eigenvalues give you the orientation of the 
> requested plane.
> 
> The position of the plane is determined by the centriod of your points.

For an example of how to calculate the major axis using the eigenvectors
and values take a look at vtkOBBTree. The first level of the OBB tree is
similar to what you are looking for. On my homepage
www.imm.dtu.dk/~rrp/VTK there is a class (vtkPrincipalAxisTransform) that
will transform a given shape
to the principal axis of another shape. This class also contains the
sought functionallity.

Regards,
Rasmus





More information about the vtkusers mailing list