Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Raclamusi opened this issue Feb 29, 2024 · 0 comments

Comments

@Raclamusi
Copy link
Member

始点と終点が一致するような 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();
	}
}

スクリーンショット


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

if (points.front() == points.back())
{
const boost::geometry::strategy::buffer::end_flat end_strategy{};
boost::geometry::buffer(gLineString(points.begin(), points.end()), multiPolygon, distance_strategy, side_strategy, join_strategy, end_strategy, circle_strategy);
}
else
{
const boost::geometry::strategy::buffer::end_round end_strategy{ static_cast<size_t>(bufferQuality) };
boost::geometry::buffer(gLineString(points.begin(), points.end()), multiPolygon, distance_strategy, side_strategy, join_strategy, end_strategy, circle_strategy);
}

@Reputeless Reputeless moved this to Investigating in v0.6 Roadmap Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Investigating
Development

No branches or pull requests

1 participant