@@ -12,12 +12,12 @@ pub fn update_transform(network_interface: &mut NodeNetworkInterface, node_id: &
1212 let translation = transform. translation ;
1313
1414 let rotation = rotation. to_degrees ( ) ;
15- let shear = DVec2 :: new ( skew. atan ( ) . to_degrees ( ) , 0. ) ;
15+ let skew = DVec2 :: new ( skew. atan ( ) . to_degrees ( ) , 0. ) ;
1616
1717 network_interface. set_input ( & InputConnector :: node ( * node_id, 1 ) , NodeInput :: value ( TaggedValue :: DVec2 ( translation) , false ) , & [ ] ) ;
1818 network_interface. set_input ( & InputConnector :: node ( * node_id, 2 ) , NodeInput :: value ( TaggedValue :: F64 ( rotation) , false ) , & [ ] ) ;
1919 network_interface. set_input ( & InputConnector :: node ( * node_id, 3 ) , NodeInput :: value ( TaggedValue :: DVec2 ( scale) , false ) , & [ ] ) ;
20- network_interface. set_input ( & InputConnector :: node ( * node_id, 4 ) , NodeInput :: value ( TaggedValue :: DVec2 ( shear ) , false ) , & [ ] ) ;
20+ network_interface. set_input ( & InputConnector :: node ( * node_id, 4 ) , NodeInput :: value ( TaggedValue :: DVec2 ( skew ) , false ) , & [ ] ) ;
2121}
2222
2323// TODO: This should be extracted from the graph at the location of the transform node.
@@ -58,12 +58,12 @@ pub fn get_current_transform(inputs: &[NodeInput]) -> DAffine2 {
5858 } ;
5959 let rotation = if let Some ( & TaggedValue :: F64 ( rotation) ) = inputs[ 2 ] . as_value ( ) { rotation } else { 0. } ;
6060 let scale = if let Some ( & TaggedValue :: DVec2 ( scale) ) = inputs[ 3 ] . as_value ( ) { scale } else { DVec2 :: ONE } ;
61- let shear = if let Some ( & TaggedValue :: DVec2 ( shear ) ) = inputs[ 4 ] . as_value ( ) { shear } else { DVec2 :: ZERO } ;
61+ let skew = if let Some ( & TaggedValue :: DVec2 ( skew ) ) = inputs[ 4 ] . as_value ( ) { skew } else { DVec2 :: ZERO } ;
6262
6363 let rotation = rotation. to_radians ( ) ;
64- let shear = DVec2 :: new ( shear . x . to_radians ( ) . tan ( ) , shear . y . to_radians ( ) . tan ( ) ) ;
64+ let skew = DVec2 :: new ( skew . x . to_radians ( ) . tan ( ) , skew . y . to_radians ( ) . tan ( ) ) ;
6565
66- DAffine2 :: from_scale_angle_translation ( scale, rotation, translation) * DAffine2 :: from_cols_array ( & [ 1. , shear . y , shear . x , 1. , 0. , 0. ] )
66+ DAffine2 :: from_scale_angle_translation ( scale, rotation, translation) * DAffine2 :: from_cols_array ( & [ 1. , skew . y , skew . x , 1. , 0. , 0. ] )
6767}
6868
6969/// Extract the current normalized pivot from the layer
@@ -112,22 +112,22 @@ mod tests {
112112 /// ```
113113 #[ test]
114114 fn derive_transform ( ) {
115- for shear_x in -10 ..=10 {
116- let shear_x = ( shear_x as f64 ) / 2. ;
115+ for skew_x in -10 ..=10 {
116+ let skew_x = ( skew_x as f64 ) / 2. ;
117117 for angle in ( 0 ..=360 ) . step_by ( 15 ) {
118118 let angle = ( angle as f64 ) . to_radians ( ) ;
119119 for scale_x in 1 ..10 {
120120 let scale_x = ( scale_x as f64 ) / 5. ;
121121 for scale_y in 1 ..10 {
122122 let scale_y = ( scale_y as f64 ) / 5. ;
123123
124- let shear = DVec2 :: new ( shear_x , 0. ) ;
124+ let skew = DVec2 :: new ( skew_x , 0. ) ;
125125 let scale = DVec2 :: new ( scale_x, scale_y) ;
126126 let translate = DVec2 :: new ( 5666. , 644. ) ;
127127
128128 let original_transform = DAffine2 :: from_cols (
129- DVec2 :: new ( scale. x * angle. cos ( ) - scale. y * angle. sin ( ) * shear . y , scale. x * angle. sin ( ) + scale. y * angle. cos ( ) * shear . y ) ,
130- DVec2 :: new ( scale. x * angle. cos ( ) * shear . x - scale. y * angle. sin ( ) , scale. x * angle. sin ( ) * shear . x + scale. y * angle. cos ( ) ) ,
129+ DVec2 :: new ( scale. x * angle. cos ( ) - scale. y * angle. sin ( ) * skew . y , scale. x * angle. sin ( ) + scale. y * angle. cos ( ) * skew . y ) ,
130+ DVec2 :: new ( scale. x * angle. cos ( ) * skew . x - scale. y * angle. sin ( ) , scale. x * angle. sin ( ) * skew . x + scale. y * angle. cos ( ) ) ,
131131 translate,
132132 ) ;
133133
@@ -137,7 +137,7 @@ mod tests {
137137
138138 assert ! (
139139 new_transform. abs_diff_eq( original_transform, 1e-10 ) ,
140- "original_transform {original_transform} new_transform {new_transform} / scale {scale} new_scale {new_scale} / angle {angle} new_angle {new_angle} / shear {shear } / new_shear {new_shear }" ,
140+ "original_transform {original_transform} new_transform {new_transform} / scale {scale} new_scale {new_scale} / angle {angle} new_angle {new_angle} / skew {skew } / new_skew {new_skew }" ,
141141 ) ;
142142 }
143143 }
0 commit comments