~hrg/hrg-packaging/zeo

« back to all changes in this revision

Viewing changes to example/prim/cone_inside_test.c

  • Committer: Yosuke Matsusaka
  • Date: 2016-01-12 04:55:51 UTC
  • Revision ID: yosuke.matsusaka@gmail.com-20160112045551-9xbrsuokuwqdfnc9
initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <zeo/zeo_prim.h>
 
2
 
 
3
#define N 100000
 
4
 
 
5
int main(void)
 
6
{
 
7
  zCone3D con;
 
8
  zVec3D c1, c2, p;
 
9
  int i;
 
10
 
 
11
  zRandInit();
 
12
  zVec3DCreate( &c1, zRandF(-0.1,0.1), zRandF(-0.1,0.1), zRandF(-0.1,0.1) );
 
13
  zVec3DCreate( &c2, zRandF(-0.1,0.1), zRandF(-0.1,0.1), zRandF(-0.1,0.1)+0.5 );
 
14
  zCone3DCreate( &con, &c1, &c2, zRandF(0,0.5), 0 );
 
15
  for( i=0; i<N; i++ ){
 
16
    zVec3DCreate( &p, zRandF(-1,1), zRandF(-1,1), zRandF(-1,1) );
 
17
    if( zCone3DPointIsInside( &con, &p, true ) )
 
18
      zVec3DDataNLWrite( &p );
 
19
  }
 
20
  return 0;
 
21
}