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

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

?? inhedron.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 -lmRun (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 );/*-------------------------------------------------------------------*/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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产中文一区二区三区| 欧美激情在线一区二区| 亚洲福利国产精品| 欧美亚洲精品一区| 亚洲主播在线播放| 欧美精品 国产精品| 日韩影视精彩在线| 精品久久久久久久久久久久久久久| 久久91精品久久久久久秒播| 久久只精品国产| 成人激情开心网| 日韩美女视频19| 欧美日韩国产一二三| 日本亚洲电影天堂| 久久精品一区四区| 91蝌蚪porny九色| 亚洲午夜激情网页| 精品黑人一区二区三区久久| 成人免费观看av| 一区二区三区高清| 日韩午夜在线观看| 成人综合婷婷国产精品久久免费| 亚洲欧美一区二区三区久本道91 | 粉嫩av亚洲一区二区图片| 欧美激情一区二区三区不卡 | 欧美成人性战久久| 成人免费视频网站在线观看| 亚洲国产视频直播| 精品久久人人做人人爰| 国产98色在线|日韩| 亚洲一区二区欧美日韩| 久久一区二区视频| 91在线你懂得| 久久99国产精品麻豆| 综合精品久久久| 日韩免费电影网站| 91黄色小视频| 国产精品一区二区久久精品爱涩| 亚洲自拍欧美精品| 国产色91在线| 欧美日韩精品欧美日韩精品| 高清不卡在线观看av| 午夜av一区二区| 中文字幕在线一区| 日韩欧美中文字幕一区| 91蜜桃免费观看视频| 极品少妇xxxx精品少妇| 亚洲国产成人高清精品| 国产精品国产三级国产aⅴ中文 | 美女尤物国产一区| 亚洲欧美激情小说另类| 2022国产精品视频| 欧美精品第一页| 色婷婷国产精品久久包臀| 黄色精品一二区| 日日摸夜夜添夜夜添国产精品| 国产精品久久看| 久久久美女毛片| 欧美丰满高潮xxxx喷水动漫| 91农村精品一区二区在线| 国产高清成人在线| 久久精品久久99精品久久| 天天影视色香欲综合网老头| 中文字幕一区二区三区av| 久久久久99精品一区| 国产喂奶挤奶一区二区三区| 日韩一区二区在线看| 欧美日韩黄视频| 91麻豆自制传媒国产之光| 成人网页在线观看| 高清日韩电视剧大全免费| 激情欧美一区二区| 欧美aⅴ一区二区三区视频| 亚洲一区成人在线| 一区二区三区91| 亚洲卡通动漫在线| 亚洲精品中文字幕乱码三区| 成人免费在线视频观看| 国产精品欧美精品| 国产精品久久久久久久蜜臀| 日本一区二区免费在线| 久久精品亚洲乱码伦伦中文| 国产亚洲福利社区一区| 久久久www免费人成精品| 久久久99久久| 欧美韩国一区二区| 国产精品福利一区二区| 综合激情成人伊人| 亚洲少妇中出一区| 亚洲一区二区三区在线播放| 丝袜a∨在线一区二区三区不卡| 日本伊人午夜精品| 黄色资源网久久资源365| 国产麻豆欧美日韩一区| 国产成人啪免费观看软件| 国产精品99久久久久久久女警 | 国产日韩欧美综合一区| 久久久777精品电影网影网| 久久精品视频在线看| 国产欧美精品日韩区二区麻豆天美| 日本一二三不卡| 亚洲另类春色国产| 97久久精品人人爽人人爽蜜臀| 成人性视频免费网站| 91蜜桃传媒精品久久久一区二区| 欧美三级视频在线观看| 91麻豆精品国产自产在线| 久久综合久久鬼色| 亚洲色图制服诱惑| 天天av天天翘天天综合网色鬼国产 | 欧美日韩免费一区二区三区视频| 在线播放一区二区三区| 欧美成人官网二区| 国产精品电影院| 亚洲成a天堂v人片| 激情图区综合网| 99re视频精品| 欧美一区二区在线播放| 亚洲国产高清不卡| 天天色 色综合| 国产999精品久久| 欧美日韩情趣电影| 欧美韩日一区二区三区四区| 亚洲成人久久影院| 国产精品77777| 欧美美女黄视频| 国产精品―色哟哟| 免费成人av在线播放| aaa亚洲精品一二三区| 91麻豆精品91久久久久久清纯| 亚洲国产精品黑人久久久| 午夜av电影一区| av在线一区二区| 久久人人97超碰com| 亚洲综合一区在线| 国产.精品.日韩.另类.中文.在线.播放| 色香蕉久久蜜桃| 精品国产免费一区二区三区四区 | 精品久久久网站| 亚洲资源中文字幕| 国产东北露脸精品视频| 欧美精品xxxxbbbb| 一区二区三区国产精品| 国产传媒日韩欧美成人| 欧美一区二区性放荡片| 一区二区三区**美女毛片| 国产成人av在线影院| 日韩女优电影在线观看| 亚洲最新视频在线观看| caoporen国产精品视频| 精品国产凹凸成av人导航| 天堂精品中文字幕在线| 在线观看三级视频欧美| 国产精品每日更新| 国产精品资源站在线| 91精品国产综合久久蜜臀 | 91免费观看视频| 欧美国产激情二区三区| 韩国视频一区二区| 欧美大片拔萝卜| 三级不卡在线观看| 欧美日韩国产大片| 亚洲一区二区三区美女| 色综合色狠狠天天综合色| 国产日韩欧美制服另类| 国产精品一级黄| 久久久91精品国产一区二区三区| 九色综合狠狠综合久久| 亚洲国产aⅴ天堂久久| 色菇凉天天综合网| 亚洲少妇中出一区| 91啦中文在线观看| 一区二区三区在线视频观看58| 97se狠狠狠综合亚洲狠狠| 中文字幕一区二区在线观看 | 久久精品视频在线看| 国产盗摄一区二区三区| 国产日韩精品一区二区浪潮av| 国产麻豆91精品| 国产欧美日韩视频在线观看| 成人激情小说网站| 亚洲欧美色一区| 欧美三级韩国三级日本一级| 亚洲成人自拍网| 3d成人动漫网站| 久久国产精品99久久久久久老狼| 欧美v亚洲v综合ⅴ国产v| 精品一区二区三区在线观看| 久久日韩粉嫩一区二区三区| 成人高清视频免费观看| 亚洲免费资源在线播放| 欧美三级中文字| 久久99精品久久久久久国产越南| 久久综合久久99| 91小视频在线免费看| 亚洲午夜在线视频| 欧美成人午夜电影| 不卡av电影在线播放| 亚洲午夜激情网页| 亚洲精品一区二区三区精华液|