-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdemo.m
67 lines (53 loc) · 1.98 KB
/
demo.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
% A linear method for computing spherical conformal map of genus-0 closed triangle meshes
%
% Main program:
% map = spherical_conformal_map(v,f)
%
% Input:
% v: nv x 3 vertex coordinates of a genus-0 closed triangle mesh
% f: nf x 3 triangulations of a genus-0 closed triangle mesh
%
% Output:
% map: nv x 3 vertex coordinates of the spherical conformal map
%
% Remark:
% See demo_extension.m to understand how the method can be extended for
% further reducing the area distortion
%
% If you use this code in your own work, please cite the following paper:
% [1] P. T. Choi, K. C. Lam, and L. M. Lui,
% "FLASH: Fast Landmark Aligned Spherical Harmonic Parameterization for Genus-0 Closed Brain Surfaces."
% SIAM Journal on Imaging Sciences, vol. 8, no. 1, pp. 67-94, 2015.
%
% Copyright (c) 2013-2018, Gary Pui-Tung Choi
% https://scholar.harvard.edu/choi
addpath('mfile')
%% Example 1: David
load('david.mat')
plot_mesh(v,f); view([-130 0])
map = spherical_conformal_map(v,f);
plot_mesh(map,f);
% evaluate the angle distortion
angle_distortion(v,f,map);
%% Example 2: Chinese lion
load('lion.mat')
% plot_mesh(v,f);
% can also include the third input if an additional quantity is defined on vertices
plot_mesh(v,f,mean_curv);
map = spherical_conformal_map(v,f);
% plot_mesh(map,f); view([-70 0])
% can also include the third input if an additional quantity is defined on vertices
plot_mesh(map,f,mean_curv); view([-70 0])
% evaluate the angle distortion
angle_distortion(v,f,map);
%% Example 3: Brain
load('brain.mat')
% plot_mesh(v,f); view([90 0])
% can also include the third input if an additional quantity is defined on vertices
plot_mesh(v,f,mean_curv); view([90 0]);
map = spherical_conformal_map(v,f);
% plot_mesh(map,f); view([-30 0]);
% can also include the third input if an additional quantity is defined on vertices
plot_mesh(map,f,mean_curv); view([-30 0]);
% evaluate the angle distortion
angle_distortion(v,f,map);