//------------------------------------------- // THE ATOM // Author: Neha Rajagopalan // CS 476A //-------------------------------------------- // Position camera GG.camera().posZ(150); // defining neutrons GSphere neutron1 --> GG.scene(); GSphere neutron2 --> GG.scene(); GSphere neutron3 --> GG.scene(); GSphere neutron4 --> GG.scene(); GSphere neutron5 --> GG.scene(); GSphere neutron6 --> GG.scene(); GSphere neutron7 --> GG.scene(); GSphere neutron8 --> GG.scene(); GSphere neutron9 --> GG.scene(); GSphere neutron10 --> GG.scene(); // electrons to neutron1 GSphere electron1 --> neutron10; GSphere electron2 --> neutron6; GSphere electron3 --> neutron8; // setting color for neutrons and electrons neutron1.mat().color(@(1,0,0)); neutron2.mat().color(@(0,0,1)); neutron3.mat().color(@(1,0,0)); neutron4.mat().color(@(0,0,1)); neutron5.mat().color(@(1,0,0)); neutron6.mat().color(@(1,0,0)); neutron7.mat().color(@(0,0,1)); neutron8.mat().color(@(1,0,0)); neutron9.mat().color(@(0,0,1)); neutron10.mat().color(@(1,0,0)); electron1.mat().color(@(0,1,0)); electron2.mat().color(@(0,1,0)); electron3.mat().color(@(0,1,0)); //scaling down electron electron1.scale( @(.5,.5,.5) ); electron2.scale( @(.5,.5,.5) ); electron3.scale( @(.5,.5,.5) ); // setting positions for each neutron neutron1.posX(0); neutron2.posX(-0.25); neutron3.posY(0.25); neutron3.posY(0.25); neutron4.posZ(-0.25); neutron5.posX(0.5); neutron6.posY(-0.5); neutron7.posZ(0.5); neutron8.posX(-0.75); neutron9.posY(0.75); neutron10.posZ(-0.75); electron1.posX(5); electron2.posY(3); electron3.posZ(4); while(true){ neutron10.rotZ(GG.dt()*15); neutron6.rotX(GG.dt()*50); neutron8.rotY(GG.dt()*50); GG.camera().posZ(15+Math.sin(now/second*1)); GG.nextFrame() => now; }