-
Notifications
You must be signed in to change notification settings - Fork 3
/
demo.m
85 lines (59 loc) · 2.33 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
% A fast algorithm for computing disk conformal mapping of simply-connected open triangle meshes
%
% Main program:
% map = disk_conformal_map(v,f)
%
% Input:
% v: nv x 3 vertex coordinates of a simply-connected open triangle mesh
% f: nf x 3 triangulations of a simply-connected open triangle mesh
% Output:
% map: nv x 2 vertex coordinates of the disk conformal parameterization
%
% If you use this code in your own work, please cite the following paper:
% [1] P. T. Choi and L. M. Lui,
% "Fast Disk Conformal Parameterization of Simply-Connected Open Surfaces."
% Journal of Scientific Computing, 65(3), pp. 1065-1090, 2015.
%
% Copyright (c) 2014-2018, Gary Pui-Tung Choi
% https://scholar.harvard.edu/choi
addpath('mfile')
%% Example 1: Face
load('human_face.mat');
plot_mesh(v,f); view([0 90]);
map = disk_conformal_map(v,f);
plot_mesh(map,f); view([-90 90]);
% evaluate the angle distortion
angle_distortion(v,f,map);
%% Example 2: Chinese Lion
load('chinese_lion.mat');
% plot_mesh(v,f); view([0 80]);
% can also include the third input if an additional quantity is defined on vertices
plot_mesh(v,f,mean_curv); view([0 80]);
map = disk_conformal_map(v,f);
% plot_mesh(map,f); view([-180 90]);
% can also include the third input if an additional quantity is defined on vertices
plot_mesh(map,f,mean_curv); view([-180 90]);
% evaluate the angle distortion
angle_distortion(v,f,map);
%% Example 3: Human Brain
load('human_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 = disk_conformal_map(v,f);
% plot_mesh(map,f);
% can also include the third input if an additional quantity is defined on vertices
plot_mesh(map,f,mean_curv);
% evaluate the angle distortion
angle_distortion(v,f,map);
%% Example 4: Hand
load('hand.mat')
% plot_mesh(v,f); view([40 70]);
% can also include the third input if an additional quantity is defined on vertices
plot_mesh(v,f,mean_curv); view([40 70]);
map = disk_conformal_map(v,f);
% plot_mesh(map,f); view([0 90]);
% can also include the third input if an additional quantity is defined on vertices
plot_mesh(map,f,mean_curv); view([0 90]);
% evaluate the angle distortion
angle_distortion(v,f,map);