VMD-L Mailing List
From: Axel Kohlmeyer (axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de)
Date: Wed Jul 07 2004 - 09:06:32 CDT
- Next message: John Stone: "Re: I can not load mdcrd file after simulation with sander"
- Previous message: Harindar Keer: "width for triangle"
- In reply to: Harindar Keer: "width for triangle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
>>> "HK" == Harindar Keer <hkeer_at_uci.edu> writes:
HK> Hi,
HK> Can somehow one can achieve width in user drawn object triangle, such
HK> that triangle will have three dimensional look.
hi,
well, that is not directly possible, but if i understand correctly,
that you would like to draw some kind of prism, than you could
put the following code into your .vmdrc file, and you will
have the additional command 'draw prism' available.
this just builds it from triangles.
enjoy,
axel.
-snip-snip-snip-snip-snip-snip-snip-snip-snip-snip-snip-
# add a 'draw prism' command similar to triangle
# but with an optional width.
proc vmd_draw_prism {mol v1 v2 v3 {w 0.1}} {
# empty list to store graphics indices in. is used as
# return value, so that they can be selectively deleted.
set objs {}
set norm [veccross [vecsub $v1 $v2] [vecsub $v2 $v3]]
set scale [expr 0.5 * $w * [veclength $norm]]
# construct edge positions:
set off [vecscale $scale $norm]
set vt1 [vecadd $v1 $off]
set vt2 [vecadd $v2 $off]
set vt3 [vecadd $v3 $off]
set vb1 [vecsub $v1 $off]
set vb2 [vecsub $v2 $off]
set vb3 [vecsub $v3 $off]
lappend objs [graphics $mol triangle $vt1 $vt2 $vt3]
lappend objs [graphics $mol triangle $vb1 $vb2 $vb3]
lappend objs [graphics $mol triangle $vt1 $vt2 $vb2]
lappend objs [graphics $mol triangle $vt1 $vb1 $vb2]
lappend objs [graphics $mol triangle $vt1 $vt3 $vb3]
lappend objs [graphics $mol triangle $vt1 $vb1 $vb3]
lappend objs [graphics $mol triangle $vt2 $vt3 $vb3]
lappend objs [graphics $mol triangle $vt2 $vb2 $vb3]
return $objs
}
-snip-snip-snip-snip-snip-snip-snip-snip-snip-snip-snip-
to use it type, e.g.:
if { ! [molinfo num] } { mol new }
graphics 0 delete all
graphics 0 color 0
graphics 0 triangle "0 0 0" "1 0 0" "0 1 0"
graphics 0 color 1
draw prism {0 0 0} {1 0 0} {0 1 0} 0.2
HK> Many thanks,
HK> Harindar
-- ======================================================================= Axel Kohlmeyer e-mail: axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de Lehrstuhl fuer Theoretische Chemie Phone: ++49 (0)234/32-26673 Ruhr-Universitaet Bochum - NC 03/53 Fax: ++49 (0)234/32-14045 D-44780 Bochum http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/ ======================================================================= If you make something idiot-proof, the universe creates a better idiot.
- Next message: John Stone: "Re: I can not load mdcrd file after simulation with sander"
- Previous message: Harindar Keer: "width for triangle"
- In reply to: Harindar Keer: "width for triangle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]