Posted to tcl by kbk at Sun Jan 17 22:33:59 GMT 2010view raw
- # Plots a net defined in points-and-faces fashion
- proc visualizeNet {w points faces args} {
- foreach face [lsort -command [list orderf $points] $faces] {
- set c {}
- set polyCoords [selectFrom $points $face]
- foreach coord $polyCoords {
- lassign $coord x y z
- lappend c \
- [expr {200. + 190. * (0.867 * $x - 0.9396 * $y)}] \
- [expr {200 + 190. * (0.5 * $x + 0.3402 * $y - $z)}]
- # [expr {100 + 90*($x - 0.5*$y)}] \
- # [expr {100 + 90*(0.86*$y - $z)}]
- }
- $w create polygon $c -fill {} {*}$args
- }
- }