5-15, 5-16, and 4-12 correctly this time

This commit is contained in:
2021-09-21 19:57:13 -07:00
parent 2f82b4615f
commit fbbc3ccbc2
3 changed files with 396 additions and 19 deletions

View File

@@ -164,28 +164,61 @@
ctx.beginPath();
ctx.arc(xPos, yPos, 100, 0, Math.PI * 2);
ctx.stroke();
for (i = 0; i < n; i++)
if (m % 2 == 0)
{
if (2 * w * Math.sin(Math.PI * m / n) > 0.0001)
mn = Math.floor(m / 2);
console.log("cos" + mn.toString());
for (i = 0; i < n; i++)
{
var theta = Math.PI * 2 * i / n;
theta += Math.cos(i * 2 * Math.PI * m / n) * amp * Math.cos(2 * w * Math.sin(Math.PI * m / n) * t);
var theta2 = Math.PI * 2 * (i + 1) / n;
theta2 += Math.cos((i+1) * 2 * Math.PI * m / n) * amp * Math.cos(2 * w * Math.sin(Math.PI * m / n) * t);
ctx.beginPath();
ctx.arc(xPos + 100 * Math.cos(theta), yPos + 100 * Math.sin(theta), 10, 0, Math.PI * 2);
ctx.fill();
connectTwoTheta(theta, theta2);
} else
if (2 * w * Math.sin(Math.PI * mn / n) > 0.0001)
{
var theta = Math.PI * 2 * i / n;
theta += Math.cos(i * 2 * Math.PI * mn / n) * amp * Math.cos(2 * w * Math.sin(Math.PI * mn / n) * t);
var theta2 = Math.PI * 2 * (i + 1) / n;
theta2 += Math.cos((i+1) * 2 * Math.PI * mn / n) * amp * Math.cos(2 * w * Math.sin(Math.PI * mn / n) * t);
ctx.beginPath();
ctx.arc(xPos + 100 * Math.cos(theta), yPos + 100 * Math.sin(theta), 10, 0, Math.PI * 2);
ctx.fill();
connectTwoTheta(theta, theta2);
} else
{
var theta = Math.PI * 2 * i / n;
theta += Math.cos(i * 2 * Math.PI * mn / n) * amp * w * t;
var theta2 = Math.PI * 2 * (i + 1) / n;
theta2 += Math.cos((i+1) * 2 * Math.PI * mn / n) * amp * w * t;
ctx.beginPath();
ctx.arc(xPos + 100 * Math.cos(theta), yPos + 100 * Math.sin(theta), 10, 0, Math.PI * 2);
ctx.fill();
connectTwoTheta(theta, theta2);
}
}
} else
{
mn = Math.floor(m / 2);
console.log("sin" + mn.toString());
for (i = 0; i < n; i++)
{
var theta = Math.PI * 2 * i / n;
theta += Math.cos(i * 2 * Math.PI * m / n) * amp * w * t;
var theta2 = Math.PI * 2 * (i + 1) / n;
theta2 += Math.cos((i+1) * 2 * Math.PI * m / n) * amp * w * t;
ctx.beginPath();
ctx.arc(xPos + 100 * Math.cos(theta), yPos + 100 * Math.sin(theta), 10, 0, Math.PI * 2);
ctx.fill();
connectTwoTheta(theta, theta2);
if (2 * w * Math.sin(Math.PI * mn / n) > 0.0001)
{
var theta = Math.PI * 2 * i / n;
theta += Math.sin(i * 2 * Math.PI * mn / n) * amp * Math.cos(2 * w * Math.sin(Math.PI * mn / n) * t);
var theta2 = Math.PI * 2 * (i + 1) / n;
theta2 += Math.sin((i+1) * 2 * Math.PI * mn / n) * amp * Math.cos(2 * w * Math.sin(Math.PI * mn / n) * t);
ctx.beginPath();
ctx.arc(xPos + 100 * Math.cos(theta), yPos + 100 * Math.sin(theta), 10, 0, Math.PI * 2);
ctx.fill();
connectTwoTheta(theta, theta2);
} else
{
var theta = Math.PI * 2 * i / n;
theta += Math.cos(i * 2 * Math.PI * mn / n) * amp * w * t;
var theta2 = Math.PI * 2 * (i + 1) / n;
theta2 += Math.cos((i+1) * 2 * Math.PI * mn / n) * amp * w * t;
ctx.beginPath();
ctx.arc(xPos + 100 * Math.cos(theta), yPos + 100 * Math.sin(theta), 10, 0, Math.PI * 2);
ctx.fill();
connectTwoTheta(theta, theta2);
}
}
}
}