diff --git a/problem3-1.html b/problem3-1.html index 5d5323f..c4c7ba3 100644 --- a/problem3-1.html +++ b/problem3-1.html @@ -154,26 +154,6 @@ ctx.beginPath(); ctx.arc(xPos - 20, yPos - (100 - y1), Math.PI * Math.sqrt(m1), 0, Math.PI * 2); ctx.fill(); - /*ctx.beginPath(); - ctx.arc(xPos + lx / 2, yPos, pulleyR, 0, Math.PI * 2); - ctx.stroke(); - ctx.beginPath(); - ctx.arc(xPos - lx / 2, yPos, pulleyR, 0, Math.PI * 2); - ctx.stroke(); - ctx.beginPath(); - ctx.moveTo(xPos + lx / 2 + pulleyR, yPos); - ctx.lineTo(xPos + lx / 2 + pulleyR + r * Math.sin(theta), yPos - r * Math.cos(theta)); - ctx.stroke(); - ctx.beginPath(); - ctx.moveTo(xPos - lx / 2 - pulleyR, yPos); - ctx.lineTo(xPos - lx / 2 - pulleyR, yPos - (250 - r)); - ctx.stroke(); - ctx.beginPath(); - ctx.arc(xPos + lx / 2 + pulleyR + r * Math.sin(theta), yPos - r * Math.cos(theta), 5, 0, Math.PI * 2); - ctx.fill(); - ctx.beginPath(); - ctx.arc(xPos - lx / 2 - pulleyR, yPos - (250 - r), 5, 0, Math.PI * 2); - ctx.fill();*/ } diff --git a/problem3-2.html b/problem3-2.html index 1387412..2971dba 100644 --- a/problem3-2.html +++ b/problem3-2.html @@ -91,10 +91,10 @@ calcAccelerations(); //Relative position of canvas var xPos = 0; - var yPos = 70; + var yPos = 90; //Moves and scales canvas ctx.translate(ctx.canvas.width / 2, ctx.canvas.height / 2) - ctx.scale(2, -2); + ctx.scale(1.5, -1.5); function calcAccelerations() { @@ -144,15 +144,15 @@ { Reset(); } - if (75 - y2 - y1 <= 20) + if (100 - y2 - y1 <= 20) { Reset(); } - if (75 - y3 - y1 <= 20) + if (100 - y3 - y1 <= 20) { Reset(); } - if (75 + y1 <= 35) + if (100 + y1 <= 35) { Reset(); } @@ -176,52 +176,32 @@ ctx.stroke(); ctx.beginPath(); ctx.moveTo(xPos - 20, yPos); - ctx.lineTo(xPos - 20, yPos - (75 - y1)); + ctx.lineTo(xPos - 20, yPos - (100 - y1)); ctx.stroke(); ctx.beginPath(); - ctx.arc(xPos - 20, yPos - (75 - y1), Math.PI * Math.sqrt(m1), 0, Math.PI * 2); + ctx.arc(xPos - 20, yPos - (100 - y1), Math.PI * Math.sqrt(m1), 0, Math.PI * 2); ctx.fill(); ctx.beginPath(); ctx.moveTo(xPos + 20, yPos); - ctx.lineTo(xPos + 20, yPos - (75 + y1)); + ctx.lineTo(xPos + 20, yPos - (100 + y1)); ctx.stroke(); ctx.beginPath(); - ctx.arc(xPos + 20, yPos - (75 + y1), 20, 0, Math.PI * 2); + ctx.arc(xPos + 20, yPos - (100 + y1), 20, 0, Math.PI * 2); ctx.stroke(); ctx.beginPath(); - ctx.moveTo(xPos, yPos - (75 + y1)); - ctx.lineTo(xPos, yPos - (150 - y2)); + ctx.moveTo(xPos, yPos - (100 + y1)); + ctx.lineTo(xPos, yPos - (200 - y2)); ctx.stroke(); ctx.beginPath(); - ctx.arc(xPos, yPos - (150 - y2), Math.PI * Math.sqrt(m2), 0, Math.PI * 2); + ctx.arc(xPos, yPos - (200 - y2), Math.PI * Math.sqrt(m2), 0, Math.PI * 2); ctx.fill(); ctx.beginPath(); - ctx.moveTo(xPos + 40, yPos - (75 + y1)); - ctx.lineTo(xPos + 40, yPos - (150 - y3)); + ctx.moveTo(xPos + 40, yPos - (100 + y1)); + ctx.lineTo(xPos + 40, yPos - (200 - y3)); ctx.stroke(); ctx.beginPath(); - ctx.arc(xPos + 40, yPos - (150 - y3), Math.PI * Math.sqrt(m3), 0, Math.PI * 2); + ctx.arc(xPos + 40, yPos - (200 - y3), Math.PI * Math.sqrt(m3), 0, Math.PI * 2); ctx.fill(); - /*ctx.beginPath(); - ctx.arc(xPos + lx / 2, yPos, pulleyR, 0, Math.PI * 2); - ctx.stroke(); - ctx.beginPath(); - ctx.arc(xPos - lx / 2, yPos, pulleyR, 0, Math.PI * 2); - ctx.stroke(); - ctx.beginPath(); - ctx.moveTo(xPos + lx / 2 + pulleyR, yPos); - ctx.lineTo(xPos + lx / 2 + pulleyR + r * Math.sin(theta), yPos - r * Math.cos(theta)); - ctx.stroke(); - ctx.beginPath(); - ctx.moveTo(xPos - lx / 2 - pulleyR, yPos); - ctx.lineTo(xPos - lx / 2 - pulleyR, yPos - (250 - r)); - ctx.stroke(); - ctx.beginPath(); - ctx.arc(xPos + lx / 2 + pulleyR + r * Math.sin(theta), yPos - r * Math.cos(theta), 5, 0, Math.PI * 2); - ctx.fill(); - ctx.beginPath(); - ctx.arc(xPos - lx / 2 - pulleyR, yPos - (250 - r), 5, 0, Math.PI * 2); - ctx.fill();*/ } @@ -229,7 +209,7 @@ c.width = window.innerWidth; c.height = window.innerHeight; ctx.translate(c.width / 2, c.height / 2); - ctx.scale(2, -2); + ctx.scale(1.5, -1.5); }, true); Update(); diff --git a/problem3-3.html b/problem3-3.html new file mode 100644 index 0000000..dbd37d7 --- /dev/null +++ b/problem3-3.html @@ -0,0 +1,139 @@ + + +
+
+ This work is licensed under
+ CC BY-NC-ND 4.0