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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? inhedron.c

?? 是Computational Geometry in C中的原程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*This code is described in "Computational Geometry in C" (Second Edition),Chapter 7.  It is not written to be comprehensible without theexplanation in that book.Compile:    gcc -o inhedron inhedron.c -lm (or simply: make)Run (e.g.): inhedron < i.8Written by Joseph O'Rourke, with contributions by Min Xu.Last modified: April 1998Questions to orourke@cs.smith.edu.--------------------------------------------------------------------This code is Copyright 1998 by Joseph O'Rourke.  It may be freelyredistributed in its entirety provided that this copyright notice isnot removed.--------------------------------------------------------------------*/#include <stdio.h>#include <math.h>#define EXIT_FAILURE 1#define X 0#define Y 1#define Z 2#define MAX_INT   2147483647 typedef enum { FALSE, TRUE } bool;#define DIM 3                  /* Dimension of points */typedef int    tPointi[DIM];   /* Type integer point */typedef double tPointd[DIM];   /* Type double point */#define PMAX 10000             /* Max # of pts */tPointi Vertices[PMAX];        /* All the points */tPointi Faces[PMAX];           /* Each triangle face is 3 indices */int check = 0;tPointi Box[PMAX][2];          /* Box around each face *//*---------------------------------------------------------------------Function prototypes.---------------------------------------------------------------------*/char 	InPolyhedron( int F, tPointi q, tPointi bmin, tPointi bmax, int radius );char    SegPlaneInt( tPointi Triangle, tPointi q, tPointi r, tPointd p, int *m );int     PlaneCoeff( tPointi T, tPointd N, double *D );void    Assigndi( tPointd p, tPointi a );int     ReadVertices( void );int     ReadFaces( void );void    NormalVec( tPointi q, tPointi b, tPointi c, tPointd N );double  Dot( tPointi q, tPointd d );void    SubVec( tPointi q, tPointi b, tPointi c );char    InTri3D( tPointi T, int m, tPointi p );char    InTri2D( tPointi Tp[3], tPointi pp );int     AreaSign( tPointi q, tPointi b, tPointi c );char    SegTriInt( tPointi Triangle, tPointi q, tPointi r, tPointd p );char    InPlane( tPointi Triangle, int m, tPointi q, tPointi r, tPointd p);int     VolumeSign( tPointi a, tPointi b, tPointi c, tPointi d );char    SegTriCross( tPointi Triangle, tPointi q, tPointi r );int  	ComputeBox( int F, tPointi bmin, tPointi bmax );void 	RandomRay( tPointi ray, int radius );void 	AddVec( tPointi q, tPointi ray );int  	InBox( tPointi q, tPointi bmin, tPointi bmax );char 	BoxTest ( int n, tPointi a, tPointi b );void 	PrintPoint( tPointi q );int	irint( double x);/*-------------------------------------------------------------------*/main(){  int n, F, i;  tPointi q, bmin, bmax;  int radius;  srandom( (int) time( (long *) 0 ) );   n = ReadVertices();  F = ReadFaces();  /* Initialize the bounding box */  for ( i = 0; i < DIM; i++ )    bmin[i] = bmax[i] = Vertices[0][i];  radius = ComputeBox( n, bmin, bmax );  printf("radius=%d\n", radius);  while( scanf( "%d %d %d", &q[X], &q[Y], &q[Z] ) != EOF ) {    printf( "\n----------->q = %d %d %d\n",        q[X], q[Y], q[Z] );    printf( "In = %c\n",        InPolyhedron( F, q, bmin, bmax, radius ) );  }}/*  This function returns a char:    'V': the query point a coincides with a Vertex of polyhedron P.    'E': the query point a is in the relative interior of an Edge of polyhedron P.    'F': the query point a is in the relative interior of a Face of polyhedron P.    'i': the query point a is strictly interior to polyhedron P.    'o': the query point a is strictly exterior to( or outside of) polyhedron P.*/char InPolyhedron( int F, tPointi q, tPointi bmin, tPointi bmax, int radius ){   tPointi r;  /* Ray endpoint. */   tPointd p;  /* Intersection point; not used. */   int f, k = 0, crossings = 0;   char code = '?';    /* If query point is outside bounding box, finished. */   if ( !InBox( q, bmin, bmax ) )      return 'o';     LOOP:   while( k++ < F ) {      crossings = 0;        RandomRay( r, radius );       AddVec( q, r );       printf("Ray endpoint: (%d,%d,%d)\n", r[0],r[1],r[2] );        for ( f = 0; f < F; f++ ) {  /* Begin check each face */         if ( BoxTest( f, q, r ) == '0' ) {              code = '0';              printf("BoxTest = 0!\n");         }         else code = SegTriInt( Faces[f], q, r, p );         printf( "Face = %d: BoxTest/SegTriInt returns %c\n\n", f, code );         /* If ray is degenerate, then goto outer while to generate another. */         if ( code == 'p' || code == 'v' || code == 'e' ) {            printf("Degenerate ray\n");            goto LOOP;         }            /* If ray hits face at interior point, increment crossings. */         else if ( code == 'f' ) {            crossings++;            printf( "crossings = %d\n", crossings );         }         /* If query endpoint q sits on a V/E/F, return that code. */         else if ( code == 'V' || code == 'E' || code == 'F' )            return( code );         /* If ray misses triangle, do nothing. */         else if ( code == '0' )            ;         else             fprintf( stderr, "Error, exit(EXIT_FAILURE)\n" ), exit(1);      } /* End check each face */      /* No degeneracies encountered: ray is generic, so finished. */      break;   } /* End while loop */    printf( "Crossings = %d\n", crossings );   /* q strictly interior to polyhedron iff an odd number of crossings. */   if( ( crossings % 2 ) == 1 )      return   'i';   else return 'o';}int ComputeBox( int F, tPointi bmin, tPointi bmax ){  int i, j, k;  double radius;    for( i = 0; i < F; i++ )    for( j = 0; j < DIM; j++ ) {      if( Vertices[i][j] < bmin[j] )	bmin[j] = Vertices[i][j];      if( Vertices[i][j] > bmax[j] ) 	bmax[j] = Vertices[i][j];    }    radius = sqrt( pow( (double)(bmax[X] - bmin[X]), 2.0 ) +                 pow( (double)(bmax[Y] - bmin[Y]), 2.0 ) +                 pow( (double)(bmax[Z] - bmin[Z]), 2.0 ) );  printf("radius = %lf\n", radius);  return irint( radius +1 ) + 1;}/* Return a random ray endpoint */void RandomRay( tPointi ray, int radius ){  double x, y, z, w, t;  /* Generate a random point on a sphere of radius 1. */  /* the sphere is sliced at z, and a random point at angle t     generated on the circle of intersection. */  z = 2.0 * (double) random() / MAX_INT - 1.0;  t = 2.0 * M_PI * (double) random() / MAX_INT;  w = sqrt( 1 - z*z );  x = w * cos( t );  y = w * sin( t );    ray[X] = irint ( radius * x );  ray[Y] = irint ( radius * y );  ray[Z] = irint ( radius * z );    /*printf( "RandomRay returns %6d %6d %6d\n", ray[X], ray[Y], ray[Z] );*/}void AddVec( tPointi q, tPointi ray ){  int i;    for( i = 0; i < DIM; i++ )    ray[i] = q[i] + ray[i];}int InBox( tPointi q, tPointi bmin, tPointi bmax ){  int i;  if( ( bmin[X] <= q[X] ) && ( q[X] <= bmax[X] ) &&      ( bmin[Y] <= q[Y] ) && ( q[Y] <= bmax[Y] ) &&      ( bmin[Z] <= q[Z] ) && ( q[Z] <= bmax[Z] ) )    return TRUE;  return FALSE;}    /*---------------------------------------------------------------------    'p': The segment lies wholly within the plane.    'q': The q endpoint is on the plane (but not 'p').    'r': The r endpoint is on the plane (but not 'p').    '0': The segment lies strictly to one side or the other of the plane.    '1': The segement intersects the plane, and 'p' does not hold.---------------------------------------------------------------------*/char	SegPlaneInt( tPointi T, tPointi q, tPointi r, tPointd p, int *m){    tPointd N; double D;    tPointi rq;    double num, denom, t;    int i;    *m = PlaneCoeff( T, N, &D );    /*printf("m=%d; plane=(%lf,%lf,%lf,%lf)\n", m, N[X],N[Y],N[Z],D);*/    num = D - Dot( q, N );    SubVec( r, q, rq );    denom = Dot( rq, N );    /*printf("SegPlaneInt: num=%lf, denom=%lf\n", num, denom );*/    if ( denom == 0.0 ) {  /* Segment is parallel to plane. */       if ( num == 0.0 )   /* q is on plane. */           return 'p';       else           return '0';    }    else       t = num / denom;    /*printf("SegPlaneInt: t=%lf \n", t );*/    for( i = 0; i < DIM; i++ )       p[i] = q[i] + t * ( r[i] - q[i] );    if ( (0.0 < t) && (t < 1.0) )         return '1';    else if ( num == 0.0 )   /* t == 0 */         return 'q';    else if ( num == denom ) /* t == 1 */         return 'r';    else return '0';}/*---------------------------------------------------------------------Computes N & D and returns index m of largest component.---------------------------------------------------------------------*/int	PlaneCoeff( tPointi T, tPointd N, double *D ){    int i;    double t;              /* Temp storage */    double biggest = 0.0;  /* Largest component of normal vector. */    int m = 0;             /* Index of largest component. */    NormalVec( Vertices[T[0]], Vertices[T[1]], Vertices[T[2]], N );    /*printf("PlaneCoeff: N=(%lf,%lf,%lf)\n", N[X],N[Y],N[Z]);*/    *D = Dot( Vertices[T[0]], N );    /* Find the largest component of N. */    for ( i = 0; i < DIM; i++ ) {      t = fabs( N[i] );      if ( t > biggest ) {        biggest = t;        m = i;      }    }    return m;}/*---------------------------------------------------------------------Reads in the number and coordinates of the vertices of a polyhedronfrom stdin, and returns n, the number of vertices.---------------------------------------------------------------------*/int 	ReadVertices( void ){   int   i, n;   do {     scanf( "%d", &n );     if ( n <= PMAX )       break;     printf("Error in read_vertex:  too many points; max is %d\n", PMAX);   }   while ( 1 );   printf( "Polyhedron Vertices:\n" );   printf( "  i:   x   y   z\n");   for ( i = 0; i < n; i++ ) {     scanf( "%d %d %d", &Vertices[i][X], &Vertices[i][Y], &Vertices[i][Z] );     printf( "%3d:%4d%4d%4d\n", i, Vertices[i][X], Vertices[i][Y], Vertices[i][Z] );   }   printf("n = %3d vertices read\n",n);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
天天爽夜夜爽夜夜爽精品视频| 亚洲成av人**亚洲成av**| 国产精品一区二区在线观看不卡| 东方aⅴ免费观看久久av| 一本久道中文字幕精品亚洲嫩| 91麻豆精品国产91久久久使用方法| 久久亚洲精华国产精华液| 亚洲永久精品国产| 国产剧情一区在线| 69堂成人精品免费视频| 日韩一区中文字幕| 高清av一区二区| 91精品国产色综合久久久蜜香臀| 亚洲人成精品久久久久久| 国产一区二区三区久久久| 欧美主播一区二区三区| 亚洲欧美在线高清| 国产高清在线精品| 日韩精品一区二| 午夜精品久久久久影视| 日本伦理一区二区| 国产精品福利在线播放| 韩国av一区二区三区| 欧美mv日韩mv亚洲| 视频在线在亚洲| 欧美色图第一页| 亚洲视频狠狠干| jizzjizzjizz欧美| 欧美激情中文字幕一区二区| 激情综合色丁香一区二区| 日韩欧美一区二区久久婷婷| 日韩av电影免费观看高清完整版 | 亚洲视频在线观看一区| 国产一区二区三区不卡在线观看| 欧美成人女星排行榜| 日韩精品视频网站| 在线播放欧美女士性生活| 三级一区在线视频先锋| 欧美绝品在线观看成人午夜影视| 亚洲不卡在线观看| 日韩色在线观看| 国产呦精品一区二区三区网站| 日韩精品一区二区在线| 韩国精品主播一区二区在线观看 | 国产成人亚洲精品青草天美 | 欧美一级夜夜爽| 日本aⅴ精品一区二区三区| 日韩一区二区影院| 精品一区二区在线观看| 久久久久高清精品| www.亚洲在线| 夜夜亚洲天天久久| 欧美日韩国产片| 精品写真视频在线观看| 国产视频不卡一区| 99v久久综合狠狠综合久久| 一区二区三区四区在线免费观看 | 色吊一区二区三区 | 亚洲精品日韩一| 欧美体内she精视频| 天使萌一区二区三区免费观看| 制服丝袜日韩国产| 国内精品写真在线观看 | 欧美r级电影在线观看| 国产盗摄女厕一区二区三区 | 日本成人在线网站| 国产午夜久久久久| 欧美亚洲动漫制服丝袜| 麻豆成人av在线| 亚洲欧美另类图片小说| 欧美一二三区精品| 波多野结衣91| 日本欧美韩国一区三区| 中文字幕中文在线不卡住| 欧美四级电影网| 国产麻豆精品一区二区| 亚洲在线成人精品| 精品久久人人做人人爱| 色综合久久中文综合久久牛| 久久精品72免费观看| 国产女人水真多18毛片18精品视频 | 欧美性生活久久| 国产一区二区三区四| 亚洲第一av色| 国产精品久久久久一区| 欧美一区二区三区影视| 91污片在线观看| 国产综合色在线视频区| 亚洲18女电影在线观看| 欧美激情一区在线观看| 精品国免费一区二区三区| 色一情一乱一乱一91av| 国产激情91久久精品导航| 日韩高清电影一区| 亚洲乱码国产乱码精品精的特点| 日韩免费高清av| 7777精品伊人久久久大香线蕉超级流畅 | 亚洲精品久久久久久国产精华液| 久久久一区二区三区| 日韩一区二区在线观看视频| 欧美日韩亚洲综合| 色婷婷综合激情| 成人av在线资源网| 国产成人鲁色资源国产91色综 | 2019国产精品| 日韩一级片在线播放| 欧美日韩久久久一区| 欧美午夜片在线看| 色综合久久久久久久久久久| 成人精品国产免费网站| 国产精品1024久久| 国产精品综合网| 国产曰批免费观看久久久| 美国欧美日韩国产在线播放| 全部av―极品视觉盛宴亚洲| 午夜天堂影视香蕉久久| 一区二区欧美精品| 亚洲自拍偷拍欧美| 亚洲午夜在线电影| 亚洲一区二三区| 亚洲国产日日夜夜| 亚洲一本大道在线| 婷婷成人综合网| 另类成人小视频在线| 黄色成人免费在线| 国产一区二区三区香蕉| 国产精品系列在线观看| 高清av一区二区| 99精品一区二区三区| 91久久精品一区二区| 欧美午夜免费电影| 欧美日韩黄视频| 欧美一级片免费看| 久久五月婷婷丁香社区| 国产欧美一区二区精品忘忧草| 国产欧美精品国产国产专区| 亚洲欧美在线另类| 亚洲高清在线精品| 蜜臀av性久久久久蜜臀av麻豆| 日韩成人精品在线| 久久国产夜色精品鲁鲁99| 国产精品系列在线播放| 成人免费福利片| 日本道色综合久久| 91精品国产91热久久久做人人 | 日韩一级免费一区| 久久蜜臀中文字幕| 中文字幕一区二区三区色视频| 亚洲资源中文字幕| 麻豆视频一区二区| 白白色 亚洲乱淫| 911精品产国品一二三产区| 久久久亚洲国产美女国产盗摄| 国产精品成人免费| 午夜精品福利一区二区蜜股av| 国产综合久久久久久久久久久久 | 欧美一级高清片| 国产精品网站在线| 亚洲成av人影院| 国产成人一级电影| 欧美日韩午夜在线视频| 国产午夜精品一区二区三区四区| 亚洲成人动漫在线免费观看| 国产麻豆日韩欧美久久| 欧美视频完全免费看| 中文字幕国产一区二区| 日韩激情中文字幕| av高清不卡在线| 精品国产精品网麻豆系列| 一区二区三区在线观看视频| 精品亚洲国产成人av制服丝袜| 91精彩视频在线| 久久蜜桃一区二区| 日韩精品久久久久久| 91免费视频观看| 国产欧美精品区一区二区三区| 裸体健美xxxx欧美裸体表演| 在线观看www91| 亚洲欧美韩国综合色| 国产.欧美.日韩| 精品久久一区二区| 三级一区在线视频先锋| 日本丶国产丶欧美色综合| 国产精品久久久久婷婷| 国内欧美视频一区二区 | 中文字幕一区二区视频| 精品一区二区三区香蕉蜜桃| 精品污污网站免费看| 亚洲精品日产精品乱码不卡| 成人免费视频app| 2023国产精华国产精品| 毛片av一区二区| 91精品国产黑色紧身裤美女| 亚洲国产精品一区二区www在线| 91污片在线观看| 亚洲精品乱码久久久久| 91久久精品国产91性色tv| 亚洲欧美日韩国产手机在线 | 亚洲一区二三区| 欧美亚洲综合色|