Skip to content

Instantly share code, notes, and snippets.

@Kuriboh-niconico
Last active February 20, 2016 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kuriboh-niconico/f00ce600fc4dd08f7acb to your computer and use it in GitHub Desktop.
Save Kuriboh-niconico/f00ce600fc4dd08f7acb to your computer and use it in GitHub Desktop.
//"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