亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
中文字幕一区视频| 国产精品全国免费观看高清 | 国产亚洲精品久| 日韩一卡二卡三卡国产欧美| 欧美美女直播网站| 制服.丝袜.亚洲.中文.综合| 欧美一区二区三区小说| 欧美一二区视频| 久久一二三国产| 国产视频一区不卡| 中文字幕在线免费不卡| 亚洲欧美在线高清| 亚洲一区二区三区视频在线播放 | 欧美肥大bbwbbw高潮| 777亚洲妇女| 精品国产乱码久久久久久久久| 日韩欧美美女一区二区三区| 欧美精品一区二区在线播放| 国产精品欧美经典| 一区二区三区在线观看网站| 亚洲成人www| 国产一区二区三区精品视频| 成人免费精品视频| 欧美精品乱人伦久久久久久| 欧美变态tickle挠乳网站| 欧美高清一级片在线观看| 亚洲免费在线观看视频| 麻豆国产欧美一区二区三区| 国产91丝袜在线播放| 欧美视频中文字幕| 久久久精品黄色| 一区二区三区免费观看| 精品一区二区三区久久| 色综合天天综合在线视频| 6080亚洲精品一区二区| 欧美精品一区男女天堂| 亚洲精品视频在线观看网站| 精品一区二区成人精品| 日本韩国欧美三级| 久久久久久久久久看片| 亚洲二区在线观看| 成人av午夜电影| 日韩三级视频在线观看| 一区二区国产盗摄色噜噜| 美女免费视频一区二区| 日本精品一区二区三区高清| 2023国产一二三区日本精品2022| 玉足女爽爽91| 成人一级片网址| 精品国产在天天线2019| 亚洲国产日韩综合久久精品| 国产盗摄视频一区二区三区| 91精品在线免费| 一区二区三区日韩精品视频| 国产高清在线观看免费不卡| 3d动漫精品啪啪| 一区二区三区不卡视频在线观看| 国产成人精品亚洲日本在线桃色| 91麻豆精品国产91久久久久久久久| 综合电影一区二区三区| 国产精品69毛片高清亚洲| 欧美一区二区免费视频| 亚洲成年人影院| 欧美三电影在线| 一区二区三区欧美| 91色婷婷久久久久合中文| 国产亚洲综合av| 国产精品一级二级三级| 精品欧美久久久| 精品一区二区三区在线播放| 91精品国产麻豆国产自产在线 | 久久99精品国产91久久来源| 欧美综合亚洲图片综合区| 国产精品久久久久精k8| 成人白浆超碰人人人人| 中文字幕第一区第二区| 国产成人精品www牛牛影视| 久久亚洲一区二区三区明星换脸| 美腿丝袜在线亚洲一区| 日韩精品在线网站| 国产精品一区二区视频| 久久久久国产精品厨房| 国产精品羞羞答答xxdd| 国产欧美一区二区精品性色| 国产成人综合自拍| 国产精品美女久久久久高潮| 成人av在线电影| 亚洲一区二区三区影院| 在线播放中文字幕一区| 国内精品久久久久影院色| 国产色一区二区| 91国偷自产一区二区开放时间| 亚洲视频香蕉人妖| 欧美老年两性高潮| 国产在线一区观看| 中文字幕一区二区视频| 欧美偷拍一区二区| 精品一区二区在线看| 国产精品麻豆视频| 欧美日韩精品电影| 国产一区二区三区不卡在线观看| 国产精品天干天干在线综合| 国产成人激情av| 蜜臀av性久久久久蜜臀aⅴ流畅 | 精品日韩在线观看| 国内精品免费**视频| 国产精品欧美一区二区三区| 91丝袜美腿高跟国产极品老师| 亚洲一区二区三区国产| 精品成人一区二区| 99久久久精品免费观看国产蜜| 亚洲一区二区三区四区中文字幕| 欧美一卡在线观看| av一区二区三区四区| 美国三级日本三级久久99| 中文字幕不卡的av| 欧美一级爆毛片| 91日韩精品一区| 激情另类小说区图片区视频区| 樱花影视一区二区| 久久久久久久久久久久久久久99| eeuss国产一区二区三区| 久久午夜免费电影| 精品福利av导航| 成人av网在线| 麻豆精品久久久| 亚洲激情中文1区| 国产欧美一区二区在线| 日韩亚洲欧美一区| 欧美在线免费观看视频| 国产mv日韩mv欧美| 蜜臀av国产精品久久久久| 亚洲免费成人av| 亚洲国产成人一区二区三区| 日韩精品在线网站| 欧美久久久久久久久| 色综合中文字幕国产 | 亚洲成人综合网站| 综合电影一区二区三区 | 亚洲精品国产无天堂网2021| 国产日韩欧美精品综合| 日韩精品最新网址| 欧美一区二区三区人| 欧美日韩电影一区| 欧美日韩免费一区二区三区| 97精品国产露脸对白| 国产精品自拍av| 精品一区二区av| 精品写真视频在线观看| 久久精品国产精品亚洲红杏| 日韩在线播放一区二区| 亚洲成a人片在线不卡一二三区 | 精品无人码麻豆乱码1区2区 | 日韩电影在线观看一区| 亚洲电影中文字幕在线观看| 亚洲欧美日韩国产另类专区| 综合久久国产九一剧情麻豆| 中文字幕中文字幕一区| 中文字幕一区二区在线观看| 中文字幕一区二区三区色视频| 国产精品午夜春色av| 亚洲国产精品t66y| 国产精品久久久久9999吃药| 成人美女视频在线观看18| 99riav一区二区三区| 亚洲三级电影网站| 亚洲男人天堂av网| 一区二区高清免费观看影视大全| 国产高清精品网站| 成人av高清在线| 午夜一区二区三区在线观看| 亚洲va韩国va欧美va| 免费在线观看一区| 国产乱码精品一区二区三区忘忧草| 久久精品免费观看| 国产剧情一区在线| 91黄视频在线观看| 偷偷要91色婷婷| gogo大胆日本视频一区| 精品福利一区二区三区| 午夜精品久久久久久久99水蜜桃| 成人福利在线看| 国产亚洲精品中文字幕| 久久精品国产999大香线蕉| 91国偷自产一区二区开放时间| 欧美国产综合色视频| 国内精品国产成人| 欧美一区中文字幕| 五月天精品一区二区三区| 色婷婷久久久久swag精品| 国产精品三级av| 国产美女视频一区| 久久综合久久综合久久综合| 日韩电影免费在线看| 91精品国产色综合久久不卡电影 | 美女在线视频一区| 欧美巨大另类极品videosbest | 国产一区二区三区在线观看免费视频 | 国产精品免费aⅴ片在线观看| 日本午夜一本久久久综合|