用tcl语言写一段代码,内容是将boundary为{{0 0}{1000 1000} }的区域内分割成长宽都为5的若干方块,并输出每个方块的boundary
时间: 2023-03-07 08:24:12 浏览: 386
答:set x 0; set y 0; set width 1000; set height 1000; set boxwidth 5; set boxheight 5; for {set i 0} {$i < $width / $boxwidth} {incr i} { for {set j 0} {$j < $height / $boxheight} {incr j} { set boundary {{$x + $i*$boxwidth} {$y + $j*$boxheight}} {{$x + ($i+1)*$boxwidth} {$y + ($j+1)*$boxheight}} puts "Boundary of box $i,$j is $boundary" } }
阅读全文