forked from SINTEF/Splipy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic_classes.html
4402 lines (4125 loc) · 260 KB
/
basic_classes.html
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Basic classes — Splipy 1.1.0 documentation</title>
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Splipy 1.1.0 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="basic-classes">
<h1>Basic classes<a class="headerlink" href="#basic-classes" title="Permalink to this headline">¶</a></h1>
<div class="section" id="bsplinebasis">
<h2>BSplineBasis<a class="headerlink" href="#bsplinebasis" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="splipy.BSplineBasis">
<em class="property">class </em><code class="descclassname">splipy.</code><code class="descname">BSplineBasis</code><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a one-dimensional B-Spline basis.</p>
<p>BSplineBasis objects support basic arithmetic operators, which are
interpreted as acting on the parametric domain.</p>
<dl class="method">
<dt id="splipy.BSplineBasis.__getitem__">
<code class="descname">__getitem__</code><span class="sig-paren">(</span><em>i</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.__getitem__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.__getitem__" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the knot at a given index.</p>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.__init__">
<code class="descname">__init__</code><span class="sig-paren">(</span><em>order=2</em>, <em>knots=None</em>, <em>periodic=-1</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Construct a B-Spline basis with a given order and knot vector.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>order</strong> (<em>int</em>) – Spline order, i.e. one greater than the polynomial degree.</li>
<li><strong>knots</strong> (<em></em><em>[</em><em>float</em><em>]</em><em></em>) – Knot vector of non-decreasing components.
Defaults to open knot vector on domain [0,1].</li>
<li><strong>periodic</strong> (<em>int</em>) – Number of continuous derivatives at start and end.
–1 is not periodic, 0 is continuous, etc.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><strong>ValueError</strong> – for inapproriate knot vectors</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.__len__">
<code class="descname">__len__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.__len__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.__len__" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the number of knots in this basis.</p>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.clone">
<code class="descname">clone</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.clone"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.clone" title="Permalink to this definition">¶</a></dt>
<dd><p>Clone the object.</p>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.continuity">
<code class="descname">continuity</code><span class="sig-paren">(</span><em>knot</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.continuity"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.continuity" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the continuity of the basis functions at a given point.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><em>p</em>–<em>m</em>–1 at a knot with multiplicity <em>m</em>, or <code class="docutils literal"><span class="pre">inf</span></code>
between knots.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">int or float</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.end">
<code class="descname">end</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.end"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.end" title="Permalink to this definition">¶</a></dt>
<dd><p>End point of parametric domain. For open knot vectors, this is the
last knot.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Knot number <em>n</em>–<em>p</em>, where <em>p</em> is the spline order and <em>n</em> is
the number of knots</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">Float</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.evaluate">
<code class="descname">evaluate</code><span class="sig-paren">(</span><em>t</em>, <em>d=0</em>, <em>from_right=True</em>, <em>sparse=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.evaluate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.evaluate" title="Permalink to this definition">¶</a></dt>
<dd><p>Evaluate all basis functions in a given set of points.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>t</strong> (<em>float</em><em> or </em><em></em><em>[</em><em>float</em><em>]</em><em></em>) – The parametric coordinate(s) in which to evaluate</li>
<li><strong>d</strong> (<em>int</em>) – Number of derivatives to compute</li>
<li><strong>from_right</strong> (<em>bool</em>) – True if evaluation should be done in the limit
from above</li>
<li><strong>sparse</strong> (<em>bool</em>) – True if computed matrix should be returned as sparse</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A matrix <em>N[i,j]</em> of all basis functions <em>j</em> evaluated in all
points <em>i</em></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">numpy.array</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.greville">
<code class="descname">greville</code><span class="sig-paren">(</span><em>index=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.greville"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.greville" title="Permalink to this definition">¶</a></dt>
<dd><p>Fetch greville points, also known as knot averages:</p>
<div class="math">
\[\sum_{j=i+1}^{i+p-1} \frac{t_j}{p-1}\]</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">One, or all of the Greville points</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">[float] (if <em>index</em> is <code class="docutils literal"><span class="pre">None</span></code>) or float</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.insert_knot">
<code class="descname">insert_knot</code><span class="sig-paren">(</span><em>new_knot</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.insert_knot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.insert_knot" title="Permalink to this definition">¶</a></dt>
<dd><p>Inserts a knot in the knot vector.</p>
<p>The return value is a sparse matrix <em>C</em> (actually, a dense matrix with
lots of zeros), such that <em>N_new</em> = <em>N_old</em> x <em>C</em>, where <em>N</em> are row
vectors of basis functions.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>new_knot</strong> (<em>float</em>) – The parametric coordinate of the point to insert</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Transformation matrix <em>C</em></td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">numpy.array</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>ValueError</strong> – If the new knot is outside the domain</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.integrate">
<code class="descname">integrate</code><span class="sig-paren">(</span><em>t0</em>, <em>t1</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.integrate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.integrate" title="Permalink to this definition">¶</a></dt>
<dd><p>Integrate all basis functions over a given domain</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>t0</strong> (<em>float</em>) – The parametric starting point</li>
<li><strong>t1</strong> (<em>float</em>) – The parametric end point</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The integration of all functions over the input domain</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.knot_spans">
<code class="descname">knot_spans</code><span class="sig-paren">(</span><em>include_ghost_knots=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.knot_spans"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.knot_spans" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the set of unique knots in the knot vector.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>include_ghost_knots</strong> (<em>bool</em>) – if knots outside start/end are to be
included. These knots are used by periodic basis.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">List of unique knots</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">[float]</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.lower_order">
<code class="descname">lower_order</code><span class="sig-paren">(</span><em>amount</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.lower_order"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.lower_order" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a knot vector with lower order.</p>
<p>The continuity at the knots are kept unchanged by decreasing their
multiplicities.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">New knot vector</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">[float]</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><strong>TypeError</strong> – If <cite>amount</cite> is not an int</li>
<li><strong>ValueError</strong> – If <cite>amount</cite> is negative</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.make_periodic">
<code class="descname">make_periodic</code><span class="sig-paren">(</span><em>continuity</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.make_periodic"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.make_periodic" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a periodic basis with a given continuity.</p>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.matches">
<code class="descname">matches</code><span class="sig-paren">(</span><em>bspline</em>, <em>reverse=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.matches"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.matches" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if this basis equals another basis, when disregarding
scaling and translation of the knots vector. I.e. will this basis and
<em>bspline</em> yield the same spline object if paired with identical
controlpoints</p>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.normalize">
<code class="descname">normalize</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.normalize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.normalize" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the parametric domain to be (0,1).</p>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.num_functions">
<code class="descname">num_functions</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.num_functions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.num_functions" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the number of basis functions in the basis.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">This is different from <a class="reference internal" href="#splipy.BSplineBasis.__len__" title="splipy.BSplineBasis.__len__"><code class="xref py py-func docutils literal"><span class="pre">splipy.BSplineBasis.__len__()</span></code></a>.</p>
</div>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.raise_order">
<code class="descname">raise_order</code><span class="sig-paren">(</span><em>amount</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.raise_order"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.raise_order" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a knot vector with higher order.</p>
<p>The continuity at the knots are kept unchanged by increasing their
multiplicities.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">New knot vector</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">[float]</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><strong>TypeError</strong> – If <cite>amount</cite> is not an int</li>
<li><strong>ValueError</strong> – If <cite>amount</cite> is negative</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.reparam">
<code class="descname">reparam</code><span class="sig-paren">(</span><em>start=0</em>, <em>end=1</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.reparam"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.reparam" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the parametric domain to be (start, end)</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><strong>ValueError</strong> – If <em>end</em> ≤ <em>start</em></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.reverse">
<code class="descname">reverse</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.reverse"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.reverse" title="Permalink to this definition">¶</a></dt>
<dd><p>Reverse parametric domain, keeping start/end values unchanged.</p>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.roll">
<code class="descname">roll</code><span class="sig-paren">(</span><em>new_start</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.roll"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.roll" title="Permalink to this definition">¶</a></dt>
<dd><p>rotate a periodic knot vector by setting a new starting index.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>new_start</strong> (<em>int</em>) – The index of to the new first knot</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.BSplineBasis.start">
<code class="descname">start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/BSplineBasis.html#BSplineBasis.start"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.BSplineBasis.start" title="Permalink to this definition">¶</a></dt>
<dd><p>Start point of parametric domain. For open knot vectors, this is the
first knot.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Knot number <em>p</em>, where <em>p</em> is the spline order</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">float</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="splineobject">
<h2>SplineObject<a class="headerlink" href="#splineobject" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="splipy.SplineObject">
<em class="property">class </em><code class="descclassname">splipy.</code><code class="descname">SplineObject</code><span class="sig-paren">(</span><em>bases=None</em>, <em>controlpoints=None</em>, <em>rational=False</em>, <em>raw=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject" title="Permalink to this definition">¶</a></dt>
<dd><p>Master class for spline objects with arbitrary dimensions.</p>
<p>This class should be subclassed instead of used directly.</p>
<p>All SplineObjects support basic arithmetic operators, which are interpreted
as translation and scaling. In-place operators (e.g. <code class="docutils literal"><span class="pre">+=</span></code>) mutate the
object, while infix operators (e.g. <code class="docutils literal"><span class="pre">+</span></code>) create new objects.</p>
<dl class="method">
<dt id="splipy.SplineObject.__init__">
<code class="descname">__init__</code><span class="sig-paren">(</span><em>bases=None</em>, <em>controlpoints=None</em>, <em>rational=False</em>, <em>raw=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Construct a spline object with the given bases and control points.</p>
<p>The default is to create a linear one-element mapping from and to the
unit (hyper)cube.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>bases</strong> (<em></em><em>[</em><a class="reference internal" href="#splipy.BSplineBasis" title="splipy.BSplineBasis"><em>BSplineBasis</em></a><em>]</em><em></em>) – The basis of each parameter direction</li>
<li><strong>controlpoints</strong> (<em>array-like</em>) – An <em>n1</em> × <em>n2</em> × ... × <em>d</em> matrix of
control points</li>
<li><strong>rational</strong> (<em>bool</em>) – Whether the object is rational (in which case the
control points are interpreted as pre-multiplied with the weight,
which is the last coordinate)</li>
<li><strong>raw</strong> (<em>bool</em>) – If True, skip any control point reordering.
(For internal use.)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.bounding_box">
<code class="descname">bounding_box</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.bounding_box"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.bounding_box" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the bounding box of a spline object, computed from the
control-point values. Could be inaccurate for rational splines.</p>
<p>Returns the minima and maxima for each direction:
[(xmin, xmax), (ymin, ymax), ...]</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Bounding box</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">[(float)]</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.center">
<code class="descname">center</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.center"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.center" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the center of the domain</p>
<p>For curves this will return <span class="math">\((\tilde{x}, \tilde{y},...)\)</span>, where</p>
<div class="math">
\[\tilde{x} = \frac{1}{L} \int_{t_0}^{t_1} x(t) \; dt \]</div>
<p>and <span class="math">\(L=t_1-t_0\)</span> is the length of the parametric domain <span class="math">\([t_0,t_1]\)</span>.</p>
<p>For surfaces this will return <span class="math">\((\tilde{x}, \tilde{y},...)\)</span>, where</p>
<div class="math">
\[\tilde{x} = \frac{1}{A} \int_{v_0}^{v_1} \int_{u_0}^{u_1} x(u,v) \; du \; dv\]</div>
<p>and <span class="math">\(A=(u_1-u_0)(v_1-v_0)\)</span> is the area of the parametric domain <span class="math">\([u_0,u_1]\times[v_0,v_1]\)</span>.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">For rational splines, this will integrate in projective
coordinates, then project the centerpoint. This is as opposed to
integrating the rational functions <span class="math">\(\frac{N_i(t)w_i}{\sum_j
N_j(t)w_j}\)</span>.</p>
</div>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.clone">
<code class="descname">clone</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.clone"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.clone" title="Permalink to this definition">¶</a></dt>
<dd><p>Clone the object.</p>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.corners">
<code class="descname">corners</code><span class="sig-paren">(</span><em>order='C'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.corners"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.corners" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the corner control points.</p>
<p>The <cite>order</cite> parameter determines which order to use, either <code class="docutils literal"><span class="pre">'F'</span></code> or
<code class="docutils literal"><span class="pre">'C'</span></code>, for row-major or column-major ordering. E.g. for a volume, in
parametric coordinates,</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">'C'</span></code> gives (0,0,0), (1,0,0), (0,1,0), (1,1,0), (0,0,1), etc.</li>
<li><code class="docutils literal"><span class="pre">'F'</span></code> gives (0,0,0), (0,0,1), (0,1,0), (0,1,1), (1,0,0), etc.</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>order</strong> (<em>str</em>) – The ordering to use</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Corners</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">np.array</td>
</tr>
</tbody>
</table>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">For rational splines, this will return the corners in
projective coordinates, including weights.</p>
</div>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.derivative">
<code class="descname">derivative</code><span class="sig-paren">(</span><em>*params</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.derivative"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.derivative" title="Permalink to this definition">¶</a></dt>
<dd><p>Evaluate the derivative of the object at the given parametric values.</p>
<p>If <em>tensor</em> is true, evaluation will take place on a tensor product
grid, i.e. it will return an <em>n1</em> × <em>n2</em> × ... × <em>dim</em> array, where
<em>ni</em> is the number of evaluation points in direction <em>i</em>, and <em>dim</em> is
the physical dimension of the object.</p>
<p>If <em>tensor</em> is false, there must be an equal number <em>n</em> of evaluation
points in all directions, and the return value will be an <em>n</em> × <em>dim</em>
array.</p>
<p>If there is only one evaluation point, a vector of length <em>dim</em> is
returned instead.</p>
<p>Examples:</p>
<div class="code python highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Tangent of curve at single point</span>
<span class="n">curve</span><span class="o">.</span><span class="n">derivative</span><span class="p">(</span><span class="mf">1.0</span><span class="p">)</span>
<span class="c1"># Double derivative of curve at single point:</span>
<span class="n">curve</span><span class="o">.</span><span class="n">derivative</span><span class="p">(</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">d</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
<span class="c1"># Third derivative of curve at several points:</span>
<span class="n">curve</span><span class="o">.</span><span class="n">derivative</span><span class="p">([</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">,</span> <span class="mf">2.0</span><span class="p">],</span> <span class="n">d</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
<span class="c1"># Tangents of surface:</span>
<span class="n">surface</span><span class="o">.</span><span class="n">derivative</span><span class="p">(</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.7</span><span class="p">,</span> <span class="n">d</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">))</span>
<span class="n">surface</span><span class="o">.</span><span class="n">derivative</span><span class="p">(</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.7</span><span class="p">,</span> <span class="n">d</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="c1"># Cross-derivative of surface:</span>
<span class="n">surface</span><span class="o">.</span><span class="n">derivative</span><span class="p">(</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.7</span><span class="p">,</span> <span class="n">d</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>u</strong><strong>,</strong><strong>v</strong><strong>,</strong><strong>..</strong> (<em>float</em><em> or </em><em></em><em>[</em><em>float</em><em>]</em><em></em>) – Parametric coordinates in which to evaluate</li>
<li><strong>d</strong> (<em></em><em>(</em><em>int</em><em>)</em><em></em>) – Order of derivative to compute</li>
<li><strong>above</strong> (<em></em><em>(</em><em>bool</em><em>)</em><em></em>) – Evaluation in the limit from above</li>
<li><strong>tensor</strong> (<em>bool</em>) – Whether to evaluate on a tensor product grid</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Derivatives</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">numpy.array</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.end">
<code class="descname">end</code><span class="sig-paren">(</span><em>direction=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.end"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.end" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the end of the parametric domain.</p>
<p>If <cite>direction</cite> is given, returns the end of that direction, as a float.
If it is not given, returns the end of all directions, as a tuple.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>direction</strong> (<em>int</em>) – Direction in which to get the end.</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>ValueError</strong> – For invalid direction</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.evaluate">
<code class="descname">evaluate</code><span class="sig-paren">(</span><em>*params</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.evaluate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.evaluate" title="Permalink to this definition">¶</a></dt>
<dd><p>Evaluate the object at given parametric values.</p>
<p>If <em>tensor</em> is true, evaluation will take place on a tensor product
grid, i.e. it will return an <em>n1</em> × <em>n2</em> × ... × <em>dim</em> array, where
<em>ni</em> is the number of evaluation points in direction <em>i</em>, and <em>dim</em> is
the physical dimension of the object.</p>
<p>If <em>tensor</em> is false, there must be an equal number <em>n</em> of evaluation
points in all directions, and the return value will be an <em>n</em> × <em>dim</em>
array.</p>
<p>If there is only one evaluation point, a vector of length <em>dim</em> is
returned instead.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>u</strong><strong>,</strong><strong>v</strong><strong>,</strong><strong>..</strong> (<em>float</em><em> or </em><em></em><em>[</em><em>float</em><em>]</em><em></em>) – Parametric coordinates in which to evaluate</li>
<li><strong>tensor</strong> (<em>bool</em>) – Whether to evaluate on a tensor product grid</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Geometry coordinates</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">numpy.array</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.force_rational">
<code class="descname">force_rational</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.force_rational"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.force_rational" title="Permalink to this definition">¶</a></dt>
<dd><p>Force a rational representation of the object.</p>
<p>The weights of a non-rational object will be set to 1.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">self</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.get_derivative_spline">
<code class="descname">get_derivative_spline</code><span class="sig-paren">(</span><em>direction=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.get_derivative_spline"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.get_derivative_spline" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the controlpoints associated with the derivative spline object</p>
<p>If <cite>direction</cite> is given, only the derivatives in that direction are
returned.</p>
<p>If <cite>direction</cite> is not given, this function returns a tuple of all
partial derivatives</p>
<div class="code python highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Create a 4x4 element cubic spline surface</span>
<span class="n">surf</span> <span class="o">=</span> <span class="n">Surface</span><span class="p">()</span>
<span class="n">surf</span><span class="o">.</span><span class="n">raise_order</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span>
<span class="n">surf</span><span class="o">.</span><span class="n">refine</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">)</span>
<span class="n">surf</span><span class="p">[</span><span class="mi">1</span><span class="p">:</span><span class="mi">4</span><span class="p">,</span><span class="mi">1</span><span class="p">:</span><span class="mi">4</span><span class="p">,:]</span> <span class="o">+=</span> <span class="mf">0.1</span> <span class="c1"># make the surface non-trivial by moving controlpoints</span>
<span class="c1"># Create the derivative surface</span>
<span class="n">du</span> <span class="o">=</span> <span class="n">surf</span><span class="o">.</span><span class="n">get_derivative_spline</span><span class="p">(</span><span class="n">direction</span><span class="o">=</span><span class="s1">'u'</span><span class="p">)</span>
<span class="c1"># evaluation is identical</span>
<span class="nb">print</span><span class="p">(</span><span class="n">du</span><span class="o">.</span><span class="n">evaluate</span><span class="p">(</span><span class="mf">0.3</span><span class="p">,</span> <span class="mf">0.4</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">surf</span><span class="o">.</span><span class="n">derivative</span><span class="p">(</span><span class="mf">0.3</span><span class="p">,</span> <span class="mf">0.4</span><span class="p">,</span> <span class="n">d</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">)))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">surf</span><span class="o">.</span><span class="n">order</span><span class="p">())</span> <span class="c1"># prints (3,3)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">du</span><span class="o">.</span><span class="n">order</span><span class="p">())</span> <span class="c1"># prints (2,3)</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>direction</strong> (<em>int</em>) – The tangential direction</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Derivative spline</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#splipy.SplineObject" title="splipy.SplineObject">SplineObject</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.insert_knot">
<code class="descname">insert_knot</code><span class="sig-paren">(</span><em>knot</em>, <em>direction=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.insert_knot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.insert_knot" title="Permalink to this definition">¶</a></dt>
<dd><p>Insert a new knot into the spline.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>direction</strong> (<em>int</em>) – The direction to insert in</li>
<li><strong>knot</strong> (<em>float</em><em> or </em><em></em><em>[</em><em>float</em><em>]</em><em></em>) – The new knot(s) to insert</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><strong>ValueError</strong> – For invalid direction</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">self</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.knots">
<code class="descname">knots</code><span class="sig-paren">(</span><em>direction=None</em>, <em>with_multiplicities=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.knots"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.knots" title="Permalink to this definition">¶</a></dt>
<dd><p>Return knots vector</p>
<p>If <cite>direction</cite> is given, returns the knots in that direction, as a
list. If it is not given, returns the knots of all directions, as a
tuple.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>direction</strong> (<em>int</em>) – Direction in which to get the knots.</li>
<li><strong>with_multiplicities</strong> (<em>bool</em>) – If true, return knots with
multiplicities (i.e. repeated).</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><strong>ValueError</strong> – For invalid direction</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.lower_order">
<code class="descname">lower_order</code><span class="sig-paren">(</span><em>*lowers</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.lower_order"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.lower_order" title="Permalink to this definition">¶</a></dt>
<dd><p>Lower the polynomial order of the object. If only one argument is
given, the order is lowered equally over all directions.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>u</strong><strong>,</strong><strong>v</strong><strong>,</strong><strong>..</strong> (<em>int</em>) – Number of times to lower the order in a given
direction.</td>
</tr>
<tr class="field-even field"><th class="field-name" colspan="2">Return SplineObject:</th></tr>
<tr class="field-even field"><td> </td><td class="field-body">Approximation of the current object on a lower
order basis</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.lower_periodic">
<code class="descname">lower_periodic</code><span class="sig-paren">(</span><em>periodic</em>, <em>direction=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.lower_periodic"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.lower_periodic" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the periodicity of the spline object in the given direction,
keeping the geometry unchanged.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>periodic</strong> (<em>int</em>) – new periodicity, i.e. the basis is C^k over the start/end</li>
<li><strong>direction</strong> (<em>int</em>) – the parametric direction of the basis to modify</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">self</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.make_periodic">
<code class="descname">make_periodic</code><span class="sig-paren">(</span><em>continuity=None</em>, <em>direction=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.make_periodic"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.make_periodic" title="Permalink to this definition">¶</a></dt>
<dd><p>Make the spline object periodic in a given parametric direction.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>continuity</strong> (<em>int</em>) – The continuity along the boundary (default max).</li>
<li><strong>direction</strong> (<em>int</em>) – The direction to ensure continuity in.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="classmethod">
<dt id="splipy.SplineObject.make_splines_compatible">
<em class="property">classmethod </em><code class="descname">make_splines_compatible</code><span class="sig-paren">(</span><em>spline1</em>, <em>spline2</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.make_splines_compatible"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.make_splines_compatible" title="Permalink to this definition">¶</a></dt>
<dd><p>Ensure that two splines are compatible.</p>
<p>This will manipulate one or both to ensure that they are both rational
or nonrational, and that they lie in the same physical space.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>spline1</strong> (<a class="reference internal" href="#splipy.SplineObject" title="splipy.SplineObject"><em>SplineObject</em></a>) – The first spline</li>
<li><strong>spline2</strong> (<a class="reference internal" href="#splipy.SplineObject" title="splipy.SplineObject"><em>SplineObject</em></a>) – The second spline</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="classmethod">
<dt id="splipy.SplineObject.make_splines_identical">
<em class="property">classmethod </em><code class="descname">make_splines_identical</code><span class="sig-paren">(</span><em>spline1</em>, <em>spline2</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.make_splines_identical"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.make_splines_identical" title="Permalink to this definition">¶</a></dt>
<dd><p>Ensure that two splines have identical discretization.</p>
<p>This will first make them compatible (see
<code class="xref py py-func docutils literal"><span class="pre">splipy.SplineObject.make_curves_compatible()</span></code>), reparametrize them, and
possibly raise the order and insert knots as required.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>spline1</strong> (<a class="reference internal" href="#splipy.SplineObject" title="splipy.SplineObject"><em>SplineObject</em></a>) – The first spline</li>
<li><strong>spline2</strong> (<a class="reference internal" href="#splipy.SplineObject" title="splipy.SplineObject"><em>SplineObject</em></a>) – The second spline</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.mirror">
<code class="descname">mirror</code><span class="sig-paren">(</span><em>normal</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.mirror"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.mirror" title="Permalink to this definition">¶</a></dt>
<dd><p>Mirror the object around a plane through the origin.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>normal</strong> (<em>array-like</em>) – The plane normal to mirror about.</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>RuntimeError</strong> – If the physical dimension is not 2 or 3</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">self</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.order">
<code class="descname">order</code><span class="sig-paren">(</span><em>direction=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.order"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.order" title="Permalink to this definition">¶</a></dt>
<dd><p>Return polynomial order (degree + 1).</p>
<p>If <cite>direction</cite> is given, returns the order of that direction, as an
int. If it is not given, returns the order of all directions, as a
tuple.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>direction</strong> (<em>int</em>) – Direction in which to get the order.</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>ValueError</strong> – For invalid direction</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="splipy.SplineObject.pardim">
<code class="descname">pardim</code><a class="headerlink" href="#splipy.SplineObject.pardim" title="Permalink to this definition">¶</a></dt>
<dd><p>The number of parametric dimensions: 1 for curves, 2 for surfaces, 3
for volumes, etc.</p>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.periodic">
<code class="descname">periodic</code><span class="sig-paren">(</span><em>direction=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.periodic"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.periodic" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns true if the spline object is periodic in the given parametric direction</p>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.project">
<code class="descname">project</code><span class="sig-paren">(</span><em>plane</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.project"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.project" title="Permalink to this definition">¶</a></dt>
<dd><p>Projects the geometry onto a plane or axis.</p>
<ul class="simple">
<li><cite>project(‘xy’)</cite> will project the object onto the <em>xy</em> plane, setting
all <em>z</em> components to zero.</li>
<li><cite>project(‘y’)</cite> will project the object onto the <em>y</em> axis, setting all
<em>x</em> and <em>z</em> components to zero.</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>plane</strong> (<em>string</em>) – Any combination of ‘x’, ‘y’ and ‘z’</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">self</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.raise_order">
<code class="descname">raise_order</code><span class="sig-paren">(</span><em>*raises</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.raise_order"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.raise_order" title="Permalink to this definition">¶</a></dt>
<dd><p>Raise the polynomial order of the object. If only one argument is
given, the order is raised equally over all directions.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>u</strong><strong>,</strong><strong>v</strong><strong>,</strong><strong>..</strong> (<em>int</em>) – Number of times to raise the order in a given
direction.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">self</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.refine">
<code class="descname">refine</code><span class="sig-paren">(</span><em>*ns</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.refine"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.refine" title="Permalink to this definition">¶</a></dt>
<dd><p>Enrich the spline space by inserting knots into each existing knot
span.</p>
<p>This method supports three different usage patterns:</p>
<div class="code python highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Refine each direction by a factor n</span>
<span class="n">obj</span><span class="o">.</span><span class="n">refine</span><span class="p">(</span><span class="n">n</span><span class="p">)</span>
<span class="c1"># Refine a single direction by a factor n</span>
<span class="n">obj</span><span class="o">.</span><span class="n">refine</span><span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="n">direction</span><span class="o">=</span><span class="s1">'v'</span><span class="p">)</span>
<span class="c1"># Refine all directions by given factors</span>
<span class="n">obj</span><span class="o">.</span><span class="n">refine</span><span class="p">(</span><span class="n">nu</span><span class="p">,</span> <span class="n">nv</span><span class="p">,</span> <span class="o">...</span><span class="p">)</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>nu</strong><strong>,</strong><strong>nv</strong><strong>,</strong><strong>..</strong> (<em>int</em>) – Number of new knots to insert into each span</li>
<li><strong>direction</strong> (<em>int</em>) – Direction to refine in</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">self</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.reparam">
<code class="descname">reparam</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.reparam"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.reparam" title="Permalink to this definition">¶</a></dt>
<dd><p>Redefine the parametric domain. This function accepts two calling
conventions:</p>
<p><cite>reparametrize(u, v, ...)</cite> reparametrizes each direction to the domains
given by the tuples <em>u</em>, <em>v</em>, etc. It is equivalent to calling
<cite>reparametrize(u[0], u[1])</cite> on each basis. The default domain for
directions not given is (0,1). In particular, if no arguments are
given, the new parametric domain will be the unit (hyper)cube.</p>
<p><cite>reparametrize(u, direction=d)</cite> reparametrizes just the direction given
by <em>d</em> and leaves the others untouched.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>u</strong><strong>, </strong><strong>v</strong><strong>, </strong><strong>..</strong> (<em>tuple</em>) – New parametric domains, default to (0,1)</li>
<li><strong>direction</strong> (<em>int</em>) – The direction to reparametrize</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">self</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.reverse">
<code class="descname">reverse</code><span class="sig-paren">(</span><em>direction=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.reverse"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.reverse" title="Permalink to this definition">¶</a></dt>
<dd><p>Swap the direction of a parameter by making it go in the reverse
direction. The parametric domain remains unchanged.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>direction</strong> (<em>int</em>) – The direction to flip.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">self</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.rotate">
<code class="descname">rotate</code><span class="sig-paren">(</span><em>theta</em>, <em>normal=(0</em>, <em>0</em>, <em>1)</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/splipy/SplineObject.html#SplineObject.rotate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#splipy.SplineObject.rotate" title="Permalink to this definition">¶</a></dt>
<dd><p>Rotate the object around an axis.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>theta</strong> (<em>float</em>) – Angle to rotate about, measured in radians</li>
<li><strong>normal</strong> (<em>array-like</em>) – The normal axis (if 3D) to rotate about</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><strong>RuntimeError</strong> – If the physical dimension is not 2 or 3</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">self</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="splipy.SplineObject.scale">