Yep, I blew it -- neglected to check my work.  Scratch all of my
previous emails on the subject.

The following function (turn_y_light.py) will correctly rotate the light
in order to offset the effect of "turn y,#"

def turn_y_light(rot):
   # assuming "rot" has angle in degrees
   rot_rad = math.pi*rot/180.0 
   (X0,Y0,Z0)=cmd.get_setting_tuple("light")[1]
   X1= X0*math.cos(rot_rad) + Z0*math.sin(rot_rad)
   Y1= Y0
   Z1= Z0*math.cos(rot_rad) - X0*math.sin(rot_rad)
   cmd.set("light",[X1,Y1,Z1])

sample usage:

# first, load the function from a .py file

run turn_y_light.py

# now use it...

turn y,3
turn_y_list(3)
ray
png image1.png

turn y,-6
turn_y_light(-6)
ray
png image2.png

Sorry for the confusion!  

Warren

--
mailto:war...@delanoscientific.com
Warren L. DeLano, Ph.D. 
Principal
DeLano Scientific LLC
Voice (650)-346-1154 
Fax   (650)-593-4020
 

-----Original Message-----
From: pymol-users-ad...@lists.sourceforge.net
[mailto:pymol-users-ad...@lists.sourceforge.net] On Behalf Of Anthony
Duff
Sent: Tuesday, April 29, 2003 9:08 PM
To: pymol-users@lists.sourceforge.net
Subject: Re: [PyMOL] RE: Stereo pictures, light vector and shadows


Warren's script is not quite right.  The value -0.902 is not correct.
Apparently, my picture, with a stick peptide casting a shadow on the
inner 
surface of a deep crevice, is particularly demanding.

I have done the vector calculations.  See the attached excel worksheet
for 
light vectors for any desired stereo angle.

I am using the script below.  It produces perfect shadows and
reflections.


turn y, 3
set light=[-0.43709,-0.34800,-0.82937]
ray 1120,818
png image.l.png

turn y, -6
set light=[-0.34800,-0.34800,-0.87051]
ray 1120,818
png image.r.png



Anthony



At 05:10 AM 24/04/2003, Warren L. DeLano wrote:


>In the script I just posted, I used unit vectors to specify the light
>direction and simply rotated that vector by 6 degrees.  The first
vector
>is merely [-0.4,-0.4,-1.0] normalized.  The second is that same vector
>rotated 6 degrees about the Y axis.
>
>I then loaded the output into Illustrator and was able to view both
>cross-eye and wall-eye stereo pairs with clean shadows.
>
>
> >
> > Try using this sequence to create your stereo pair:
> >
> > set light=[-0.348,-0.348,-0.870]
> > ray
> > png image1.png
> > turn y,6
> > set light=[-0.437,-0.348,-0.902]
> > ray
> > png image2.png
> > turn y,-6
> >
> > Cheers,
> > Warren

----------------------------------------------------------------------
Anthony Duff
Postdoctoral Fellow
School of Molecular and Microbial Biosciences
Biochemistry Building, G08
University of Sydney, NSW 2006 Australia
Phone. 61-2-9351-7817   Fax. 61-2-9351-4726
----------------------------------------------------------------------


Reply via email to