@@ -135,19 +135,25 @@ def de_boor_control_pts(points_array, d0=None,
135
135
# Construct de Boor Control Points from A matrix
136
136
d_pts = np .zeros ((N + 3 , k ))
137
137
for col in range (0 , k ):
138
- x = np .zeros ((N - 1 , 1 ))
139
- # Compute start / end conditions
140
- if natural :
141
- x [N - 2 , 0 ] = 6 * points_array [- 2 , col ] - points_array [- 1 , col ]
142
- x [0 , 0 ] = 6 * points_array [1 , col ] - points_array [0 , col ]
143
- else :
144
- x [N - 2 , 0 ] = 6 * points_array [- 2 , col ] - 1.5 * dN [0 , col ]
145
- x [0 , 0 ] = 6 * points_array [1 , col ] - 1.5 * d0 [0 , col ]
146
- x [range (1 , N - 3 + 1 ), 0 ] = 6 * points_array [range (2 , N - 2 + 1 ), col ]
147
- # Solve bezier interpolation
138
+ x = np .zeros ((max (N - 1 , 1 ), 1 ))
148
139
if N > 2 :
140
+ # Compute start / end conditions
141
+ if natural :
142
+ x [N - 2 , 0 ] = 6 * points_array [- 2 , col ] - points_array [- 1 , col ]
143
+ x [0 , 0 ] = 6 * points_array [1 , col ] - points_array [0 , col ]
144
+ else :
145
+ x [N - 2 , 0 ] = 6 * points_array [- 2 , col ] - 1.5 * dN [0 , col ]
146
+ x [0 , 0 ] = 6 * points_array [1 , col ] - 1.5 * d0 [0 , col ]
147
+ x [range (1 , N - 3 + 1 ), 0 ] = 6 * points_array [range (2 , N - 2 + 1 ), col ]
148
+ # Solve bezier interpolation
149
149
d_pts [2 :N + 1 , col ] = np .linalg .solve (A , x ).T
150
150
else :
151
+ # Compute start / end conditions
152
+ if natural :
153
+ x [0 , 0 ] = 6 * points_array [1 , col ] - points_array [0 , col ]
154
+ else :
155
+ x [0 , 0 ] = 6 * points_array [1 , col ] - 1.5 * d0 [col ]
156
+ # Solve bezier interpolation
151
157
d_pts [2 , col ] = x / A
152
158
# Store off start and end positions
153
159
d_pts [0 , :] = points_array [0 , :]
0 commit comments