|
Foamy Ether - A Framework for a Theory Of Everything Conceived and written by
Peter C.M. Hahn
C.E.T. |
//////////////////////////////////////////////////
// waveInflowCollapsing.thd
// Simulates a lightwave
traveling from a sun to a planet.
// The bottom represents both a
collapsing universe,
// AND ether/space shrinking as a result
of inflow.
//////////////////////////////////////////////////
// set background color
scene.backColor=RGB(92,92,98);
scene.gravity={0,0,0};
//scene.gravity={0,-.00981,0};
scene.shadow = false;
// use degrees as metric for angles
factory.useDegrees = true;
// choose some default material
//Material (density, springConstant,
dampingConstant, staticFriction,
dynamicFriction, thresholdVelocity);
var mat = Material(1e-5, .0005, .001, 1, 1);
factory.material = mat ;
factory.detectCollision = false;
var green = RGB(108, 255, 108);
var white = RGB(200, 200, 200);
var red = RGB(150, 0, 0);
var spngCnst
= .000001; // set spring constant
var dmpCnst
= .000001; // set damper constant
// build array of balls
var widthTop
= 190; // enter number of balls for array width
var widthBot
= 190; // enter number of balls for array width
var depth = 1; // enter number of balls for array depth
var spacing = 20; // enter spacing between balls for top
var ball = "";
var shiftRight
= 0; // move top wave to center
// set camera
scene.camera = {widthBot*spacing/2,500,-2500};
scene.lookAt = {widthBot*spacing/2,500,200};
// make bottom line
var s = array();
for (var x=0; x < widthBot; x++) {
ball = Sphere(1.5, {x*spacing,0,0});
//ball.color = green;
ball.visible = false;
// set all outer edge balls as stationary
if
(x==0||x==widthBot-1){
ball.static = true;
}
s.append(ball);
}
// build array of springs and dampers
attaching to balls on x axis
var spx
= array();
var dpx
= array();
var dmpr
= "";
var sprng
= "";
for (x=0; x < widthBot-1; x++) {
sprng = Spring(s[x],{0,0,0},s[x+1],{0,0,0});
sprng.springConstant = spngCnst;
spx.append(sprng);
var dmpr = Damper(s[x],{0,0,0},s[x+1],{0,0,0});
dmpr.damperConstant = dmpCnst;
//alternate colors in segments of 10
if
((x/10)%2 == 1){
dmpr.color = green;
}else{
dmpr.color = red;
}
dpx.append(dmpr);
}
// make top line
var s2 = array();
for (x=0; x < widthTop;
x++) {
ball = Sphere(1.5, {x*spacing+shiftRight,900,0});
//ball.color = green;
ball.visible = false;
// set all outer edge balls as stationary
if
(x==0||x==widthTop-1){
ball.static = true;
}
s2.append(ball);
}
// build array of springs and dampers
attaching to balls on x axis
var spx2 = array();
var dpx2 = array();
for (x=0; x < widthTop-1; x++) {
sprng = Spring(s2[x],{0,0,0},s2[x+1],{0,0,0});
sprng.springConstant = spngCnst;
spx2.append(sprng);
var dmpr = Damper(s2[x],{0,0,0},s2[x+1],{0,0,0});
dmpr.damperConstant = dmpCnst;
//alternate colors in segments of 10
if
((x/10)%2 == 1){
dmpr.color = green;
}else{
dmpr.color = red;
}
dpx2.append(dmpr);
}
// make end balls
var topLeft
= Sphere(100, {-100+shiftRight,900,0});
topLeft.color = RGB(255, 255, 0);
var topRight
= Sphere(100, {widthTop*spacing+100+shiftRight,900,0});
topRight.color = RGB(0, 0, 255);
var botLeft
= Cylinder({100,100,2}, {-100,0,0});
var texSun
= Texture("sun.jpg");
botLeft.useTexture(texSun);
botLeft.specular = RGB(255,255,255,0);
botLeft.sharpness = 50;
botLeft.emissive = 200;
var botRight
= Cylinder({100,100,2}, {widthBot*spacing+80,0,0});
var texEarth
= Texture("earth.jpg");
botRight.useTexture(texEarth);
botRight.specular = RGB(255,255,255,0);
botRight.sharpness = 50;
botRight.emissive = 200;
var amp = 1000;
//make wave top
s2[4].move(0,amp,0);
s2[5].move(0,amp,0);
//make wave bottom
s[4].move(0,amp,0);
s[5].move(0,amp,0);
simulator.resetTime();
simulator.stepsize = .1;
var left = 0;
var right = widthBot-2;
var step = 35;
s[widthBot-1].visible
= false;
// reel in ether and pull to stretch
while (simulator.time <= 1650) {
simulator.run(50);
WaitFrame();
//print(right, newline);
s[left].position = {step*left,0,0};
s[left].static = true;
s[right].position = {(widthBot-1)*spacing - step*left,0,0};
s[right].static = true;
s[left].visible = false;
dpx[left].visible = false;
spx[left].visible = false;
s[right].visible = false;
dpx[right].visible = false;
spx[right].visible = false;
left++;
right--;
botLeft.rotate(0,0,-5);
botRight.rotate(0,0,5);
botLeft.move(step,0,0);
botRight.move(-step ,0,0);
}
// pause for two seconds
for (var i=0; i<30; i++){
WaitFrame();
};
Peter C.M. Hahn
C.E.T.