MCPcopy Create free account
hub / github.com/ActiveState/code / Blending

Function Blending

recipes/Python/576871_Spline_demonstrator/recipe-576871.py:151–191  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149 print 'Cycle is closed'
150
151def Blending():
152 global points
153 L = len(points)
154 if L <= m:
155 print 'Make some more points first!'
156 return
157 if lOpen:
158 knot = StandardKnot()
159 if len(knot) == 0:
160 return
161 else:
162 knot = range(L)
163 print knot
164 x0 = ScreenW * 0.2
165 y0 = ScreenH * 0.2
166 scaley = ScreenH * 0.7
167 scalex = ScreenW / L * 0.7
168 for k in knot:
169 x1 = k * scalex + x0
170 y1 = ScreenH - y0
171 C.create_line(x1, y1, x1, y1 + 20)
172 for k in range(L):
173 t = 0.0
174 step = 0.1
175 x1 = x0
176 y1 = y0
177 if lOpen:
178 z = L - m + 1
179 else:
180 z = L
181 while t <= z:
182 if lOpen:
183 p = Nopen(k,m,t,knot)
184 else:
185 p = Nopen(0,m,mod(t-k,L),knot)
186 x2 = t * scalex + x0
187 y2 = ScreenH - p * scaley - y0
188 C.create_line(x1, y1, x2, y2)
189 x1 = x2
190 y1 = y2
191 t = t + step
192
193m = 3
194lOpen = True

Callers

nothing calls this directly

Calls 4

StandardKnotFunction · 0.85
rangeFunction · 0.85
NopenFunction · 0.85
modFunction · 0.85

Tested by

no test coverage detected