- #211
Hans de Vries
Science Advisor
Gold Member
- 1,094
- 30
Lorentz versus Mansouri-Sexl
And here's the program to test Lorentz transform versus Mansouri-Sexl:
Writen in the 3D raytracing Povray language which is simple
to follow and gives a very powerful visualization environment.
http://www.povray.org/
You can download and install the program for free here.
http://www.povray.org/download/
Then just copy and paste my program and click the RUN button.
Regards, and have fun, Hans
And here's the program to test Lorentz transform versus Mansouri-Sexl:
Code:
// Persistence Of Vision raytracer version 3.5 file.
#include "colors.inc"
//===================================================================================================
//
// LORENTZ VERSUS MANSOURI-SEXL SIMULATOR
//
//===================================================================================================
//
//
// A laser gives a lightpulse downwards vertically in the rest frame. The laser can be made to
// co-move width the moving frame so that it will stay at the same position in the moving frame.
//
// --------------------------------------------------------------------------------------------
//
// The moving frame is plotted in a two dimensional X,Y loop.
//
// The reversed transforms are calculated back into the rest frame, from there a traceback is
// made to the opening of the laser. If we are inside the laser radius and inside the pulse time
// the a pixel is plotted with an intensity calculated from the phase of the laser at the time
// of the emmision.
//
// For each X,Y location tested we test both in front and behind the mirro since each location
// can have light directly from the laser or indirectly from the mirror. Values found behind the
// mirror are reflected back and mixed with the direct light.
//
// --------------------------------------------------------------------------------------------
//
// The Plot pulse macro has as inputs:
//
// 1) T: the time in the moving frame.
// 2) V: the speed of the moving frame
// 3) The transformation, 1=Lorentz, 2=Mansouri-Sexl.
//
// There are two calls of this macro at the end of the program, one for Lorentz and the other
// for Mansouri-Sexl
//
// --------------------------------------------------------------------------------------------
//
// The program uses spheres to draw pixels, When the X_delta and Y_delta values are made lower
// it will draw less but bigger speres and visa versa.
//
//===================================================================================================
//===================================================================================================
// PLOT AREA DEFINITION
//===================================================================================================
#declare X_min = -2.00; // leftmost X position
#declare X_max = 2.00; // rightmost X position
#declare X_delta = 0.01; // step size
#declare Y_min = -1.00; // Bottum Y position
#declare Y_max = 1.00; // Top Y position
#declare Y_delta = 0.01; // step size
#declare Y_mirror = Y_min; // Y location of the mirror
#declare C = 1.00; // normalized speed of light
cylinder {<X_min-0.1, Y_min-0.05, -0.1>,< X_max+0.1, Y_min-0.05, +0.1 >, 0.05 pigment {OldGold} }
cylinder {<X_min-0.1, Y_max+0.05, -0.1>,< X_max+0.1, Y_max+0.05, +0.1 >, 0.05 pigment {OldGold} }
//===================================================================================================
//
// PLOT LASER PULSE MACRO
//
//===================================================================================================
#declare Lorentz_Transform = 1;
#declare MansouriSexl_Transform = 2;#macro plot_laser_pulse ( T, V, Transform_Method ) //===================================================================================================
// LASER DEFINITIONS
//===================================================================================================
#declare laser_radius = 0.20;
#declare pulse_start = -2.50;
#declare pulse_end = 2.00;
#declare Frequency = (2*3.141592) * 5;
#declare Xi_laser = -1.00; // Initial Position of laser
#declare Vx_laser = V; // Horizontal speed of laser
#declare gamma = 1/sqrt(1-V*V/(C*C));
union {//===================================================================================================
// X LOOP
//===================================================================================================
#declare X = X_min;
#while (X < X_max)//===================================================================================================
// Y LOOP
//===================================================================================================
#declare Y = Y_min; // two times for mirroring
#while (Y < Y_max) //===================================================================================================
// FOWARD AND REFLECTED PULSE LOOP
//===================================================================================================
#declare Forward_Pulse_Visible = 0;
#declare Reflected_Pulse_Visible = 0;
#declare Mirror = 0; // loop exectuted two times for mirroring
#while (Mirror < 2)
#if (Transform_Method = Lorentz_Transform)
// -------------------------------------------------------------------------------
// Lorentz Transform
// -------------------------------------------------------------------------------
//
// T = gamma*( T' - V*X'/(C*C) );
// X = gamma*( X' - V*T');
// Y = Y;
//
// ----------- Reverse Lorentz Transform ------------------------------------------
//
#declare T1 = gamma*( T + V*X/(C*C) );
#declare X1 = gamma*( X + V*T);
#end #if (Transform_Method = MansouriSexl_Transform)
// -------------------------------------------------------------------------------
// Mansouri Sexl Transform
// -------------------------------------------------------------------------------
//
// T = T'/gamma;
// X = gamma*( X' - V*T');
// Y = Y';
//
// ----------- Reverse Mansouri Sexl Transform -----------------------------------
//
#declare T1 = T*gamma;
#declare X1 = X/gamma + V*T/gamma;
#end
// -------------------------------------------------------------------------------
// Mirror Y
// -------------------------------------------------------------------------------
//
#declare Y1 = Y;
#if ( Mirror = 1 )
#declare Y1 = Y_mirror*2 - Y1; // mirror if photon has passed mirror
#end
// -------------------------------------------------------------------------------
// Traceback to laser opening
// -------------------------------------------------------------------------------
//
#declare T_1 = T1 - (Y_max-Y1)/C;
#declare X_1 = X1 - Xi_laser - Vx_laser * T_1;
// -------------------------------------------------------------------------------
// Test and Calculate Pixel_Intensity
// -------------------------------------------------------------------------------
//
#if ( T_1 >= pulse_start )
#if ( T_1 < pulse_end )
#if ( abs(X_1) <= laser_radius )
#if ( Mirror = 0)
#declare Forward_Pulse_Visible = 1;
#declare Forward_Phase = sin(Frequency*T_1); // Phase of light emmited at T_1
#end
#if ( Mirror = 1)
#declare Reflected_Pulse_Visible = 1;
#declare Reflected_Phase = sin(Frequency*T_1); // Phase of light emmited at T_1
#end
#end
#end
#end
//===================================================================================================
// END MIRROR LOOP
//===================================================================================================
#declare Mirror = Mirror+1;
#end
// -------------------------------------------------------------------------------
// Test and plot
// -------------------------------------------------------------------------------
//
//
#declare Pixel_Intensity = 0;
#if ( Forward_Pulse_Visible = 1)
#declare Pixel_Intensity = 1/2 + Forward_Phase/5;
#end
#if ( Reflected_Pulse_Visible = 1)
#declare Pixel_Intensity = 1/2 + Reflected_Phase/5;
#end
#if ( Forward_Pulse_Visible + Reflected_Pulse_Visible = 2)
#declare Pixel_Intensity = 1/2 + Forward_Phase/5 + Reflected_Phase/5;
#end
#if ( abs(Pixel_Intensity) > 0)
#object {sphere { <0,0,0>,X_delta pigment { rgb (Pixel_Intensity) } translate <X,Y,0> } }
#end//===================================================================================================
// END Y LOOP
//===================================================================================================
#declare Y = Y + Y_delta;
#end
//===================================================================================================
// END X LOOP
//===================================================================================================
#declare X = X + X_delta;
#end
//===================================================================================================
// END PLOT LASER PULSE MACRO
//===================================================================================================
}
#end//===================================================================================================
// CALL LASER PULSE PLOT MACRO
//===================================================================================================
object {plot_laser_pulse (1.00, -0.50, 1) translate <0.00, 0.00, 0.00> } // Lorentz Transform
//object {plot_laser_pulse (1.00, -0.50, 2) translate <0.00, 0.00, 0.00> } // Mansouri Sexl Transform//===================================================================================================
// Light source and Camera definition
//===================================================================================================
light_source { < 0, 0,-40.0> color red 2 green 2 blue 2 } camera {
location < 0, 0, -10 > //
sky < 0.00, 0.00, -1.00>
look_at < 0.00, 0.00, -0.25>
angle 26
}
to follow and gives a very powerful visualization environment.
http://www.povray.org/
You can download and install the program for free here.
http://www.povray.org/download/
Then just copy and paste my program and click the RUN button.
Regards, and have fun, Hans
Last edited by a moderator: