aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrahiel <rahiel@protonmail.ch>2015-10-16 13:44:30 +0200
committerrahiel <rahiel@protonmail.ch>2015-10-16 13:44:39 +0200
commit1f8ee0b3f8843aa85cb5e22bbb37416df4a355e4 (patch)
treee38e929d3918283d19ca4813104d365b58bf23fd
parent2ab09842acbe2220485e0b7bacd57f4009ddea67 (diff)
add yin yang and goggles
-rw-r--r--sunsistemo.es6.js8
-rw-r--r--systems.es6.js36
2 files changed, 39 insertions, 5 deletions
diff --git a/sunsistemo.es6.js b/sunsistemo.es6.js
index 731e96f..87e4c19 100644
--- a/sunsistemo.es6.js
+++ b/sunsistemo.es6.js
@@ -29,7 +29,9 @@ let menuList = [
{"label":"Random Bodies", "function": systems.genBodies, "args": [200, true, false]},
{"label":"Angular Momentum", "function": systems.genBodiesRot, "args": [200, "planets", true, false]},
{"label":"Angular with Bounce", "function": systems.genBodiesRot, "args": [200,"balls", true, true, true]},
- {"label":"Butterfly", "function": systems.genButterFlyOne, "args": []}
+ {"label":"Butterfly", "function": systems.genButterFlyOne, "args": []},
+ {"label":"Yin Yang", "function": systems.genYinYang, "args": []},
+ {"label":"Goggles", "function": systems.genYinYang, "args": []}
// {"label":"Solar System", "function": systems.genSolarSystem, "args": [true] }
];
@@ -174,10 +176,10 @@ function init() {
// overall light
let ambient = new THREE.AmbientLight(0xf0f0f0);
scene.add(ambient);
-
+
}
-
+
renderer = new THREE.WebGLRenderer();
renderer.setClearColor(0x000000);
diff --git a/systems.es6.js b/systems.es6.js
index 6c2a112..2dcec65 100644
--- a/systems.es6.js
+++ b/systems.es6.js
@@ -3,7 +3,7 @@ let Vec3 = THREE.Vector3;
let textureSets = {
planets: ["earth", "jupiter", "mars", "mercury", "moon", "neptune",
- "pluto", "saturn", "uranus", "venus"],
+ "pluto", "saturn", "uranus", "venus"],
balls: ["tennisball", "softball"],
all: ["sun", "earth", "jupiter", "mars", "mercury", "moon", "neptune",
"pluto", "saturn", "uranus", "venus", "clouds", "tennisball"]
@@ -178,6 +178,7 @@ export function genSolarSystem(sunOn) {
sphereP: 32
};
}
+
export function gen2Bodies(sunOn) {
let rot = () => Math.random() / 30;
let s1 = new Body(1E19, new Vec3(0, 0, 0), new Vec3(0, -90, 0), 12, "sun", new Vec3(0, 0, rot()));
@@ -268,7 +269,38 @@ export function genBodiesRot(n, bodyTexture, sunOn, collisions) {
};
}
-export function genButterFlyOne() {
+export function genGoggles() { // I.B.5 goggles
+ let m = 1 / 6.67408E-11;
+ let s1 = new Body(m, new Vec3(-1, 0, 0), new Vec3(0.08330, 0.12789, 0), 0.05, "jupiter", new Vec3(0, 0.01, 0));
+ let s2 = new Body(m, new Vec3(-s1.r.x, 0, 0), new Vec3(s1.v.x, s1.v.y, 0), 0.05, "tennisball", new Vec3(0, 0.01, 0));
+ let s3 = new Body(m, new Vec3(0, 0, 0), new Vec3(-2 * s1.v.x, -2 * s1.v.y), 0.05, "earth", new Vec3(0, 0.03, 0));
+
+ return {
+ bodies: [s1, s2, s3],
+ stepsize: 0.00001,
+ stepsPerFrame: 500,
+ camera: {x: 0, y: 0, z: 2},
+ collisions: false
+ };
+}
+
+export function genYinYang() { // II.C.2a yin-yang I
+ let m = 1 / 6.67408E-11;
+ let s1 = new Body(m, new Vec3(-1, 0, 0), new Vec3(0.51394, 0.30474, 0), 0.05, "jupiter", new Vec3(0, 0.01, 0));
+ let s2 = new Body(m, new Vec3(-s1.r.x, 0, 0), new Vec3(s1.v.x, s1.v.y, 0), 0.05, "tennisball", new Vec3(0, 0.01, 0));
+ let s3 = new Body(m, new Vec3(0, 0, 0), new Vec3(-2 * s1.v.x, -2 * s1.v.y), 0.05, "earth", new Vec3(0, 0.03, 0));
+
+ return {
+ bodies: [s1, s2, s3],
+ stepsize: 0.00001,
+ stepsPerFrame: 500,
+ camera: {x: 0, y: 0, z: 2},
+ collisions: false
+ };
+}
+
+
+export function genButterFlyOne() { // I.A.1 butterfly I
let m = 1 / 6.67408E-11;
let s1 = new Body(m, new Vec3(-1, 0, 0), new Vec3(0.30689, 0.12551, 0), 0.05, "tennisball", new Vec3(0, 0.01, 0));
let s2 = new Body(m, new Vec3(-s1.r.x, 0, 0), new Vec3(s1.v.x, s1.v.y, 0), 0.05, "softball", new Vec3(0, 0.01, 0));