Posted to tcl by kbk at Sun Jan 17 22:31:54 GMT 2010view raw

  1. # Points to define the unit cube
  2. set points {
  3. {0.0 0.0 0.0}
  4. {1.0 0.0 0.0}
  5. {1.0 1.0 0.0}
  6. {0.0 1.0 0.0}
  7. {0.0 0.0 1.0}
  8. {1.0 0.0 1.0}
  9. {1.0 1.0 1.0}
  10. {0.0 1.0 1.0}
  11. }
  12. foreach pt $points {
  13. lassign $pt x y z
  14. lappend points [list [expr {0.25 + 0.5*$x}] [expr {0.25 + 0.5*$y}] $z]
  15. }
  16.  
  17. # Try removing one of the faces to demonstrate holes.
  18. set faces {
  19. {0 8 9 1}
  20. {1 9 10 2}
  21. {2 10 11 3}
  22. {3 11 8 0}
  23. {0 1 5 4}
  24. {1 2 6 5}
  25. {2 3 7 6}
  26. {3 0 4 7}
  27. {4 5 13 12}
  28. {5 6 14 13}
  29. {6 7 15 14}
  30. {7 4 12 15}
  31. {8 9 13 12}
  32. {9 10 14 13}
  33. {10 11 15 14}
  34. {11 8 12 15}
  35. }