@@ -4,11 +4,11 @@ import { comparePoints, comparePolygonsAsPoints } from '../../../test/helpers/in
44
55import { mat4 } from '../../maths/index.js'
66
7- import { geom2 , geom3 , path2 } from '../../geometries/index.js'
7+ import { geom2 , geom3 , path2 , path3 } from '../../geometries/index.js'
88
99import { transform } from './index.js'
1010
11- test ( 'transform: transforming of a path2 produces expected changes to points ' , ( t ) => {
11+ test ( 'transform: ( path2) ' , ( t ) => {
1212 const matrix = mat4 . fromTranslation ( mat4 . create ( ) , [ 2 , 2 , 0 ] )
1313 let geometry = path2 . fromPoints ( { } , [ [ 0 , 0 ] , [ 1 , 0 ] ] )
1414
@@ -19,7 +19,18 @@ test('transform: transforming of a path2 produces expected changes to points', (
1919 t . true ( comparePoints ( obs , exp ) )
2020} )
2121
22- test ( 'transform: transforming of a geom2 produces expected changes to sides' , ( t ) => {
22+ test ( 'transform: (path3)' , ( t ) => {
23+ const matrix = mat4 . fromTranslation ( mat4 . create ( ) , [ 2 , 2 , 2 ] )
24+ let geometry = path3 . fromVertices ( { closed : true } , [ [ 0 , 0 , 0 ] , [ 1 , 0 , 1 ] , [ 3 , 2 , 1 ] ] )
25+
26+ geometry = transform ( matrix , geometry )
27+ const obs = path3 . toVertices ( geometry )
28+ const exp = [ [ 2 , 2 , 2 ] , [ 3 , 2 , 3 ] , [ 5 , 4 , 3 ] ]
29+ t . notThrows ( ( ) => path3 . validate ( geometry ) )
30+ t . true ( comparePoints ( obs , exp ) )
31+ } )
32+
33+ test ( 'transform: (geom2)' , ( t ) => {
2334 const matrix = mat4 . fromScaling ( mat4 . create ( ) , [ 5 , 5 , 5 ] )
2435 let geometry = geom2 . create ( [ [ [ 0 , 0 ] , [ 1 , 0 ] , [ 0 , 1 ] ] ] )
2536
@@ -30,7 +41,7 @@ test('transform: transforming of a geom2 produces expected changes to sides', (t
3041 t . true ( comparePoints ( obs , exp ) )
3142} )
3243
33- test ( 'transform: transforming of a geom3 produces expected changes to polygons ' , ( t ) => {
44+ test ( 'transform: ( geom3) ' , ( t ) => {
3445 const matrix = mat4 . fromTranslation ( mat4 . create ( ) , [ - 3 , - 3 , - 3 ] )
3546 const points = [
3647 [ [ - 2 , - 7 , - 12 ] , [ - 2 , - 7 , 18 ] , [ - 2 , 13 , 18 ] , [ - 2 , 13 , - 12 ] ] ,
@@ -55,7 +66,7 @@ test('transform: transforming of a geom3 produces expected changes to polygons',
5566 t . true ( comparePolygonsAsPoints ( obs , exp ) )
5667} )
5768
58- test ( 'transform: transforming of multiple objects produces expected changes ' , ( t ) => {
69+ test ( 'transform: ( multiple objects) ' , ( t ) => {
5970 const junk = 'hello'
6071 const geometry1 = path2 . fromPoints ( { } , [ [ - 5 , 5 ] , [ 5 , 5 ] , [ - 5 , - 5 ] , [ 10 , - 5 ] ] )
6172 const geometry2 = geom2 . create ( [ [ [ - 5 , - 5 ] , [ 0 , 5 ] , [ 10 , - 5 ] ] ] )
0 commit comments