addpath([pwd '/../../misc/']);
addpath([pwd '/../../misc/mtimesx/']);

addpath([pwd '/../../mex/']);

%% create data with a random scale and rotation
N = 100;
scale = diag(rand(3,1));
theta = rand()*2*pi;
R = [cos(theta) -sin(theta) 0; sin(theta) cos(theta) 0; 0 0 1];
X = R * scale * randn(3,N);

%% evaluate SVD
[X_rot, R_hat, Sigma] = build_feature(X, 10);

%% plot
figure(1);
clf;
plot3(X_rot(1,:), X_rot(2,:), X_rot(3,:), '.');
axis equal tight;
hold on;