~hrg/hrg-packaging/zeo

« back to all changes in this revision

Viewing changes to example/shape/create_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.h>
 
2
 
 
3
void shape_output(zShape3D *s)
 
4
{
 
5
  printf( "[shape]\n" );
 
6
  zShape3DWrite( s );
 
7
  zShape3DDestroy( s );
 
8
}
 
9
 
 
10
int main(void)
 
11
{
 
12
  zShape3D s;
 
13
  zVec3D center = { { 0.1, 0.2, 0.3 } };
 
14
  zVec3D c1[] = { { { 0, 0, 0 } }, { { 0.1,-0.1, 0.3 } } };
 
15
  zVec3D c2[] = { { { 0, 0, 0 } }, { {-0.3, 0.2, 0.1 } } };
 
16
 
 
17
  zShape3DInit( &s );
 
18
 
 
19
  /* box */
 
20
  zShape3DCreateBoxAlign( &s, Z_ZEROVEC3D, 0.1, 0.1, 0.1 );
 
21
  shape_output( &s );
 
22
  /* sphere */
 
23
  zShape3DCreateSphere( &s, &center, 0.1, 0 );
 
24
  shape_output( &s );
 
25
  /* ellipsoid */
 
26
  zShape3DCreateEllipsAlign( &s, &c2[1], 0.1, 0.15, 0.05, 0 );
 
27
  shape_output( &s );
 
28
  /* cylinder */
 
29
  zShape3DCreateCyl( &s, &c1[0], &c1[1], 0.06, 0 );
 
30
  shape_output( &s );
 
31
  /* cone */
 
32
  zShape3DCreateCone( &s, &c2[0], &c2[1], 0.06, 0 );
 
33
  shape_output( &s );
 
34
 
 
35
  return 0;
 
36
}