HELP_pointSetPrincipalDir

Below is a demonstration of the features of the pointSetPrincipalDir function

Contents

clear; close all; clc;

Plot settings

fontSize=11;

Using pointSetPrincipalDir to determine main directions of a polyhedron

Simulating an ellipsoid with known directions

% Ellipsoid axis stretch factors
ellipStretchTrue=[pi 2 1]

% Create ellipsoid patch data
[F,V,~]=geoSphere(2,1);

V=V.*ellipStretchTrue(ones(size(V,1),1),:);

%Create Euler angles to set directions
E=[0.25*pi 0.25*pi 0.25*pi];
[R_true,~]=euler2DCM(E); %The true directions for X, Y and Z axis
V=(R_true*V')'; %Rotate polyhedron
ellipStretchTrue =

    3.1416    2.0000    1.0000

This is the true axis system

R_true
R_true =

    0.5000   -0.5000    0.7071
    0.8536    0.1464   -0.5000
    0.1464    0.8536    0.5000

Determine principal directions of the point set (in this case an ellipsoidal polyhedron).

[R_fit]=pointSetPrincipalDir(V)
R_fit =

    0.5000   -0.5000    0.7071
    0.8536    0.1464   -0.5000
    0.1464    0.8536    0.5000

Visualizing results

cFigure;
title('The polyhedron with true (transparant) and determined (solid) axis directions','FontSize',fontSize);
hold on;

gpatch(F,V,0.75*ones(1,3),'k',1);
quiverTriad(mean(V,1),R_fit,7,[],1);
quiverTriad(mean(V,1),R_true,10,[],0.2);

camlight('headlight');
axisGeom(gca,fontSize);
drawnow;

What is clear from the above is that a different system is obtained. This is due to the symmetry properties of the ellipsoid. However all vectors are colinear with the true vector directions. The output direction matrix is ordered in size (as per the singular value decomposition). The vectors turned out colinear with R_true due to the fact that the ellipsoid directions were biased in a similar sense. However if the order is altered the first, second and third axes no longer allign with what was viewed here as the true directions. However the singular values can also be requested as an output allowing the user to reorder the output direction matrix if desired.

[R_fit,S]=pointSetPrincipalDir(V);
S
S =

   23.0859         0         0
         0   14.6969         0
         0         0    7.3485

GIBBON www.gibboncode.org

Kevin Mattheus Moerman, [email protected]

GIBBON footer text

License: https://github.com/gibbonCode/GIBBON/blob/master/LICENSE

GIBBON: The Geometry and Image-based Bioengineering add-On. A toolbox for image segmentation, image-based modeling, meshing, and finite element analysis.

Copyright (C) 2017 Kevin Mattheus Moerman

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.