Mercurial > repos > public > sbplib
comparison +parametrization/old/triang_interp.m @ 248:81e0ead29431 feature/beams
Fixed package names in +parametrization
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 05 Sep 2016 16:34:22 +0200 |
parents | 3a3cf386bb7e |
children |
comparison
equal
deleted
inserted
replaced
247:c2ca9717db4d | 248:81e0ead29431 |
---|---|
11 o.g2 = g2; | 11 o.g2 = g2; |
12 o.g3 = g3; | 12 o.g3 = g3; |
13 o.A = g1(0); | 13 o.A = g1(0); |
14 o.B = g2(0); | 14 o.B = g2(0); |
15 o.C = g3(0); | 15 o.C = g3(0); |
16 o.Sa = grid.triang_interp.square_to_triangle_interp(g2,g3,g1); | 16 o.Sa = parametrization.triang_interp.square_to_triangle_interp(g2,g3,g1); |
17 o.Sb = grid.triang_interp.square_to_triangle_interp(g3,g1,g2); | 17 o.Sb = parametrization.triang_interp.square_to_triangle_interp(g3,g1,g2); |
18 o.Sc = grid.triang_interp.square_to_triangle_interp(g1,g2,g3); | 18 o.Sc = parametrization.triang_interp.square_to_triangle_interp(g1,g2,g3); |
19 end | 19 end |
20 | 20 |
21 | 21 |
22 function show(o,N) | 22 function show(o,N) |
23 % Show the mapped meridians of the triangle. | 23 % Show the mapped meridians of the triangle. |
28 | 28 |
29 na = @(t)o.Sa(t,1/2); | 29 na = @(t)o.Sa(t,1/2); |
30 | 30 |
31 ka = @(t)(o.g1(1-t)+o.g2(t))/2; | 31 ka = @(t)(o.g1(1-t)+o.g2(t))/2; |
32 | 32 |
33 h = grid.plot_curve(ma); | 33 h = parametrization.plot_curve(ma); |
34 h.Color = Color.blue; | 34 h.Color = Color.blue; |
35 h = grid.plot_curve(mb); | 35 h = parametrization.plot_curve(mb); |
36 h.Color = Color.blue; | 36 h.Color = Color.blue; |
37 h = grid.plot_curve(mc); | 37 h = parametrization.plot_curve(mc); |
38 h.Color = Color.blue; | 38 h.Color = Color.blue; |
39 | 39 |
40 h = grid.plot_curve(na); | 40 h = parametrization.plot_curve(na); |
41 h.Color = Color.red; | 41 h.Color = Color.red; |
42 | 42 |
43 h = grid.plot_curve(ka); | 43 h = parametrization.plot_curve(ka); |
44 h.Color = Color.red; | 44 h.Color = Color.red; |
45 | 45 |
46 [a(1),a(2)] = ma(1/3); | 46 [a(1),a(2)] = ma(1/3); |
47 [b(1),b(2)] = mb(1/3); | 47 [b(1),b(2)] = mb(1/3); |
48 [c(1),c(2)] = mc(1/3); | 48 [c(1),c(2)] = mc(1/3); |
49 | 49 |
50 d = ka(1-1/3); | 50 d = ka(1-1/3); |
51 | 51 |
52 | 52 |
53 grid.label_pt(a,b,c,d); | 53 parametrization.label_pt(a,b,c,d); |
54 | 54 |
55 | 55 |
56 % t = linspace(0,1,N); | 56 % t = linspace(0,1,N); |
57 % for i = 1:N | 57 % for i = 1:N |
58 % sa = @(s)o.Sa(s,t(i)); | 58 % sa = @(s)o.Sa(s,t(i)); |
59 % sb = @(s)o.Sb(s,t(i)); | 59 % sb = @(s)o.Sb(s,t(i)); |
60 % sc = @(s)o.Sc(s,t(i)); | 60 % sc = @(s)o.Sc(s,t(i)); |
61 | 61 |
62 % h = grid.plot_curve(sa); | 62 % h = parametrization.plot_curve(sa); |
63 % h.Color = Color.blue; | 63 % h.Color = Color.blue; |
64 % h = grid.plot_curve(sb); | 64 % h = parametrization.plot_curve(sb); |
65 % h.Color = Color.blue; | 65 % h.Color = Color.blue; |
66 % h = grid.plot_curve(sc); | 66 % h = parametrization.plot_curve(sc); |
67 % h.Color = Color.blue; | 67 % h.Color = Color.blue; |
68 % end | 68 % end |
69 | 69 |
70 h = grid.plot_curve(o.g1); | 70 h = parametrization.plot_curve(o.g1); |
71 h.LineWidth = 2; | 71 h.LineWidth = 2; |
72 h.Color = Color.red; | 72 h.Color = Color.red; |
73 | 73 |
74 h = grid.plot_curve(o.g2); | 74 h = parametrization.plot_curve(o.g2); |
75 h.LineWidth = 2; | 75 h.LineWidth = 2; |
76 h.Color = Color.red; | 76 h.Color = Color.red; |
77 | 77 |
78 h = grid.plot_curve(o.g3); | 78 h = parametrization.plot_curve(o.g3); |
79 h.LineWidth = 2; | 79 h.LineWidth = 2; |
80 h.Color = Color.red; | 80 h.Color = Color.red; |
81 | 81 |
82 end | 82 end |
83 | 83 |
88 % Makes a mapping from the unit square to a triangle by collapsing | 88 % Makes a mapping from the unit square to a triangle by collapsing |
89 % one of the sides of the squares to a corner on the triangle | 89 % one of the sides of the squares to a corner on the triangle |
90 % The collapsed side is mapped to the corner oposite to g1. | 90 % The collapsed side is mapped to the corner oposite to g1. |
91 % This is done such that for S(s,t), S(s,1) = g1(s) | 91 % This is done such that for S(s,t), S(s,1) = g1(s) |
92 function S = square_to_triangle_interp(g1,g2,g3) | 92 function S = square_to_triangle_interp(g1,g2,g3) |
93 corner = grid.line_segment(g3(0),g3(0)); | 93 corner = parametrization.line_segment(g3(0),g3(0)); |
94 S = grid.transfinite_interp(corner,g3,f(g1),f(g2)) | 94 S = parametrization.transfinite_interp(corner,g3,f(g1),f(g2)) |
95 | 95 |
96 % Function to flip a curve | 96 % Function to flip a curve |
97 function h = f(g) | 97 function h = f(g) |
98 h = @(t)g(1-t); | 98 h = @(t)g(1-t); |
99 end | 99 end |