bspy 3.0.1__py3-none-any.whl → 4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
bspy/drawableSpline.py DELETED
@@ -1,585 +0,0 @@
1
- import numpy as np
2
- from OpenGL.GL import *
3
- from bspy import Spline
4
-
5
- def _set_color(r, g=None, b=None, a=None):
6
- """
7
- Return an array with the specified color.
8
-
9
- Parameters
10
- ----------
11
- r : `float`, `int` or array-like of floats or ints
12
- The red value [0, 1] as a float, [0, 255] as an int, or the rgb or rgba value as floats or ints (default).
13
-
14
- g: `float` or `int`
15
- The green value [0, 1] as a float or [0, 255] as an int.
16
-
17
- b: `float` or `int`
18
- The blue value [0, 1] as a float or [0, 255] as an int.
19
-
20
- a: `float`, `int`, or None
21
- The alpha value [0, 1] as a float or [0, 255] as an int. If `None` then alpha is set to 1.
22
-
23
- Returns
24
- -------
25
- color : `numpy.array`
26
- The specified color as an array of 4 float32 values between 0 and 1.
27
- """
28
- if isinstance(r, (int, np.integer)):
29
- red = float(r) / 255.0
30
- green = red
31
- blue = red
32
- alpha = 1.0
33
- elif np.isscalar(r):
34
- red = r
35
- green = red
36
- blue = red
37
- alpha = 1.0
38
- elif isinstance(r[0], (int, np.integer)):
39
- red = float(r[0]) / 255.0
40
- green = float(r[1]) / 255.0
41
- blue = float(r[2]) / 255.0
42
- alpha = float(r[3]) / 255.0 if len(r) >= 4 else 1.0
43
- else:
44
- red = r[0]
45
- green = r[1]
46
- blue = r[2]
47
- alpha = r[3] if len(r) >= 4 else 1.0
48
-
49
- if isinstance(g, (int, np.integer)):
50
- green = float(g) / 255.0
51
- elif np.isscalar(g):
52
- green = g
53
-
54
- if isinstance(b, (int, np.integer)):
55
- blue = float(b) / 255.0
56
- elif np.isscalar(b):
57
- blue = b
58
-
59
- if isinstance(a, (int, np.integer)):
60
- alpha = float(a) / 255.0
61
- elif np.isscalar(a):
62
- alpha = a
63
-
64
- return np.array((red, green, blue, alpha), np.float32)
65
-
66
- class DrawableSpline(Spline):
67
- """
68
- A `Spline` that can be drawn within a `SplineOpenGLFrame`.
69
-
70
- Parameters
71
- ----------
72
- spline or nInd : `Spline` or `int`
73
- An existing spline that needs to become drawable (using `DrawableSpline.make_drawable`), or the number of independent variables of the new spline.
74
- If it is an existing spline, the remaining parameters are optional and ignored.
75
-
76
- nDep : `int`
77
- The number of dependent variables of the spline
78
-
79
- order : `tuple`
80
- A tuple of length nInd where each integer entry represents the
81
- polynomial order of the function in that variable
82
-
83
- nCoef : `tuple`
84
- A tuple of length nInd where each integer entry represents the
85
- dimension (i.e. number of B-spline coefficients) of the function
86
- space in that variable
87
-
88
- knots : `list`
89
- A list of the lists of the knots of the spline in each independent variable
90
-
91
- coefs : array-like
92
- A list of the B-spline coefficients of the spline.
93
-
94
- metadata : `dict`
95
- A dictionary of ancillary data to store with the spline
96
-
97
- See Also
98
- --------
99
- `bspy.spline` : A class to model, represent, and process piecewise polynomial tensor product
100
- functions (spline functions) as linear combinations of B-splines.
101
-
102
- `make_drawable` : Convert a `Spline` into a `DrawableSpline` that can be drawn in a `SplineOpenGLFrame`. Converts
103
- 1D splines into 3D curves, 2D splines into surfaces (y-axis hold amplitude), and 3D splines into solids.
104
- """
105
-
106
- maxOrder = 9
107
- """Maximum order for drawable splines."""
108
- maxCoefficients = 120
109
- """Maximum number of coefficients for drawable splines."""
110
- maxKnots = maxCoefficients + maxOrder
111
- """Maximum number of knots for drawable splines."""
112
- _maxFloats = 4 + 2 * maxKnots + 4 * maxCoefficients * maxCoefficients
113
- """Maximum total number of floats for drawable splines."""
114
-
115
- HULL = (1 << 0)
116
- """Option to draw the convex hull of the spline (the coefficients). Off by default."""
117
- SHADED = (1 << 1)
118
- """Option to draw the spline shaded (only useful for nInd >= 2). On by default."""
119
- BOUNDARY = (1 << 2)
120
- """Option to draw the boundary of the spline in the line color (only useful for nInd >= 2). On by default."""
121
- ISOPARMS = (1 << 3)
122
- """Option to draw the lines of constant knot values of the spline in the line color (only useful for nInd >= 2). Off by default."""
123
-
124
- def __init__(self, *args, **kwargs):
125
- if isinstance(args[0], Spline):
126
- spline = DrawableSpline.make_drawable(args[0])
127
- self.nInd = spline.nInd
128
- self.nDep = spline.nDep
129
- self.order = spline.order
130
- self.nCoef = spline.nCoef
131
- self.knots = spline.knots
132
- self.coefs = spline.coefs
133
- self.metadata = spline.metadata
134
- else:
135
- Spline.__init__(self, *args, **kwargs)
136
- if self.nInd > 3: raise ValueError("nInd must be no more than 3")
137
- if self.nDep < 3: raise ValueError("nDep must be at least 3")
138
- if self.coefs.dtype != np.float32: raise ValueError("Must use 32-bit floats")
139
- for knotArray in self.knots:
140
- if knotArray.dtype != np.float32: raise ValueError("Must use 32-bit floats")
141
- floatCount = 0
142
- coefficientCount = 1
143
- for i in range(self.nInd):
144
- if self.order[i] > self.maxOrder: raise ValueError(f"order larger than {self.maxOrder}")
145
- floatCount += 2 + self.order[i] + self.nCoef[i]
146
- coefficientCount *= self.nCoef[i]
147
- if not(floatCount + self.nDep * coefficientCount <= self._maxFloats): raise ValueError("Spline to large to draw")
148
- if not "fillColor" in self.metadata:
149
- self.metadata["fillColor"] = np.array((0.0, 1.0, 0.0, 1.0), np.float32)
150
- if not "lineColor" in self.metadata:
151
- self.metadata["lineColor"] = np.array((0.0, 0.0, 0.0, 1.0) if self.nInd > 1 else (1.0, 1.0, 1.0, 1.0), np.float32)
152
- if not "options" in self.metadata:
153
- self.metadata["options"] = self.SHADED | self.BOUNDARY
154
- if not "animate" in self.metadata:
155
- self.metadata["animate"] = None
156
-
157
- def __str__(self):
158
- return self.metadata.get("Name", "[{0}, {1}]".format(self.coefs[0], self.coefs[1]))
159
-
160
- @staticmethod
161
- def make_drawable(spline):
162
- """
163
- Convert a `Spline` into a `DrawableSpline` that can be drawn in a `SplineOpenGLFrame`. Converts
164
- 1D splines into 3D curves, 2D splines into surfaces (y-axis hold amplitude), and 3D splines into solids.
165
-
166
- Spline surfaces and solids with more than 3 dependent variables will have their added dimensions rendered
167
- as colors (up to 6 dependent variables are supported).
168
-
169
- The drawable spline will share the original spline's metadata (metadata changes are shared).
170
- """
171
- if isinstance(spline, DrawableSpline):
172
- return spline
173
- if not(isinstance(spline, Spline)): raise ValueError("Invalid spline")
174
- if spline.nInd > 3: raise ValueError("Spline must have no more than 3 independent variables")
175
- if spline.nDep > 6: raise ValueError("Spline must have no more than 6 dependent variables")
176
-
177
- nDep = 3
178
- if spline.nInd >= 2 and spline.nDep > 3:
179
- nDep = 4 if spline.nDep == 4 else 6 # No nDep of 5
180
-
181
- knotList = [knots.astype(np.float32, copy=False) for knots in spline.knots]
182
- coefs = np.zeros((nDep, *spline.nCoef), np.float32)
183
- if spline.nInd == 1:
184
- if spline.nDep == 1:
185
- spline = spline.graph()
186
- coefs[0] = spline.coefs[0]
187
- coefs[1] = spline.coefs[1]
188
- else:
189
- coefs[:min(spline.nDep, 3)] = spline.coefs[:min(spline.nDep, 3)]
190
- elif spline.nInd == 2:
191
- if spline.nDep == 1:
192
- spline = spline.graph()
193
- coefs[0] = spline.coefs[0]
194
- coefs[1] = spline.coefs[2]
195
- coefs[2] = spline.coefs[1]
196
- else:
197
- coefs[:spline.nDep] = spline.coefs
198
- # For dimensions above three, rescale dependent variables to [0, 1].
199
- for i in range(3, spline.nDep):
200
- minCoef = coefs[i].min()
201
- rangeCoef = coefs[i].max() - minCoef
202
- if rangeCoef > 1.0e-8:
203
- coefs[i] = (coefs[i] - minCoef) / rangeCoef
204
- else:
205
- coefs[i] = max(0.0, min(1.0, minCoef))
206
- elif spline.nInd == 3:
207
- if spline.nDep == 1:
208
- spline = spline.graph()
209
- coefs[0] = spline.coefs[0]
210
- coefs[1] = spline.coefs[3]
211
- coefs[2] = spline.coefs[1]
212
- coefs[3] = spline.coefs[2]
213
- else:
214
- coefs[:spline.nDep] = spline.coefs
215
- # For dimensions above three, rescale dependent variables to [0, 1].
216
- for i in range(3, spline.nDep):
217
- minCoef = coefs[i].min()
218
- rangeCoef = coefs[i].max() - minCoef
219
- if rangeCoef > 1.0e-8:
220
- coefs[i] = (coefs[i] - minCoef) / rangeCoef
221
- else:
222
- coefs[i] = max(0.0, min(1.0, minCoef))
223
- else:
224
- raise ValueError("Can't convert to drawable spline.")
225
-
226
- drawable = DrawableSpline(spline.nInd, nDep, spline.order, spline.nCoef, knotList, coefs)
227
- drawable.metadata = spline.metadata # Make the original spline share its metadata with its drawable spline
228
- if not "fillColor" in drawable.metadata:
229
- drawable.metadata["fillColor"] = np.array((0.0, 1.0, 0.0, 1.0), np.float32)
230
- if not "lineColor" in drawable.metadata:
231
- drawable.metadata["lineColor"] = np.array((0.0, 0.0, 0.0, 1.0) if drawable.nInd > 1 else (1.0, 1.0, 1.0, 1.0), np.float32)
232
- if not "options" in drawable.metadata:
233
- drawable.metadata["options"] = drawable.SHADED | drawable.BOUNDARY
234
- if not "animate" in drawable.metadata:
235
- drawable.metadata["animate"] = None
236
- return drawable
237
-
238
- def _DrawPoints(self, frame, drawCoefficients):
239
- """
240
- Draw spline points for an nInd == 0 or order == 1 spline within a `SplineOpenGLFrame`. The frame will call this method for you.
241
- """
242
- glColor4fv(self.get_line_color())
243
- glBegin(GL_POINTS)
244
- if self.nInd == 0:
245
- glVertex3fv(drawCoefficients)
246
- else:
247
- for point in drawCoefficients:
248
- glVertex3fv(point)
249
- glEnd()
250
-
251
- def _DrawCurve(self, frame, drawCoefficients):
252
- """
253
- Draw a spline curve (nInd == 1) within a `SplineOpenGLFrame`. The frame will call this method for you.
254
- """
255
- if self.get_options() & self.HULL:
256
- glColor3f(0.0, 0.0, 1.0)
257
- glBegin(GL_LINE_STRIP)
258
- for point in drawCoefficients:
259
- glVertex3f(point[0], point[1], point[2])
260
- glEnd()
261
-
262
- program = frame.curveProgram
263
- glUseProgram(program.curveProgram)
264
- glUniform4fv(program.uCurveLineColor, 1, self.get_line_color())
265
- glBindBuffer(GL_TEXTURE_BUFFER, frame.splineDataBuffer)
266
- offset = 0
267
- size = 4 * 2
268
- glBufferSubData(GL_TEXTURE_BUFFER, offset, size, np.array((self.order[0], self.nCoef[0]), np.float32))
269
- offset += size
270
- size = 4 * len(self.knots[0])
271
- glBufferSubData(GL_TEXTURE_BUFFER, offset, size, self.knots[0])
272
- offset += size
273
- size = 3 * 4 * self.nCoef[0]
274
- drawCoefficients = drawCoefficients[..., :3]
275
- glBufferSubData(GL_TEXTURE_BUFFER, offset, size, drawCoefficients)
276
- glEnableVertexAttribArray(program.aCurveParameters)
277
- if frame.tessellationEnabled:
278
- glPatchParameteri(GL_PATCH_VERTICES, 1)
279
- glDrawArraysInstanced(GL_PATCHES, 0, 1, self.nCoef[0] - self.order[0] + 1)
280
- else:
281
- glDrawArraysInstanced(GL_POINTS, 0, 1, self.nCoef[0] - self.order[0] + 1)
282
- glFlush() # Old graphics card
283
- glDisableVertexAttribArray(program.aCurveParameters)
284
- glUseProgram(0)
285
-
286
- @staticmethod
287
- def _ConvertRGBToHSV(r, g, b, a):
288
- # Taken from http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
289
- K = 0.0
290
- if g < b:
291
- tmp = g
292
- g = b
293
- b = tmp
294
- K = -1.0
295
- if r < g:
296
- tmp = r
297
- r = g
298
- g = tmp
299
- K = -2.0 / 6.0 - K
300
- chroma = r - min(g, b)
301
- return np.array((abs(K + (g - b) / (6.0 * chroma + 1e-20)), chroma / (r + 1e-20), r, a), np.float32)
302
-
303
- def _DrawSurface(self, frame, drawCoefficients):
304
- """
305
- Draw a spline surface (nInd == 2) within a `SplineOpenGLFrame`. The frame will call this method for you.
306
- """
307
- if self.get_options() & self.HULL:
308
- glColor3f(0.0, 0.0, 1.0)
309
- for pointList in drawCoefficients:
310
- glBegin(GL_LINE_STRIP)
311
- for point in pointList:
312
- glVertex3f(point[0], point[1], point[2])
313
- glEnd()
314
-
315
- fillColor = self.get_fill_color()
316
- if self.nDep == 3:
317
- program = frame.surface3Program
318
- elif self.nDep == 4:
319
- program = frame.surface4Program
320
- fillColor = self._ConvertRGBToHSV(fillColor[0], fillColor[1], fillColor[2], fillColor[3])
321
- elif self.nDep == 6:
322
- program = frame.surface6Program
323
- else:
324
- raise ValueError("Can't draw surface.")
325
-
326
- useBlending = fillColor[3] < 1.0
327
- if useBlending:
328
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
329
- glEnable( GL_BLEND )
330
- glDisable( GL_DEPTH_TEST )
331
-
332
- glUseProgram(program.surfaceProgram)
333
- glUniform4fv(program.uSurfaceFillColor, 1, fillColor)
334
- glUniform4fv(program.uSurfaceLineColor, 1, self.get_line_color())
335
- glUniform1i(program.uSurfaceOptions, self.get_options())
336
- glBindBuffer(GL_TEXTURE_BUFFER, frame.splineDataBuffer)
337
- offset = 0
338
- size = 4 * 4
339
- glBufferSubData(GL_TEXTURE_BUFFER, offset, size, np.array((self.order[0], self.order[1], self.nCoef[0], self.nCoef[1]), np.float32))
340
- offset += size
341
- size = 4 * len(self.knots[0])
342
- glBufferSubData(GL_TEXTURE_BUFFER, offset, size, self.knots[0])
343
- offset += size
344
- size = 4 * len(self.knots[1])
345
- glBufferSubData(GL_TEXTURE_BUFFER, offset, size, self.knots[1])
346
- offset += size
347
- size = self.nDep * 4 * self.nCoef[0] * self.nCoef[1]
348
- glBufferSubData(GL_TEXTURE_BUFFER, offset, size, drawCoefficients)
349
- glEnableVertexAttribArray(program.aSurfaceParameters)
350
- if frame.tessellationEnabled:
351
- glPatchParameteri(GL_PATCH_VERTICES, 1)
352
- glDrawArraysInstanced(GL_PATCHES, 0, 1, (self.nCoef[0] - self.order[0] + 1) * (self.nCoef[1] - self.order[1] + 1))
353
- else:
354
- glDrawArraysInstanced(GL_POINTS, 0, 1, (self.nCoef[0] - self.order[0] + 1) * (self.nCoef[1] - self.order[1] + 1))
355
- glFlush() # Old graphics card
356
- glDisableVertexAttribArray(program.aSurfaceParameters)
357
- glUseProgram(0)
358
- if useBlending:
359
- glDisable( GL_BLEND )
360
- glEnable( GL_DEPTH_TEST )
361
-
362
- def _DrawSolid(self, frame, drawCoefficients):
363
- """
364
- Draw a spline solid (nInd == 3) within a `SplineOpenGLFrame`. The frame will call this method for you.
365
- """
366
- if self.get_options() & self.HULL:
367
- glColor3f(0.0, 0.0, 1.0)
368
- for pointSet in drawCoefficients:
369
- for pointList in pointSet:
370
- glBegin(GL_LINE_STRIP)
371
- for point in pointList:
372
- glVertex3f(point[0], point[1], point[2])
373
- glEnd()
374
-
375
- fillColor = self.get_fill_color().copy()
376
- lineColor = self.get_line_color().copy()
377
- if self.nDep == 3:
378
- program = frame.surface3Program
379
- elif self.nDep == 4:
380
- program = frame.surface4Program
381
- fillColor = self._ConvertRGBToHSV(fillColor[0], fillColor[1], fillColor[2], fillColor[3])
382
- elif self.nDep == 6:
383
- program = frame.surface6Program
384
- else:
385
- raise ValueError("Can't draw surface.")
386
- fillColor[3] *= 0.5
387
- lineColor[3] *= 0.5
388
-
389
- def _DrawBoundarySurface(axis, index):
390
- fullSlice = slice(None)
391
- if axis == 0:
392
- i1 = 1
393
- i2 = 2
394
- coefSlice = (fullSlice, fullSlice, index, fullSlice)
395
- elif axis == 1:
396
- i1 = 0
397
- i2 = 2
398
- coefSlice = (fullSlice, index, fullSlice, fullSlice)
399
- else:
400
- i1 = 0
401
- i2 = 1
402
- coefSlice = (index, fullSlice, fullSlice, fullSlice)
403
-
404
- glBindBuffer(GL_TEXTURE_BUFFER, frame.splineDataBuffer)
405
- offset = 0
406
- size = 4 * 4
407
- glBufferSubData(GL_TEXTURE_BUFFER, offset, size, np.array((self.order[i1], self.order[i2], self.nCoef[i1], self.nCoef[i2]), np.float32))
408
- offset += size
409
- size = 4 * len(self.knots[i1])
410
- glBufferSubData(GL_TEXTURE_BUFFER, offset, size, self.knots[i1])
411
- offset += size
412
- size = 4 * len(self.knots[i2])
413
- glBufferSubData(GL_TEXTURE_BUFFER, offset, size, self.knots[i2])
414
- offset += size
415
- size = self.nDep * 4 * self.nCoef[i1] * self.nCoef[i2]
416
- glBufferSubData(GL_TEXTURE_BUFFER, offset, size, drawCoefficients[coefSlice])
417
- glEnableVertexAttribArray(program.aSurfaceParameters)
418
- if frame.tessellationEnabled:
419
- glPatchParameteri(GL_PATCH_VERTICES, 1)
420
- glDrawArraysInstanced(GL_PATCHES, 0, 1, (self.nCoef[i1] - self.order[i1] + 1) * (self.nCoef[i2] - self.order[i2] + 1))
421
- else:
422
- glDrawArraysInstanced(GL_POINTS, 0, 1, (self.nCoef[i1] - self.order[i1] + 1) * (self.nCoef[i2] - self.order[i2] + 1))
423
- glFlush() # Old graphics card
424
- glDisableVertexAttribArray(program.aSurfaceParameters)
425
-
426
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
427
- glEnable( GL_BLEND )
428
- glDisable( GL_DEPTH_TEST )
429
- glUseProgram(program.surfaceProgram)
430
- glUniform4fv(program.uSurfaceFillColor, 1, fillColor)
431
- glUniform4fv(program.uSurfaceLineColor, 1, lineColor)
432
- glUniform1i(program.uSurfaceOptions, self.get_options())
433
-
434
- _DrawBoundarySurface(0, 0)
435
- _DrawBoundarySurface(0, -1)
436
- _DrawBoundarySurface(1, 0)
437
- _DrawBoundarySurface(1, -1)
438
- _DrawBoundarySurface(2, 0)
439
- _DrawBoundarySurface(2, -1)
440
-
441
- glUseProgram(0)
442
- glDisable( GL_BLEND )
443
- glEnable( GL_DEPTH_TEST )
444
-
445
- def _Draw(self, frame, transform):
446
- """
447
- Draw a spline within a `SplineOpenGLFrame`. The frame will call this method for you.
448
- """
449
- # Contract spline if it's animating.
450
- nInd = self.get_animate()
451
- if nInd is not None:
452
- uvw = self.nInd * [None]
453
- u1 = self.knots[nInd][self.order[nInd] - 1]
454
- u2 = self.knots[nInd][self.nCoef[nInd]]
455
- # Contraction value is set to cycle every 10 seconds (10000 ms).
456
- uvw[nInd] = u1 + 0.49999 * (u2 - u1) * (1.0 - np.cos(2.0 * np.pi * frame.frameCount * frame.MsPerFrame / 10000))
457
- self = self.contract(uvw)
458
-
459
- # Transform coefs by view transform.
460
- coefs = self.coefs.T
461
- drawCoefficients = np.empty(coefs.shape, np.float32)
462
- drawCoefficients[..., :3] = coefs[..., :3] @ transform[:3,:3] + transform[3,:3]
463
- drawCoefficients[..., 3:] = coefs[..., 3:]
464
-
465
- # Draw spline.
466
- if self.nInd == 0 or self.order[0] == 1:
467
- self._DrawPoints(frame, drawCoefficients)
468
- elif self.nInd == 1:
469
- self._DrawCurve(frame, drawCoefficients)
470
- elif self.nInd == 2:
471
- self._DrawSurface(frame, drawCoefficients)
472
- elif self.nInd == 3:
473
- self._DrawSolid(frame, drawCoefficients)
474
-
475
- def get_fill_color(self):
476
- """
477
- Gets the fill color of the spline (only useful for nInd >= 2).
478
-
479
- Returns
480
- -------
481
- fillColor : `numpy.array`
482
- Array of four floats (r, g, b, a) in the range [0, 1].
483
- """
484
- return self.metadata["fillColor"]
485
-
486
- def set_fill_color(self, r, g=None, b=None, a=None):
487
- """
488
- Set the fill color of the spline (only useful for nInd >= 2).
489
-
490
- Parameters
491
- ----------
492
- r : `float`, `int` or array-like of floats or ints
493
- The red value [0, 1] as a float, [0, 255] as an int, or the rgb or rgba value as floats or ints (default).
494
-
495
- g: `float` or `int`
496
- The green value [0, 1] as a float or [0, 255] as an int.
497
-
498
- b: `float` or `int`
499
- The blue value [0, 1] as a float or [0, 255] as an int.
500
-
501
- a: `float`, `int`, or None
502
- The alpha value [0, 1] as a float or [0, 255] as an int. If `None` then alpha is set to 1.
503
- """
504
- self.metadata["fillColor"] = _set_color(r, g, b, a)
505
-
506
- def get_line_color(self):
507
- """
508
- Gets the line color of the spline.
509
-
510
- Returns
511
- -------
512
- lineColor : `numpy.array`
513
- Array of four floats (r, g, b, a) in the range [0, 1].
514
- """
515
- return self.metadata["lineColor"]
516
-
517
- def set_line_color(self, r, g=None, b=None, a=None):
518
- """
519
- Set the line color of the spline.
520
-
521
- Parameters
522
- ----------
523
- r : `float`, `int` or array-like of floats or ints
524
- The red value [0, 1] as a float, [0, 255] as an int, or the rgb or rgba value as floats or ints (default).
525
-
526
- g: `float` or `int`
527
- The green value [0, 1] as a float or [0, 255] as an int.
528
-
529
- b: `float` or `int`
530
- The blue value [0, 1] as a float or [0, 255] as an int.
531
-
532
- a: `float`, `int`, or None
533
- The alpha value [0, 1] as a float or [0, 255] as an int. If `None` then alpha is set to 1.
534
- """
535
- self.metadata["lineColor"] = _set_color(r, g, b, a)
536
-
537
- def get_options(self):
538
- """
539
- Gets the draw options for the spline.
540
-
541
- Returns
542
- -------
543
- options : `int` bitwise or (`|`) of zero or more of the following values:
544
- * `DrawableSpline.HULL` Draw the convex hull of the spline (the coefficients). Off by default.
545
- * `DrawableSpline.SHADED` Draw the spline shaded (only useful for nInd >= 2). On by default.
546
- * `DrawableSpline.BOUNDARY` Draw the boundary of the spline in the line color (only useful for nInd >= 2). On by default.
547
- * `DrawableSpline.ISOPARMS` Draw the lines of constant knot values of the spline in the line color (only useful for nInd >= 2). Off by default.
548
- """
549
- return self.metadata["options"]
550
-
551
- def set_options(self, options):
552
- """
553
- Set the draw options for the spline.
554
-
555
- Parameters
556
- ----------
557
- options : `int` bitwise or (`|`) of zero or more of the following values:
558
- * `DrawableSpline.HULL` Draw the convex hull of the spline (the coefficients). Off by default.
559
- * `DrawableSpline.SHADED` Draw the spline shaded (only useful for nInd >= 2). On by default.
560
- * `DrawableSpline.BOUNDARY` Draw the boundary of the spline in the line color (only useful for nInd >= 2). On by default.
561
- * `DrawableSpline.ISOPARMS` Draw the lines of constant knot values of the spline in the line color (only useful for nInd >= 2). Off by default.
562
- """
563
- self.metadata["options"] = options
564
-
565
- def get_animate(self):
566
- """
567
- Get the independent variable that is animated (None if there is none).
568
-
569
- Returns
570
- -------
571
- animate : `int` or `None`
572
- The index of the independent variable that is animated (None is there is none).
573
- """
574
- return self.metadata["animate"]
575
-
576
- def set_animate(self, animate):
577
- """
578
- Set the independent variable that is animated (None if there is none).
579
-
580
- Parameters
581
- ----------
582
- animate : `int` or `None`
583
- The index of the independent variable that is animated (None is there is none).
584
- """
585
- self.metadata["animate"] = animate
@@ -1,15 +0,0 @@
1
- bspy/__init__.py,sha256=6COMVL3vEPGglirXvBWB9vadEMhj0tetOj7134im5wY,851
2
- bspy/_spline_domain.py,sha256=rES03UdvxB6yu_ccumcckLR0xX51C6Dv_-nK0wuTlGg,28689
3
- bspy/_spline_evaluation.py,sha256=rZLqruff8BT6MZdlfV5MBFzSnYuJgzgbpxk1W0mRHeI,7892
4
- bspy/_spline_fitting.py,sha256=P6rwnIdjjrC_tKqWgIIh5OHl48z04MJBT0QMh18Dvyk,31797
5
- bspy/_spline_intersection.py,sha256=ArdRkYMUc4JWRuj0CfhdGSWyBs_SBDnbvZtwb5Elo4U,40865
6
- bspy/_spline_operations.py,sha256=eHSRSd7ez6WrjtM-YlvKjn-LRcaRSObIdf9b8eV1chE,42898
7
- bspy/bspyApp.py,sha256=M7Uc3TL6GcuqwdWeTdQTH79yKdQ_eHD16ed3xWJipIg,18746
8
- bspy/drawableSpline.py,sha256=tM54Tk11qwGextRDCCkMn-NJUFp_XtlPkUK9X4Xxyyo,25076
9
- bspy/spline.py,sha256=clO9hxqrjImWDGW7dkDu_vqUGgLEKi5tYKlEVkM044A,84589
10
- bspy/splineOpenGLFrame.py,sha256=Fns8QjTiVX7jyolhwpty6RqoUE9RtPs8pHkDi1SlwFg,64643
11
- bspy-3.0.1.dist-info/LICENSE,sha256=nLfJULN68Jw6GfCJp4xeMksGuRdyWNdgEsZGjw2twig,1091
12
- bspy-3.0.1.dist-info/METADATA,sha256=gEk1OHK15MToVxRcDTeB_4igZzkBo5O39_9pAODUKo8,4688
13
- bspy-3.0.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
14
- bspy-3.0.1.dist-info/top_level.txt,sha256=fotZnJn6aCwgUbBEV3hslIko7Nw-eqtHLq2eyJLlFsY,5
15
- bspy-3.0.1.dist-info/RECORD,,
File without changes