91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2KB
    文件類型: .cpp
    金幣: 1
    下載: 1 次
    發(fā)布日期: 2021-10-20
  • 語言: C/C++
  • 標(biāo)簽: C??

資源簡介

用c寫的道格拉斯普克算法,是對(duì)點(diǎn)的壓縮存儲(chǔ)及其有效的一種方法

資源截圖

代碼片段和文件信息

#include
#include
#include
#include
#define?NULL?0
#define?LEN?sizeof(struct?point)

struct?point
{
char?ptname[8];
float?x;
float?y;
struct?point?*next;
};

struct?point*?creat(void)
{
struct?point?*head;
struct?point?*p1*p2;
int?n=0;
p1=p2=(struct?point*)malloc(LEN);
scanf(“%s“p1->ptname);
head=NULL;
while(strcmp(p1->ptname“finish“)!=0)
{
printf(“請(qǐng)輸入該點(diǎn)X?Y坐標(biāo)\n“);
scanf(“%f%f“&p1->x&p1->y);
n=n+1;
if(n==1)?
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct?point*)malloc(LEN);
printf(“請(qǐng)輸入下一點(diǎn)點(diǎn)名\n“);
scanf(“%s“p1->ptname);
}
p2->next=NULL;
return(head);
}

struct?point?*getlast(struct?point?*p)
{
while(p->next!=NULL)
p=p->next;
return?p;
}

float?len(float?x1float?y1float?x2float?y2float?x3float?y3)
{
float?abcsh;
a=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
b=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
c=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
s=0.5*(a+b+c);
h=(sqrt(s*(s-a)*(s-b)*(s-c)))*2/c;
return?h;
}

void?doglas(struct?point?*headstruct?point?*lastfloat?si

評(píng)論

共有 條評(píng)論