光栅化二维多边形

2023-09-27C/C++开发问题
1

本文介绍了光栅化二维多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我需要从表示为点列表的封闭二维多边形创建二进制位图.能否请您指出高效且足够简单的算法来做到这一点,或者甚至更好一些 C++ 代码?

I need to create a binary bitmap from a closed 2D polygon represented as a list of points. Could you please point me to efficient and sufficiently simple algorithms to do that, or, even better, some C++ code?

非常感谢!

PS:我想避免向我的项目添加依赖项.不过如果你推荐一个开源库,我可以随时查看代码,所以它也很有用.

PS: I would like to avoid adding a dependency to my project. However if you suggest an open-source library, I can always look at the code, so it can be useful too.

推荐答案

你想要的神奇谷歌短语是非零缠绕规则"或偶数奇数多边形填充".

The magic google phrase you want is either "non-zero winding rule" or "even odd polygon fill".

查看维基百科条目:

  • 非零缠绕规则
  • 偶数多边形填充

两者都非常容易实现并且对于大多数用途来说足够快.稍微聪明一点,它们也可以进行抗锯齿处理.

Both are very easy to implement and sufficiently fast for most purposes. With some cleverness, they can be made antialiased as well.

这篇关于光栅化二维多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

无法访问 C++ std::set 中对象的非常量成员函数
Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)...
2024-08-14 C/C++开发问题
17

从 lambda 构造 std::function 参数
Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)...
2024-08-14 C/C++开发问题
25

STL BigInt 类实现
STL BigInt class implementation(STL BigInt 类实现)...
2024-08-14 C/C++开发问题
3

使用 std::atomic 和 std::condition_variable 同步不可靠
Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)...
2024-08-14 C/C++开发问题
17

在 STL 中将列表元素移动到末尾
Move list element to the end in STL(在 STL 中将列表元素移动到末尾)...
2024-08-14 C/C++开发问题
9

为什么禁止对存储在 STL 容器中的类重载 operator&()?
Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)...
2024-08-14 C/C++开发问题
6