資源簡介
weiler-athenton算法的求交點過程。
自己寫的。花了好多天。
有問題歡迎大家指出。
代碼片段和文件信息
#include
#include
#include
#include
#define?PRECISE?1 //用來表示兩個實數的精度,這個要大一點,因為像素的精度比較小,都是整數
#define?RATE_PRECISE?0.00001 //用來表示斜率的經度,這個要小一點
using?namespace?std;
typedef?struct?node
{
int?id;//用來標記是第幾個點,如果是交點的話,還需要對交點進行標號。
int?x;
int?y;
int?tag;//表示結點的類型,0表示多邊形的頂點,1表示入點,2表示出點
int?distance;
struct?node?*?next;//用來連接到下一個點
struct?node?*?same;
}Node*LNode;
int?four_abandon_five_add(double?k)
{
return?(int)(k?+?0.5);
}
//主多邊形的頂點數
int?n;
//為每條邊生成一個唯一的id
static?int?uuid?=?0;
int?get_uuid()
{
return?uuid++;
}
//剪裁多邊形的頂點數
int?m_outer;
int?m_inner;
LNode?makeNode(int?xint?yint?tag)
{
LNode?node?=?(LNode)malloc(sizeof(Node));
node->x?=?x;
node->y?=?y;
node->tag?=?tag;
node->distance?=?0;
node->next?=
- 上一篇:B樣條和貝塞爾曲線的畫法
- 下一篇:fftss算法源碼 C++
評論
共有 條評論