Posted to tcl by kbk at Sun Jan 17 22:33:59 GMT 2010view raw

  1. # Plots a net defined in points-and-faces fashion
  2. proc visualizeNet {w points faces args} {
  3. foreach face [lsort -command [list orderf $points] $faces] {
  4. set c {}
  5. set polyCoords [selectFrom $points $face]
  6. foreach coord $polyCoords {
  7. lassign $coord x y z
  8. lappend c \
  9. [expr {200. + 190. * (0.867 * $x - 0.9396 * $y)}] \
  10. [expr {200 + 190. * (0.5 * $x + 0.3402 * $y - $z)}]
  11. # [expr {100 + 90*($x - 0.5*$y)}] \
  12. # [expr {100 + 90*(0.86*$y - $z)}]
  13. }
  14. $w create polygon $c -fill {} {*}$args
  15. }
  16. }