亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tri.c

?? 是Computational Geometry in C中的原程序
?? C
字號(hào):
/*This code is described in "Computational Geometry in C" (Second Edition),Chapter 1.  It is not written to be comprehensible without the explanation in that book.Input: 2n integer coordinates for vertices of a simple polygon,       in counterclockwise order.  NB: the code will not work       for points in clockwise order!Output: the diagonals of a triangulation, in PostScript.Compile: gcc -o tri tri.c (or simply: make)Written by Joseph O'Rourke, with contributions by Min Xu.Last modified: October 1997Questions to orourke@cs.smith.edu.--------------------------------------------------------------------This code is Copyright 1998 by Joseph O'Rourke.  It may be freely redistributed in its entirety provided that this copyright notice is not removed.--------------------------------------------------------------------*/#include <stdio.h>#include <math.h>#define	EXIT_FAILURE 1#define	X 0#define	Y 1typedef	enum { FALSE, TRUE } bool;#define	DIM 2               /* Dimension of points */typedef	int tPointi[DIM];   /* Type integer point */typedef	struct tVertexStructure tsVertex;	/* Used only in NEW(). */typedef	tsVertex *tVertex;struct	tVertexStructure {   int		vnum;		/* Index */   tPointi	v;		/* Coordinates */   bool 	ear;		/* TRUE iff an ear */   tVertex 	next,prev;};/* Global variable definitions */tVertex	vertices  = NULL;	/* "Head" of circular list. */int	nvertices = 0;		/* Total number of polygon vertices. */#include "macros.h"	/* NEW, ADD *//*---------------------------------------------------------------------Function prototypes.---------------------------------------------------------------------*/int	AreaPoly2( void );void	Triangulate( void );void	EarInit( void );bool	Diagonal( tVertex a, tVertex b );bool	Diagonalie( tVertex a, tVertex b );bool	InCone( tVertex a, tVertex b );int     Area2( tPointi a, tPointi b, tPointi c );int     AreaSign( tPointi a, tPointi b, tPointi c );bool	Xor( bool x, bool y );bool	Left( tPointi a, tPointi b, tPointi c );bool	LeftOn( tPointi a, tPointi b, tPointi c );bool	Collinear( tPointi a, tPointi b, tPointi c );bool	Between( tPointi a, tPointi b, tPointi c );bool	Intersect( tPointi a, tPointi b, tPointi c, tPointi d );bool	IntersectProp( tPointi a, tPointi b, tPointi c, tPointi d );tVertex	MakeNullVertex( void );void	ReadVertices( void );void	PrintVertices( void );void	PrintDiagonal( tVertex a, tVertex b );void	PrintPoly( void );/*-------------------------------------------------------------------*/main(){   ReadVertices();   PrintVertices();   printf("%%Area of polygon = %g\n", 0.5 * AreaPoly2() );   Triangulate();   printf("showpage\n%%%%EOF\n");}/*---------------------------------------------------------------------Returns twice the signed area of the triangle determined by a,b,c.The area is positive if a,b,c are oriented ccw, negative if cw,and zero if the points are collinear.---------------------------------------------------------------------*/int     Area2( tPointi a, tPointi b, tPointi c ){   return          (b[X] - a[X]) * (c[Y] - a[Y]) -          (c[X] - a[X]) * (b[Y] - a[Y]);}/*---------------------------------------------------------------------Exclusive or: TRUE iff exactly one argument is true.---------------------------------------------------------------------*/bool	Xor( bool x, bool y ){   /* The arguments are negated to ensure that they are 0/1 values. */   /* (Idea due to Michael Baldwin.) */   return   !x ^ !y;}/*---------------------------------------------------------------------Returns true iff ab properly intersects cd: they sharea point interior to both segments.  The properness of theintersection is ensured by using strict leftness.---------------------------------------------------------------------*/bool	IntersectProp( tPointi a, tPointi b, tPointi c, tPointi d ){   /* Eliminate improper cases. */   if (      Collinear(a,b,c) ||      Collinear(a,b,d) ||      Collinear(c,d,a) ||      Collinear(c,d,b)      )      return FALSE;   return         Xor( Left(a,b,c), Left(a,b,d) )      && Xor( Left(c,d,a), Left(c,d,b) );}/*---------------------------------------------------------------------Returns true iff c is strictly to the left of the directedline through a to b.---------------------------------------------------------------------*/bool	Left( tPointi a, tPointi b, tPointi c ){    return  AreaSign( a, b, c ) > 0;}bool	LeftOn( tPointi a, tPointi b, tPointi c ){   return  AreaSign( a, b, c ) >= 0;}bool	Collinear( tPointi a, tPointi b, tPointi c ){   return  AreaSign( a, b, c ) == 0;}/*---------------------------------------------------------------------Returns TRUE iff point c lies on the closed segement ab.First checks that c is collinear with a and b.---------------------------------------------------------------------*/bool	Between( tPointi a, tPointi b, tPointi c ){   tPointi	ba, ca;   if ( ! Collinear( a, b, c ) )      return  FALSE;   /* If ab not vertical, check betweenness on x; else on y. */   if ( a[X] != b[X] )       return ((a[X] <= c[X]) && (c[X] <= b[X])) ||             ((a[X] >= c[X]) && (c[X] >= b[X]));   else      return ((a[Y] <= c[Y]) && (c[Y] <= b[Y])) ||             ((a[Y] >= c[Y]) && (c[Y] >= b[Y]));}/*---------------------------------------------------------------------Returns TRUE iff segments ab and cd intersect, properly or improperly.---------------------------------------------------------------------*/bool	Intersect( tPointi a, tPointi b, tPointi c, tPointi d ){   if      ( IntersectProp( a, b, c, d ) )      return  TRUE;   else if (   Between( a, b, c )            || Between( a, b, d )            || Between( c, d, a )            || Between( c, d, b )           )      return  TRUE;   else    return  FALSE;}/*---------------------------------------------------------------------Returns TRUE iff (a,b) is a proper internal *or* externaldiagonal of P, *ignoring edges incident to a and b*.---------------------------------------------------------------------*/bool   Diagonalie( tVertex a, tVertex b ){   tVertex c, c1;   /* For each edge (c,c1) of P */   c = vertices;   do {      c1 = c->next;      /* Skip edges incident to a or b */      if (    ( c != a ) && ( c1 != a )           && ( c != b ) && ( c1 != b )           && Intersect( a->v, b->v, c->v, c1->v )         )         return FALSE;      c = c->next;   } while ( c != vertices );   return TRUE;}/*---------------------------------------------------------------------This function initializes the data structures, and callsTriangulate2 to clip off the ears one by one.---------------------------------------------------------------------*/void   EarInit( void ){   tVertex v0, v1, v2;   /* three consecutive vertices */   /* Initialize v1->ear for all vertices. */   v1 = vertices;   printf("newpath\n");   do {      v2 = v1->next;      v0 = v1->prev;      v1->ear = Diagonal( v0, v2 );      v1 = v1->next;   } while ( v1 != vertices );   printf("closepath stroke\n\n");}/*---------------------------------------------------------------------Prints out n-3 diagonals (as pairs of integer indices)which form a triangulation of P.---------------------------------------------------------------------*/void   Triangulate( void ){   tVertex v0, v1, v2, v3, v4;	/* five consecutive vertices */   int   n = nvertices;		/* number of vertices; shrinks to 3. */   bool earfound;		/* for debugging and error detection only. */   EarInit();   printf("\nnewpath\n");   /* Each step of outer loop removes one ear. */   while ( n > 3 ) {           /* Inner loop searches for an ear. */      v2 = vertices;      earfound = FALSE;      do {         if (v2->ear) {            earfound = TRUE;            /* Ear found. Fill variables. */            v3 = v2->next; v4 = v3->next;            v1 = v2->prev; v0 = v1->prev;            /* (v1,v3) is a diagonal */            PrintDiagonal( v1, v3 );                        /* Update earity of diagonal endpoints */            v1->ear = Diagonal( v0, v3 );            v3->ear = Diagonal( v1, v4 );                        /* Cut off the ear v2 */            v1->next = v3;            v3->prev = v1;            vertices = v3;	/* In case the head was v2. */            n--;            break;   /* out of inner loop; resume outer loop */         } /* end if ear found */         v2 = v2->next;      } while ( v2 != vertices );      if ( !earfound ) {         printf("%%Error in Triangulate:  No ear found.\n");         PrintPoly();         printf("showpage\n%%%%EOF\n");         exit(EXIT_FAILURE);      }   } /* end outer while loop */   printf("closepath stroke\n\n");}/*---------------------------------------------------------------------Returns TRUE iff the diagonal (a,b) is strictly internal to the polygon in the neighborhood of the a endpoint.  ---------------------------------------------------------------------*/bool   InCone( tVertex a, tVertex b ){   tVertex a0,a1;	/* a0,a,a1 are consecutive vertices. */   a1 = a->next;   a0 = a->prev;   /* If a is a convex vertex ... */   if( LeftOn( a->v, a1->v, a0->v ) )       return    Left( a->v, b->v, a0->v )              && Left( b->v, a->v, a1->v );   /* Else a is reflex: */       return !(    LeftOn( a->v, b->v, a1->v )                 && LeftOn( b->v, a->v, a0->v ) );}/*---------------------------------------------------------------------Returns TRUE iff (a,b) is a proper internal diagonal.---------------------------------------------------------------------*/bool	Diagonal( tVertex a, tVertex b ){   return InCone( a, b ) && InCone( b, a ) && Diagonalie( a, b );}/*---------------------------------------------------------------------ReadVertices: Reads in the vertices, and links them into a circularlist with MakeNullVertex.  There is no need for the # of vertices to bethe first line: the function looks for EOF instead.---------------------------------------------------------------------*/void   ReadVertices( void ){   tVertex	v;   int		x, y;   int		vnum = 0;   while ( scanf ("%d %d", &x, &y ) != EOF )  {      v = MakeNullVertex();      v->v[X] = x;      v->v[Y] = y;      v->vnum = vnum++;   }   nvertices = vnum;   if (nvertices < 3)       printf("%%Error in ReadVertices: nvertices=%d<3\n", nvertices),      exit(EXIT_FAILURE);}/*---------------------------------------------------------------------MakeNullVertex: Makes a vertex.---------------------------------------------------------------------*/tVertex   MakeNullVertex( void ){   tVertex  v;      NEW( v, tsVertex );   ADD( vertices, v );   return v;}/*---------------------------------------------------------------------For debugging; not currently invoked.---------------------------------------------------------------------*/void   PrintPoly( void ){   tVertex  v;   printf("%%Polygon circular list:\n");   v = vertices;   do {                                       printf( "%% vnum=%5d:\tear=%d\n", v->vnum, v->ear );      v = v->next;   } while ( v != vertices );}/*---------------------------------------------------------------------Print: Prints out the vertices.  Uses the vnum indices corresponding to the order in which the vertices were input.Output is in PostScript format.---------------------------------------------------------------------*/void   PrintVertices( void ){   /* Pointers to vertices, edges, faces. */   tVertex  v;   int xmin, ymin, xmax, ymax;   /* Compute bounding box for Encapsulated PostScript. */   v = vertices;   xmin = xmax = v->v[X];   ymin = ymax = v->v[Y];   do {      if      ( v->v[X] > xmax ) xmax = v->v[X];      else if ( v->v[X] < xmin ) xmin = v->v[X];      if      ( v->v[Y] > ymax ) ymax = v->v[Y];      else if ( v->v[Y] < ymin ) ymin = v->v[Y];      v = v->next;   } while ( v != vertices );      /* PostScript header */   printf("%%!PS\n");   printf("%%%%Creator: tri.c (Joseph O'Rourke)\n");   printf("%%%%BoundingBox: %d %d %d %d\n", xmin, ymin, xmax, ymax);   printf("%%%%EndComments\n");   printf(".00 .00 setlinewidth\n");   printf("%d %d translate\n", -xmin+72, -ymin+72 );   /* The +72 shifts the figure one inch from the lower left corner */   /* Output vertex info as a PostScript comment. */   printf("\n%% number of vertices = %d\n", nvertices);   v = vertices;   do {                                       printf( "%% vnum=%5d:\tx=%5d\ty=%5d\n", v->vnum, v->v[X], v->v[Y] );      v = v->next;   } while ( v != vertices );   /* Draw the polygon. */   printf("\n%%Polygon:\n");   printf("newpath\n");   v = vertices;   printf("%d\t%d\tmoveto\n", v->v[X], v->v[Y] );   v = v->next;   do {                                       printf("%d\t%d\tlineto\n", v->v[X], v->v[Y] );      v = v->next;   } while ( v != vertices );   printf("closepath stroke\n");}void	PrintDiagonal( tVertex a, tVertex b ){   printf("%%Diagonal: (%d,%d)\n", a->vnum, b->vnum );   printf("%d\t%d\tmoveto\n", a->v[X], a->v[Y] );   printf("%d\t%d\tlineto\n", b->v[X], b->v[Y] );}int	AreaPoly2( void ){   int     sum = 0;   tVertex p, a;   p = vertices;   /* Fixed. */   a = p->next;    /* Moving. */   do {      sum += Area2( p->v, a->v, a->next->v );      a = a->next;   } while ( a->next != vertices );   return sum;}int     AreaSign( tPointi a, tPointi b, tPointi c ){    double area2;    area2 = ( b[0] - a[0] ) * (double)( c[1] - a[1] ) -            ( c[0] - a[0] ) * (double)( b[1] - a[1] );    /* The area should be an integer. */    if      ( area2 >  0.5 ) return  1;    else if ( area2 < -0.5 ) return -1;    else                     return  0;}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
caoporn国产一区二区| 亚洲国产sm捆绑调教视频| 亚洲另类春色国产| 亚洲bdsm女犯bdsm网站| 免费在线观看一区| 成人一区二区三区视频在线观看| 色综合久久中文综合久久牛| 在线不卡的av| 国产片一区二区| 亚洲sss视频在线视频| 精东粉嫩av免费一区二区三区 | 精品国产乱码久久久久久免费| 久久精品在线免费观看| 亚洲一级片在线观看| 麻豆91在线播放免费| 91美女视频网站| 日韩欧美的一区| 亚洲天堂2014| 六月丁香婷婷色狠狠久久| 不卡av在线免费观看| 欧美天堂一区二区三区| 久久婷婷久久一区二区三区| 伊人婷婷欧美激情| 国产一区二区三区观看| 欧美色图天堂网| 国产日韩av一区二区| 亚洲综合色成人| 国产成人自拍高清视频在线免费播放| 欧美视频在线播放| 国产精品天天摸av网| 捆绑紧缚一区二区三区视频| 一本到三区不卡视频| 久久久久久一级片| 婷婷国产在线综合| 91麻豆成人久久精品二区三区| 久久久国产综合精品女国产盗摄| 午夜精品福利视频网站| 色综合视频在线观看| 国产喷白浆一区二区三区| 日韩高清不卡一区二区三区| 色婷婷综合久久久| 亚洲国产精品精华液ab| 精品亚洲国内自在自线福利| 制服.丝袜.亚洲.中文.综合| 樱桃国产成人精品视频| 成人一级片在线观看| 欧美成人一区二区三区在线观看| 亚洲大片免费看| 欧美xxxxxxxxx| 亚洲国产一区二区a毛片| 成人av免费在线播放| 国产网红主播福利一区二区| 美女mm1313爽爽久久久蜜臀| 欧美日韩一区二区三区高清 | 欧日韩精品视频| 亚洲日本成人在线观看| 成人免费视频国产在线观看| 久久先锋资源网| 国产原创一区二区| 精品免费国产二区三区| 久久精品国产久精国产| 日韩一区二区三区在线视频| 日日夜夜精品免费视频| 欧美三级在线视频| 亚洲国产综合人成综合网站| 在线亚洲高清视频| 一区二区三区在线观看欧美| 一本色道亚洲精品aⅴ| 综合婷婷亚洲小说| 成人动漫中文字幕| 亚洲欧洲精品一区二区精品久久久| 国产精品亚洲专一区二区三区| www激情久久| 国产裸体歌舞团一区二区| 欧美成人伊人久久综合网| 精品系列免费在线观看| www精品美女久久久tv| 国产美女主播视频一区| 国产日韩欧美综合一区| 国产.欧美.日韩| 国产精品久久综合| 91麻豆精东视频| 亚洲一二三区在线观看| 欧美色成人综合| 免费久久精品视频| 26uuuu精品一区二区| 国产久卡久卡久卡久卡视频精品| 国产亚洲欧洲一区高清在线观看| 粉嫩在线一区二区三区视频| 亚洲欧洲在线观看av| 91视频观看视频| 亚洲高清不卡在线| 日韩视频一区二区三区| 国产精品亚洲成人| 国产精品第13页| 欧美日韩激情一区| 六月丁香婷婷久久| 欧美极品美女视频| 日本高清免费不卡视频| 午夜精品国产更新| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 六月丁香婷婷久久| 国产亚洲欧美激情| 91丨九色丨黑人外教| 亚洲国产精品一区二区www在线| 欧美一区二区私人影院日本| 国产成人亚洲精品青草天美| 亚洲图片另类小说| 91麻豆精品91久久久久同性| 国产精品456| 亚洲一区二区三区四区中文字幕| 日韩欧美一级二级三级久久久| 国产99久久久久| 亚洲成在线观看| 久久久精品黄色| 欧美性受极品xxxx喷水| 国产一区二区三区免费播放| 亚洲欧美日韩成人高清在线一区| 欧美一区二区三区啪啪| 成人黄色av电影| 日本一区中文字幕| 国产精品美女久久久久久| 欧美福利视频导航| 成人理论电影网| 日韩高清电影一区| 国产精品福利一区二区| 日韩写真欧美这视频| a级高清视频欧美日韩| 蜜臀av一区二区三区| 国产精品不卡视频| 欧美一级欧美一级在线播放| 91丨porny丨最新| 精品在线视频一区| 一区二区高清视频在线观看| 久久久三级国产网站| 亚洲午夜在线电影| 国产亚洲一区二区三区四区| 欧美日韩1234| 成人免费视频一区二区| 亚洲综合久久久久| 久久久久久夜精品精品免费| 另类小说色综合网站| 国产精品久久久久久久久免费相片| 粉嫩蜜臀av国产精品网站| 国产乱子伦视频一区二区三区| 日本不卡在线视频| 午夜精品福利一区二区三区蜜桃| 亚洲一二三区视频在线观看| 一二三四区精品视频| 亚洲精品成人精品456| 中文字幕综合网| 亚洲色图另类专区| 国产精品久久久久久户外露出 | 欧美激情综合五月色丁香| 国产日韩v精品一区二区| 国产午夜精品在线观看| 国产片一区二区| 国产精品嫩草99a| 成人欧美一区二区三区1314| 亚洲色图清纯唯美| 亚洲天堂中文字幕| 又紧又大又爽精品一区二区| 亚洲少妇中出一区| 一区二区三区在线视频免费| 一区二区三区在线高清| 一区二区三区影院| 亚洲国产欧美在线人成| 亚洲成a人片在线观看中文| 丝袜美腿亚洲色图| 蜜臀av性久久久久蜜臀aⅴ流畅| 麻豆91精品91久久久的内涵| 国产一区二区主播在线| 成人精品一区二区三区四区| 不卡视频一二三| 91福利小视频| 91.麻豆视频| 精品国产凹凸成av人导航| 久久婷婷色综合| 日韩一区欧美一区| 亚洲自拍偷拍综合| 蜜桃视频在线观看一区二区| 国模一区二区三区白浆| 本田岬高潮一区二区三区| 色猫猫国产区一区二在线视频| 欧美丰满嫩嫩电影| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 91性感美女视频| 欧美男同性恋视频网站| 精品福利一二区| 中文字幕一区视频| 亚洲电影一级片| 精品在线免费视频| 成人爱爱电影网址| 欧美在线视频你懂得| 日韩欧美的一区二区| 国产精品天美传媒沈樵| 亚洲高清免费在线| 久久成人久久鬼色| av色综合久久天堂av综合| 欧美日韩一区二区电影|