-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsphbary.m
50 lines (45 loc) · 1.37 KB
/
sphbary.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function [c,Pnew] = sphbary(data,vertices,varargin)
% SPHBARY compute spherical barycentric coordinates of a facet or simplex [1]
%--------------------------------------------------------------------------
% Author: Sterling Baird
%
% Date: 2020-07-03
%
% Inputs:
% data === datapoint of interest on hypersphere which defines the
% tangent hyperplane to the hypersphere
%
% vertices === rows of vertices of facet that have been projected to
% tangent hyperplane defined by 'a'
%
% Pnew === varargin{1}, vertices projected onto tangent
% hyperplane
%
% Outputs:
% c === spherical barycentric coordinates of 'a'
%
% Dependencies:
% projfacet2hyperplane.m
% -projray2hyperplane.m
%
% References:
% [1] T. Langer, A. Belyaev, H.-P. Seidel, Spherical barycentric
% coordinates, Proc. Fourth Eurographics Symp. Geom. Process. (2006)
% 81–88. http://portal.acm.org/citation.cfm?id=1281957.1281968.
%
% https://math.stackexchange.com/q/1256236/798661
%
%--------------------------------------------------------------------------
if nargin == 3
Pnew = varargin{1};
end
if exist('Pnew','var') == 0
Pnew = projfacet2hyperplane(data,vertices);
end
c = (Pnew.'\data.').';
end
%-----------------------------NOTES----------------------------------------
%{
Maybe sphbary should have the computation of a and P (from
projfacet2hyperplane.m) inside of it. 2020-07-09, now it does
%}