Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
//"Siv3D January 2016"を使用
# include <Siv3D.hpp>
void Main()
{
double x[300], y[300];//座標[更新回数]
double t = 0;//距離
const double dt = 0.03;//微小距離
int m = 450;//図をm倍に拡大
x[0] = 0;//初期値
y[0] = 0;//初期値
int n = (sizeof(x) / sizeof(x[0])) <= (sizeof(y) / sizeof(y[0])) ? sizeof(x) / sizeof(x[0]) : sizeof(y) / sizeof(y[0]);
for (int i = 1; i < n; i++)
{
x[i] = x[i - 1] + m * (cos(t*t) + 4 * cos(pow(t + dt / 2, 2.)) + cos(pow(t + dt, 2.)))*dt / 6;//間違えたので修正2016/02/20
y[i] = y[i - 1] + m * (sin(t*t) + 4 * sin(pow(t + dt / 2, 2.)) + sin(pow(t + dt, 2.)))*dt / 6;//間違えたので修正2016/02/20
t += dt;
}
LineString lines(n, Vec2(0, 0));// 線を作成
for (int i = 0; i < n; i++)
{
lines.point(i).set(x[i], y[i]);
}
while (System::Update())
{
lines.draw(1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment