POV-Ray : Newsgroups : povray.newusers : Simulating interference of coherent light Server Time
4 Nov 2024 21:25:15 EST (-0500)
  Simulating interference of coherent light (Message 1 to 5 of 5)  
From: Kaveh
Subject: Simulating interference of coherent light
Date: 8 Dec 2002 00:36:04
Message: <1fmv7fw.1e1z0nu13wt8psN%kaveh@delete_this.focalimage.com>
I am trying to simulate an interference pattern made with two light
sources. The fringes made in space have a sinusiodal variation,
depending on the distance of each of the two sources from any point in
space. So for any <x,y,z>, if the distance to the two light sources is
equal, then that point is light. As the difference increases, the points
in space vary sinusoidally with the path difference. The effect is
something like onion rings in space.

Ideally, I would like to be able to vary the colour and transparency at
any point in space, so the 'light' bits can be transparent. 

I have tried to use a user defined function to vary the pigment, but I
need to use the vlength() function to calculate the path difference.
According to the manual (6.1.6) I can't use functions that apply to
vectors, like vlength. Also, seems I can vary the pigment, but not
color. So I don't know how to define transparency without using filter
in color.

Any guidance, general or specific, very welcome.

-- 
Kaveh


Post a reply to this message

From: Mike Williams
Subject: Re: Simulating interference of coherent light
Date: 8 Dec 2002 03:03:41
Message: <PkHU2EAlyv89Ewfz@econym.demon.co.uk>
Wasn't it Kaveh who wrote:
>I am trying to simulate an interference pattern made with two light
>sources. The fringes made in space have a sinusiodal variation,
>depending on the distance of each of the two sources from any point in
>space. So for any <x,y,z>, if the distance to the two light sources is
>equal, then that point is light. As the difference increases, the points
>in space vary sinusoidally with the path difference. The effect is
>something like onion rings in space.
>
>Ideally, I would like to be able to vary the colour and transparency at
>any point in space, so the 'light' bits can be transparent. 
>
>I have tried to use a user defined function to vary the pigment, but I
>need to use the vlength() function to calculate the path difference.
>According to the manual (6.1.6) I can't use functions that apply to
>vectors, like vlength. Also, seems I can vary the pigment, but not
>color. So I don't know how to define transparency without using filter
>in color.
>
>Any guidance, general or specific, very welcome.

Although you can't use vlength() in a function, you should be able to
perform the same calculation directly using Pythagarus's Theorem.

You can alter the transparency by using a colour_map.

Here's some code

//----------------------------------

camera { location  <0, 20, -20> look_at <0, 0, 0>}

light_source {<-100,200,-100> colour rgb 2}

// positions of the wave sources

#declare X1 = 5;
#declare Y1 = 0;
#declare Z1 = 0;

#declare X2 = -5;
#declare Y2 = 0;
#declare Z2 = 0;

// Amplitudes of th4 waves
#declare A1 = 3;
#declare A2 = -5;

// Individual wave functions

#declare F1 = function {
 sin(sqrt(pow(x-X1,2) + pow(y-Y1,2) + pow(z-Z1,2)))
}
#declare F2 = function {
 sin(sqrt(pow(x-X2,2) + pow(y-Y2,2) + pow(z-Z2,2)))
}

// Interference function between the waves

#declare F = function {
  (A1*F1(x,y,z) + A2*F2(x,y,z))
  * 0.5/(abs(A1)+abs(A2)) + 0.5
}
                                 
// The thing itself 

plane {y, 0
  pigment { function {F(x,y,z)}
    color_map { [0.0 rgbt <1,1,1,1>]
                [1.0 rgbt <1,1,1,0>]
    }
  }
  no_shadow
}

// Something underneath so you can see the transparency

plane {y,-20
  pigment {checker rgb 0,rgb 0.2 scale 10}
}


//

The "* 0.5/(abs(A1)+abs(A2)) + 0.5" bit is used to change the function
values so that they lie between 0 and 1.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Kaveh
Subject: Re: Simulating interference of coherent light
Date: 8 Dec 2002 05:45:41
Message: <1fmvm1d.1o3swaj1m7fi12N%kaveh@delete_this.focalimage.com>
Thank you for your detailed reply. It's helped a huge amount. :-)

Mike Williams <mik### [at] econymdemoncouk> wrote:

[...]

> Although you can't use vlength() in a function, you should be able to
> perform the same calculation directly using Pythagarus's Theorem.
> 
> You can alter the transparency by using a colour_map.

[...]

> #declare F1 = function {
>  sin(sqrt(pow(x-X1,2) + pow(y-Y1,2) + pow(z-Z1,2)))
> }
> #declare F2 = function {
>  sin(sqrt(pow(x-X2,2) + pow(y-Y2,2) + pow(z-Z2,2)))
> }
> 
> // Interference function between the waves
> 
> #declare F = function {
>   (A1*F1(x,y,z) + A2*F2(x,y,z))
>   * 0.5/(abs(A1)+abs(A2)) + 0.5
> }

Slightly off topic, but I am not sure this is the correct way to find
the interference pattern. I am still racking my brain. It seems logical
to take the amplitude of each wave, and add them up at each point. But
when I take the path difference first, by subtracting one path from the
other, and then using the sine of that path difference, I get a
different pattern, and one which looks more correct, i.e. continuous
curved lines. I will think more on this.

>                                  
> // The thing itself 
> 
> plane {y, 0
>   pigment { function {F(x,y,z)}
>     color_map { [0.0 rgbt <1,1,1,1>]
>                 [1.0 rgbt <1,1,1,0>]
>     }
>   }
>   no_shadow
> }
> 

Now how would I get this pattern through a volume, e.g. a cube? I want
to see the strata running through an object, i.e. 3D fringes. I now get
the pattern only on the surface. I tried using interior_texture, but it
didn't work. 
-- 
Kaveh


Post a reply to this message

From: Mike Williams
Subject: Re: Simulating interference of coherent light
Date: 8 Dec 2002 08:17:33
Message: <mvbu0LAUY089Ewqd@econym.demon.co.uk>
Wasn't it Kaveh who wrote:
>Slightly off topic, but I am not sure this is the correct way to find
>the interference pattern. I am still racking my brain. It seems logical
>to take the amplitude of each wave, and add them up at each point. But
>when I take the path difference first, by subtracting one path from the
>other, and then using the sine of that path difference, I get a
>different pattern, and one which looks more correct, i.e. continuous
>curved lines. I will think more on this.

Doing it my way, you get a snapshot of the true situation, like what
you'd see with water waves. Since light waves travel faster than you can
see, you probably want to sum this over 
               sin(Dist1 + Theta) + sin(Dist2 + Theta)
for Theta varying from 0 to 360. 

I don't happen to know how to solve that.


>Now how would I get this pattern through a volume, e.g. a cube? I want
>to see the strata running through an object, i.e. 3D fringes. I now get
>the pattern only on the surface. I tried using interior_texture, but it
>didn't work. 

I think you can use media, and use the function as a density_map.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Kaveh
Subject: Re: Simulating interference of coherent light
Date: 8 Dec 2002 13:56:45
Message: <1fmw8tz.7fpqx71mqcfk0N%kaveh@delete_this.focalimage.com>
Mike Williams <mik### [at] econymdemoncouk> wrote:

> 
> I think you can use media, and use the function as a density_map.

Thanks Mike. I have so much to learn. There's something that hasn't
quite 'clicked' yet with all these different options. 
-- 
Kaveh


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.