@@ -262,6 +262,88 @@ tape( 'the function applies a plane rotation (sx=-1, sy=-2)', function test( t )
262262 t . end ( ) ;
263263} ) ;
264264
265+ tape ( 'the function applies a plane rotation' , function test ( t ) {
266+ var param ;
267+ var xe ;
268+ var ye ;
269+ var x ;
270+ var y ;
271+
272+ x = new Float32Array ( [
273+ 1.0 , // 0
274+ 2.0 ,
275+ 3.0 , // 1
276+ 4.0 ,
277+ 5.0 // 2
278+ ] ) ;
279+ y = new Float32Array ( [
280+ 6.0 , // 0
281+ 7.0 ,
282+ 8.0 , // 1
283+ 9.0 ,
284+ 10.0 // 2
285+ ] ) ;
286+ param = new Float32Array ( [ - 1.0 , 0.0 , 2.0 , - 3.0 , 0.0 ] ) ;
287+
288+ srotm ( 3 , x , 2 , 0 , y , 2 , 0 , param ) ;
289+
290+ xe = new Float32Array ( [
291+ - 18.0 , // 0
292+ 2.0 ,
293+ - 24.0 , // 1
294+ 4.0 ,
295+ - 30.0 // 2
296+ ] ) ;
297+ ye = new Float32Array ( [
298+ 2.0 , // 0
299+ 7.0 ,
300+ 6.0 , // 1
301+ 9.0 ,
302+ 10.0 // 2
303+ ] ) ;
304+
305+ isApprox ( t , x , xe , 1.0 ) ;
306+ isApprox ( t , y , ye , 1.0 ) ;
307+
308+ x = new Float32Array ( [
309+ 1.0 , // 0
310+ 2.0 ,
311+ 3.0 ,
312+ 4.0 , // 1
313+ 5.0
314+ ] ) ;
315+ y = new Float32Array ( [
316+ 6.0 , // 0
317+ 7.0 ,
318+ 8.0 ,
319+ 9.0 , // 1
320+ 10.0
321+ ] ) ;
322+ param = new Float32Array ( [ 1.0 , 0.0 , 2.0 , 3.0 , 0.0 ] ) ;
323+
324+ srotm ( 2 , x , 3 , 0 , y , 3 , 0 , param ) ;
325+
326+ xe = new Float32Array ( [
327+ 6.0 , // 0
328+ 2.0 ,
329+ 3.0 ,
330+ 9.0 , // 1
331+ 5.0
332+ ] ) ;
333+ ye = new Float32Array ( [
334+ - 1.0 , // 0
335+ 7.0 ,
336+ 8.0 ,
337+ - 4.0 , // 1
338+ 10.0
339+ ] ) ;
340+
341+ isApprox ( t , x , xe , 1.0 ) ;
342+ isApprox ( t , y , ye , 1.0 ) ;
343+
344+ t . end ( ) ;
345+ } ) ;
346+
265347tape ( 'the function supports an `x` stride' , function test ( t ) {
266348 var param ;
267349 var xe ;
@@ -306,6 +388,42 @@ tape( 'the function supports an `x` stride', function test( t ) {
306388 isApprox ( t , x , xe , 2.0 ) ;
307389 isApprox ( t , y , ye , 2.0 ) ;
308390
391+ x = new Float32Array ( [
392+ 1.0 , // 0
393+ 2.0 ,
394+ 3.0 ,
395+ 4.0 , // 1
396+ 5.0
397+ ] ) ;
398+ y = new Float32Array ( [
399+ 6.0 , // 0
400+ 7.0 , // 1
401+ 8.0 ,
402+ 9.0 ,
403+ 10.0
404+ ] ) ;
405+ param = new Float32Array ( [ - 1.0 , 0.0 , 2.0 , - 3.0 , 0.0 ] ) ;
406+
407+ srotm ( 2 , x , 3 , 0 , y , 1 , 0 , param ) ;
408+
409+ xe = new Float32Array ( [
410+ - 18.0 , // 0
411+ 2.0 ,
412+ 3.0 ,
413+ - 21.0 , // 1
414+ 5.0
415+ ] ) ;
416+ ye = new Float32Array ( [
417+ 2.0 , // 0
418+ 8.0 , // 1
419+ 8.0 ,
420+ 9.0 ,
421+ 10.0
422+ ] ) ;
423+
424+ isApprox ( t , x , xe , 1.0 ) ;
425+ isApprox ( t , y , ye , 1.0 ) ;
426+
309427 t . end ( ) ;
310428} ) ;
311429
@@ -341,6 +459,78 @@ tape( 'the function supports an `x` offset', function test( t ) {
341459 isApprox ( t , x , xe , 2.0 ) ;
342460 isApprox ( t , y , ye , 2.0 ) ;
343461
462+ x = new Float32Array ( [
463+ 1.0 , // 1
464+ 2.0 ,
465+ 3.0 , // 0
466+ 4.0 ,
467+ 5.0
468+ ] ) ;
469+ y = new Float32Array ( [
470+ 6.0 , // 0
471+ 7.0 , // 1
472+ 8.0 ,
473+ 9.0 ,
474+ 10.0
475+ ] ) ;
476+ param = new Float32Array ( [ - 1.0 , 0.0 , 2.0 , - 3.0 , 0.0 ] ) ;
477+
478+ srotm ( 2 , x , - 2 , 2 , y , 1 , 0 , param ) ;
479+
480+ xe = new Float32Array ( [
481+ - 21.0 , // 1
482+ 2.0 ,
483+ - 18.0 , // 0
484+ 4.0 ,
485+ 5.0
486+ ] ) ;
487+ ye = new Float32Array ( [
488+ 6.0 , // 0
489+ 2.0 , // 1
490+ 8.0 ,
491+ 9.0 ,
492+ 10.0
493+ ] ) ;
494+
495+ isApprox ( t , x , xe , 2.0 ) ;
496+ isApprox ( t , y , ye , 2.0 ) ;
497+
498+ x = new Float32Array ( [
499+ 1.0 , // 2
500+ 2.0 ,
501+ 3.0 , // 1
502+ 4.0 ,
503+ 5.0 // 0
504+ ] ) ;
505+ y = new Float32Array ( [
506+ 6.0 , // 0
507+ 7.0 , // 1
508+ 8.0 , // 2
509+ 9.0 ,
510+ 10.0
511+ ] ) ;
512+ param = new Float32Array ( [ 1.0 , 0.0 , 2.0 , - 3.0 , 0.0 ] ) ;
513+
514+ srotm ( 3 , x , - 2 , 4 , y , 1 , 0 , param ) ;
515+
516+ xe = new Float32Array ( [
517+ 8.0 , // 2
518+ 2.0 ,
519+ 7.0 , // 1
520+ 4.0 ,
521+ 6.0 // 0
522+ ] ) ;
523+ ye = new Float32Array ( [
524+ - 5.0 , // 0
525+ - 3.0 , // 1
526+ - 1.0 , // 2
527+ 9.0 ,
528+ 10.0
529+ ] ) ;
530+
531+ isApprox ( t , x , xe , 2.0 ) ;
532+ isApprox ( t , y , ye , 2.0 ) ;
533+
344534 t . end ( ) ;
345535} ) ;
346536
@@ -384,8 +574,44 @@ tape( 'the function supports a `y` stride', function test( t ) {
384574 16.0 // 2
385575 ] ) ;
386576
387- t . deepEqual ( x , xe , 'returns expected value' ) ;
388- t . deepEqual ( y , ye , 'returns expected value' ) ;
577+ isApprox ( t , x , xe , 1.0 ) ;
578+ isApprox ( t , y , ye , 1.0 ) ;
579+
580+ x = new Float32Array ( [
581+ 1.0 , // 0
582+ 2.0 , // 1
583+ 3.0 ,
584+ 4.0 ,
585+ 5.0
586+ ] ) ;
587+ y = new Float32Array ( [
588+ 6.0 , // 0
589+ 7.0 ,
590+ 8.0 ,
591+ 9.0 , // 1
592+ 10.0
593+ ] ) ;
594+ param = new Float32Array ( [ - 1.0 , 0.0 , 2.0 , - 3.0 , 0.0 ] ) ;
595+
596+ srotm ( 2 , x , 1 , 0 , y , 3 , 0 , param ) ;
597+
598+ xe = new Float32Array ( [
599+ - 18.0 , // 0
600+ - 27.0 , // 1
601+ 3.0 ,
602+ 4.0 ,
603+ 5.0
604+ ] ) ;
605+ ye = new Float32Array ( [
606+ 2.0 , // 0
607+ 7.0 ,
608+ 8.0 ,
609+ 4.0 , // 1
610+ 10.0
611+ ] ) ;
612+
613+ isApprox ( t , x , xe , 1.0 ) ;
614+ isApprox ( t , y , ye , 1.0 ) ;
389615
390616 t . end ( ) ;
391617} ) ;
@@ -422,6 +648,78 @@ tape( 'the function supports a `y` offset', function test( t ) {
422648 isApprox ( t , x , xe , 2.0 ) ;
423649 isApprox ( t , y , ye , 2.0 ) ;
424650
651+ x = new Float32Array ( [
652+ 1.0 , // 0
653+ 2.0 , // 1
654+ 3.0 ,
655+ 4.0 ,
656+ 5.0
657+ ] ) ;
658+ y = new Float32Array ( [
659+ 6.0 , // 1
660+ 7.0 ,
661+ 8.0 , // 0
662+ 9.0 ,
663+ 10.0
664+ ] ) ;
665+ param = new Float32Array ( [ 1.0 , 0.0 , 2.0 , - 3.0 , 0.0 ] ) ;
666+
667+ srotm ( 2 , x , 1 , 0 , y , - 2 , 2 , param ) ;
668+
669+ xe = new Float32Array ( [
670+ 8.0 , // 0
671+ 6.0 , // 1
672+ 3.0 ,
673+ 4.0 ,
674+ 5.0
675+ ] ) ;
676+ ye = new Float32Array ( [
677+ - 2.0 , // 1
678+ 7.0 ,
679+ - 1.0 , // 0
680+ 9.0 ,
681+ 10.0
682+ ] ) ;
683+
684+ isApprox ( t , x , xe , 2.0 ) ;
685+ isApprox ( t , y , ye , 2.0 ) ;
686+
687+ x = new Float32Array ( [
688+ 1.0 , // 0
689+ 2.0 , // 1
690+ 3.0 , // 2
691+ 4.0 ,
692+ 5.0
693+ ] ) ;
694+ y = new Float32Array ( [
695+ 6.0 , // 2
696+ 7.0 ,
697+ 8.0 , // 1
698+ 9.0 ,
699+ 10.0 // 0
700+ ] ) ;
701+ param = new Float32Array ( [ - 1.0 , 0.0 , 2.0 , - 3.0 , 0.0 ] ) ;
702+
703+ srotm ( 3 , x , 1 , 0 , y , - 2 , 4 , param ) ;
704+
705+ xe = new Float32Array ( [
706+ - 30.0 , // 0
707+ - 24.0 , // 1
708+ - 18.0 , // 2
709+ 4.0 ,
710+ 5.0
711+ ] ) ;
712+ ye = new Float32Array ( [
713+ 6.0 , // 2
714+ 7.0 ,
715+ 4.0 , // 1
716+ 9.0 ,
717+ 2.0 // 0
718+ ] ) ;
719+
720+ isApprox ( t , x , xe , 2.0 ) ;
721+ isApprox ( t , y , ye , 2.0 ) ;
722+
425723 t . end ( ) ;
426724} ) ;
427725
@@ -469,60 +767,6 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function leav
469767 t . end ( ) ;
470768} ) ;
471769
472- tape ( 'the function supports negative strides' , function test ( t ) {
473- var param ;
474- var xe ;
475- var ye ;
476- var x ;
477- var y ;
478-
479- x = new Float32Array ( [
480- 0.6 , // 1
481- 0.1 ,
482- - 0.5 , // 0
483- 0.8 ,
484- 0.9 ,
485- - 0.3 ,
486- - 0.4
487- ] ) ;
488- y = new Float32Array ( [
489- 0.5 , // 0
490- - 0.9 , // 1
491- 0.3 ,
492- 0.7 ,
493- - 0.6 ,
494- 0.2 ,
495- 0.8
496- ] ) ;
497- param = new Float32Array ( [ 0.0 , 0.0 , 2.0 , - 3.0 , 0.0 ] ) ;
498-
499- srotm ( 2 , x , - 2 , 2 , y , 1 , 0 , param ) ;
500-
501- xe = new Float32Array ( [
502- 3.3 , // 1
503- 0.1 ,
504- - 2.0 , // 0
505- 0.8 ,
506- 0.9 ,
507- - 0.3 ,
508- - 0.4
509- ] ) ;
510- ye = new Float32Array ( [
511- - 0.5 , // 0
512- 0.3 , // 1
513- 0.3 ,
514- 0.7 ,
515- - 0.6 ,
516- 0.2 ,
517- 0.8
518- ] ) ;
519-
520- isApprox ( t , x , xe , 10.0 ) ;
521- isApprox ( t , y , ye , 10.0 ) ;
522-
523- t . end ( ) ;
524- } ) ;
525-
526770tape ( 'the function supports complex access patterns' , function test ( t ) {
527771 var param ;
528772 var xe ;
0 commit comments