-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEsf.m
66 lines (50 loc) · 1.67 KB
/
Esf.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
function Esf
First = [-1.1 -1.1 -1.1 -1.1];
Last = [ 1.1 1.1 1.1 1.1];
Division = [ 5 5 5 5 ];
FirstPoint = [ 0 0 0 1 ];
%Approximating using the MarchingSimplex method
MarchingSimplex(4, 1, First, Last, Division, @esfera4, 'esfera4.pol');
%Approximating using the ContinuationSimplex method
ContinuationSimplex(4, 1, First, Last, Division, FirstPoint, @esfera4, 'esfera4_cont.pol');
return
function [f] = esfera2(n,v)
f(1) = v(1)*v(1) + v(2)*v(2) - 1;
return
end
function [f] = esfera3(n,v)
f(1) = v(1)*v(1) + v(2)*v(2) + v(3)*v(3) - 1;
return
end
function [f] = esfera4(n,v)
f(1) = v(1)*v(1) + v(2)*v(2) + v(3)*v(3) + v(4)*v(4) - 1;
return
end
function [f] = esfera5(n,v)
f(1) = v(1)*v(1) + v(2)*v(2) + v(3)*v(3) + v(4)*v(4) + v(5)*v(5) - 1;
return
end
function [f] = kleinBottle(n,v)
R = 1;
P = 0.8;
theta = v(1);
ve = v(2);
weird_e = 0.08;
f(1) = R * (cos(theta/2) * cos(ve) - sin(theta/2) * sin(2*ve)) - v(3);
f(2) = R * (sin(theta/2) * cos(ve) + cos(theta/2) * sin(2*ve)) - v(4);
f(3) = P * cos(theta) * (1 + weird_e * sin(ve)) - v(5);
f(4) = P * sin(theta) * (1 + weird_e * sin(ve)) - v(6);
end
function [f] = flat_torus(n,params)
v = params(1);
u = params(2);
x = (sin(v/2) + 0.1) * cos(u);
y = (sin(v/2) + 0.1) * sin(u);
z = sin(v);
w = cos(v);
f(1) = x - params(3);
f(2) = y - params(4);
f(3) = z - params(5);
f(4) = w - params(6);
end
end