VMD-L Mailing List
From: Charles_at_Schwieters.org
Date: Tue Jun 20 2000 - 08:04:27 CDT
- Next message: Paul Hubbard: "Pretty Picture"
- Previous message: John Stone: "Re: VMD command line Windows98"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
[my apologies if this isn't a repost.]
Until VMD supports stereo:
Here is a script which produces a stereo postscript file. It works
fine for the orthographic projection, and perhaps adequately for
perspective.
Charles
# Usage: psStero <ang> <dist> <file>
#
# where: <ang> is rotation angle [try 1.5]
# <dist> is image separation in postscript point units [try 300]
# <file> is filename for the resulting image.
#
# by default, psStereo produces a side-by-side view. For cross-eyed, use
# a negative value for the <ang> argument.
# Stereo mode should be off for the screen display for this to work properly.
#
proc psStereo {ang sep file} {
rotate y by [expr $ang]
display update
render PostScript left.tmp
rotate y by [expr -2*$ang]
display update
render PostScript right.tmp
rotate y by [expr $ang]
#combine
set ofd [open $file w]
puts $ofd "%!PS"
puts $ofd "0.5 0.5 scale"
puts $ofd "0 100 translate"
set fd [open left.tmp r]
gets $fd line
while { $line != "newpath" } {
puts $ofd $line
gets $fd line
}
puts $ofd $line
#x0 y0 moveto
gets $fd line
puts $ofd $line
#x0 y1 lineto
gets $fd line
puts $ofd $line
#x1 y1 lineto
gets $fd line
set xycmd [split $line]
set newx [expr 2*[lindex $xycmd 0]]
puts $ofd "$newx [lindex $xycmd 1] [lindex $xycmd 2]"
#x1 y0 lineto
gets $fd line
set xycmd [split $line]
puts $ofd "$newx [lindex $xycmd 1] [lindex $xycmd 2]"
gets $fd line
while { $line != "showpage" } {
puts $ofd $line
gets $fd line
}
#don't write last line (showpage)
close $fd
puts $ofd "$sep 0 translate"
set fd [open right.tmp r]
gets $fd line
#omit top part of file
while { $line != "stroke" } {
gets $fd line
}
gets $fd line
while { ![eof $fd] } {
puts $ofd $line
gets $fd line
}
puts $ofd $line
close $fd
close $ofd
exec rm "left.tmp" "right.tmp"
}
-- Charles Schwieters email: Charles.Schwieters_at_nih.gov www: http://www.hec.utah.edu/~schwitrs phone: (301) 402-4914 FAX: (301) 402-2867
- Next message: Paul Hubbard: "Pretty Picture"
- Previous message: John Stone: "Re: VMD command line Windows98"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]