doHClustering edit page

hirarchical clustering of rotations and vectors

Syntax

[c,center] = doHCluster(ori,'numCluster',n)
[c,center] = doHCluster(ori,'maxAngle',omega)

Input

ori orientation
n number of clusters
omega maximum angle

Output

c list of clusters
center center of the clusters

Example

% generate orientation clustered around 5 centers
cs = crystalSymmetry('m-3m');
center = orientation.rand(5,cs);
odf = unimodalODF(center,'halfwidth',5*degree)
ori = odf.discreteSample(3000);
odf = SO3FunRBF (m-3m → xyz)
 
  <strong>multimodal components</strong>
  kernel: de la Vallee Poussin, halfwidth 5°
  center: 5 orientations
 
  Bunge Euler angles in degree
     phi1     Phi    phi2  weight
   210.14 137.226 110.488     0.2
  302.794  99.633 177.048     0.2
  34.3264 97.0786   247.1     0.2
  181.814 52.6896 302.536     0.2
  66.9799 53.2241 230.505     0.2
% find the clusters and its centers
tic; [c,centerRec] = calcCluster(ori,'method','hierarchical','numCluster',5); toc
Elapsed time is 3.340975 seconds.
% visualize result
oR = fundamentalRegion(cs)
plot(oR)
oR = orientationRegion
 
 crystal symmetry:  432
 max angle: 62.7994°
 face normales: 14
 vertices: 24
hold on
plot(ori,ind2color(c))
caxis([1,5])
plot(center,'MarkerSize',10,'MarkerFaceColor','k','MarkerEdgeColor','k')
plot(centerRec,'MarkerSize',10,'MarkerFaceColor','r','MarkerEdgeColor','k')
hold off
plot 2000 random orientations out of 3000 given orientations
%check the accuracy of the recomputed centers
min(angle_outer(center,centerRec)./degree)
ans =
   13.3356    6.6894    1.1507    0.1165    0.3907