MCPcopy Create free account
hub / github.com/KLayout/klayout / test_2_Trans

Method test_2_Trans

testdata/ruby/dbTransTest.rb:305–340  ·  view source on GitHub ↗

Complex transformation basics

Source from the content-addressed store, hash-verified

303
304 # Complex transformation basics
305 def test_2_Trans
306
307 a = RBA::Trans::new
308 b = RBA::Trans::new( RBA::Trans::M135, RBA::Point::new( 17, 5 ))
309 ma = RBA::CplxTrans::new( a, 0.5 )
310 mb = RBA::CplxTrans::new( b, 2.0 )
311 u = RBA::CplxTrans::new( a )
312
313 assert_equal( ma.to_s, "r0 *0.5 0,0" )
314 assert_equal( mb.to_s, "m135 *2 17,5" )
315
316 assert_equal( ma == mb, false )
317 assert_equal( ma == ma, true )
318 assert_equal( ma != mb, true )
319 assert_equal( ma != ma, false )
320
321 assert_equal( mb.inverted.to_s, "m135 *0.5 2.5,8.5" )
322
323 i = mb.dup
324 i.invert
325
326 assert_equal( i.to_s, "m135 *0.5 2.5,8.5" )
327 assert_equal( i * mb == u, true )
328 assert_equal( mb * i == u, true )
329
330 assert_equal( mb.trans( RBA::Point::new( 1, 0 )).to_s, "17,3" )
331 assert_equal( mb.ctrans(2).to_s, "4.0" )
332 assert_equal( mb.ctrans(-2).to_s, "-4.0" )
333 assert_equal( (mb * 2).to_s, "4.0" )
334 assert_equal( (mb * -2).to_s, "-4.0" )
335 assert_equal( i.ctrans(2).to_s, "1.0" )
336 assert_equal( i.ctrans(-2).to_s, "-1.0" )
337 assert_equal( (i * 2).to_s, "1.0" )
338 assert_equal( (i * -2).to_s, "-1.0" )
339
340 end
341
342 # Complex transformation specials
343 def test_3_Trans

Callers

nothing calls this directly

Calls 6

to_sMethod · 0.45
invertedMethod · 0.45
dupMethod · 0.45
invertMethod · 0.45
transMethod · 0.45
ctransMethod · 0.45

Tested by

no test coverage detected