Skip to content

Instantly share code, notes, and snippets.

@comefrombottom
Last active June 28, 2024 08:50
Show Gist options
  • Save comefrombottom/12316a4c02501888c7521acae2d3cae9 to your computer and use it in GitHub Desktop.
Save comefrombottom/12316a4c02501888c7521acae2d3cae9 to your computer and use it in GitHub Desktop.
既約分数n/m角形の頂点を求める
# include <Siv3D.hpp> // Siv3D v0.6.14
//既約分数n/m角形の頂点を求める
LineString makeRegularRationalShapeLineString(const Vec2& center, double r, int32 n, int32 m)
{
LineString points(n);
for (auto i : step(n))
{
const double theta = Math::TwoPi / n * i * m;
points[i] = center + Circular(r, theta);
}
return points;
}
void Main()
{
while (System::Update())
{
makeRegularRationalShapeLineString(Scene::Center(), 100, 5, 2).drawClosed();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment