This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{nixpkgs ? null}: | |
let | |
sysPkg = import <nixpkgs> { }; | |
pinnedPkg = sysPkg.fetchFromGitHub { | |
owner = "NixOS"; | |
repo = "nixpkgs"; | |
rev = "cf62a27a326a9cdbb01d627b1faaea3a0d5e886c"; | |
sha256 = "1q74ciqq5r17vidw2025x8idsncz9k7w60warrij4q7piaffgvd7"; | |
}; | |
pkgs = if nixpkgs==null then |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear; | |
data = [ 475. , 605.75, 1.; | |
571. , 586.5 , 2.; | |
233. , 558.5 , 3.; | |
669.5 , 562.75, 4.; | |
291.25, 546.25, 5.; | |
759. , 536.25, 6.; | |
362.5 , 531.5 , 7.; | |
448. , 513.5 , 8.; | |
834.5 , 510. , 9.; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% %% Requirements: | |
%% distancePointsAffineSpace: | |
%% https://gist.github.com/knedlsepp/3e37f147cb4c94ae6223 | |
%% affineSpaceIntersection: | |
%% https://github.com/knedlsepp/affineSpaceIntersection/blob/master/affineSpaceIntersection.m | |
%% uniquetol: | |
%% http://www.mathworks.com/matlabcentral/fileexchange/27498-unique-with-tolerance/content/uniquetol.m | |
%% // Read dataset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function d = distancePointsAffineSpace(Points, Space) | |
lengths = @(X) sqrt(sum(X.^2,2)); | |
d = lengths(Points - projectPointsOntoAffineSpace(Points, Space)); | |
end | |
function [projectedPoints, coordinates] = projectPointsOntoAffineSpace(Points, Space) | |
%coordinates are with respect to an orthonormal base located in Space(1,:) | |
dirVecs = bsxfun(@minus, Space(2:end,:), Space(1,:)); | |
% Orthonormalize the direction vectors; | |
dirVecs = orth(dirVecs.').'; |
NewerOlder