Siv3D / OpenSiv3D

C++20 framework for creative coding 🎮🎨🎹 / Cross-platform support (Windows, macOS, Linux, and the Web)
https://siv3d.github.io/
MIT License
994 stars 136 forks source link

LineString::calculateRoundBuffer() で始点と終点が一致するときに終端が丸くならない #1208

Open Raclamusi opened 5 months ago

Raclamusi commented 5 months ago

始点と終点が一致するような LineString のバッファを LineString::calculateRoundBuffer() で計算するとき、得られるポリゴンの終端が丸くならない問題があります。

# include <Siv3D.hpp>

void Main()
{
    Window::Resize(300, 200);

    const LineString lineString
    {
        Vec2{ 150, 50 },
        Vec2{ 92, 150 },
        Vec2{ 208, 150 },
        Vec2{ 150, 50 },
    };

    const auto polygon = lineString.calculateRoundBuffer(10);

    while (System::Update())
    {
        polygon.draw();
    }
}

スクリーンショット


ただ、これは明らかに意図的に書かれた処理で、こうしないといけない理由があったのかどうか気になります。

https://github.com/Siv3D/OpenSiv3D/blob/a5a6d7bf1e0399a53607eebd956472fd15026c55/Siv3D/src/Siv3D/Polygon/PolygonDetail.cpp?ts=4#L1318-L1327