-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathdefineBsplineRing.m
126 lines (114 loc) · 3.12 KB
/
defineBsplineRing.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
%
% Project: Approximation and Finite Elements in Isogeometric Problems
% Author: Luca Carlon
% Date: 2009.11.06
%
% Copyright (c) 2009-2021 Luca Carlon. All rights reserved.
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%
function [n, p, Xi, m, q, Eta, P] = defineBsplineRing()
% Definition of the control points.
P(1, 1, :) = [5, 0, -1];
P(2, 1, :) = [5, 5, -1];
P(3, 1, :) = [0, 5, -1];
P(4, 1, :) = [-5, 5, -1];
P(5, 1, :) = [-5, 0, -1];
P(6, 1, :) = [-5, -5, -1];
P(7, 1, :) = [0, -5, -1];
P(8, 1, :) = [5, -5, -1];
P(9, 1, :) = [5, 0, -1];
P(1, 2, :) = [6, 0, -1];
P(2, 2, :) = [6, 6, -1];
P(3, 2, :) = [0, 6, -1];
P(4, 2, :) = [-6, 6, -1];
P(5, 2, :) = [-6, 0, -1];
P(6, 2, :) = [-6, -6, -1];
P(7, 2, :) = [0, -6, -1];
P(8, 2, :) = [6, -6, -1];
P(9, 2, :) = [6, 0, -1];
P(1, 3, :) = [6, 0, 0];
P(2, 3, :) = [6, 6, 0];
P(3, 3, :) = [0, 6, 0];
P(4, 3, :) = [-6, 6, 0];
P(5, 3, :) = [-6, 0, 0];
P(6, 3, :) = [-6, -6, 0];
P(7, 3, :) = [0, -6, 0];
P(8, 3, :) = [6, -6, 0];
P(9, 3, :) = [6, 0, 0];
P(1, 4, :) = [6, 0, 1];
P(2, 4, :) = [6, 6, 1];
P(3, 4, :) = [0, 6, 1];
P(4, 4, :) = [-6, 6, 1];
P(5, 4, :) = [-6, 0, 1];
P(6, 4, :) = [-6, -6, 1];
P(7, 4, :) = [0, -6, 1];
P(8, 4, :) = [6, -6, 1];
P(9, 4, :) = [6, 0, 1];
P(1, 5, :) = [5, 0, 1];
P(2, 5, :) = [5, 5, 1];
P(3, 5, :) = [0, 5, 1];
P(4, 5, :) = [-5, 5, 1];
P(5, 5, :) = [-5, 0, 1];
P(6, 5, :) = [-5, -5, 1];
P(7, 5, :) = [0, -5, 1];
P(8, 5, :) = [5, -5, 1];
P(9, 5, :) = [5, 0, 1];
P(1, 6, :) = [4, 0, 1];
P(2, 6, :) = [4, 4, 1];
P(3, 6, :) = [0, 4, 1];
P(4, 6, :) = [-4, 4, 1];
P(5, 6, :) = [-4, 0, 1];
P(6, 6, :) = [-4, -4, 1];
P(7, 6, :) = [0, -4, 1];
P(8, 6, :) = [4, -4, 1];
P(9, 6, :) = [4, 0, 1];
P(1, 7, :) = [4, 0, 0];
P(2, 7, :) = [4, 4, 0];
P(3, 7, :) = [0, 4, 0];
P(4, 7, :) = [-4, 4, 0];
P(5, 7, :) = [-4, 0, 0];
P(6, 7, :) = [-4, -4, 0];
P(7, 7, :) = [0, -4, 0];
P(8, 7, :) = [4, -4, 0];
P(9, 7, :) = [4, 0, 0];
P(1, 8, :) = [4, 0, -1];
P(2, 8, :) = [4, 4, -1];
P(3, 8, :) = [0, 4, -1];
P(4, 8, :) = [-4, 4, -1];
P(5, 8, :) = [-4, 0, -1];
P(6, 8, :) = [-4, -4, -1];
P(7, 8, :) = [0, -4, -1];
P(8, 8, :) = [4, -4, -1];
P(9, 8, :) = [4, 0, -1];
P(1, 9, :) = [5, 0, -1];
P(2, 9, :) = [5, 5, -1];
P(3, 9, :) = [0, 5, -1];
P(4, 9, :) = [-5, 5, -1];
P(5, 9, :) = [-5, 0, -1];
P(6, 9, :) = [-5, -5, -1];
P(7, 9, :) = [0, -5, -1];
P(8, 9, :) = [5, -5, -1];
P(9, 9, :) = [5, 0, -1];
d = length(P(1, 1, :));
% Define the knot vectors.
Xi = [0, 0, 0, 0.25, 0.25, 0.5, 0.5, 0.75, 0.75, 1, 1, 1];
Xi = Xi.*4;
Eta = [0, 0, 0, 0.25, 0.25, 0.5, 0.5, 0.75, 0.75, 1, 1, 1];
Eta = Eta.*4;
% Define the scalars.
n = 8;
p = 2;
m = 8;
q = 2;