-
Notifications
You must be signed in to change notification settings - Fork 3
/
create_sphere.c
51 lines (39 loc) · 1.37 KB
/
create_sphere.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <bicpl.h>
int main(
int argc,
char *argv[] )
{
Status status;
int resolution;
char *output_filename;
object_struct *object;
Real cx, cy, cz, rx, ry, rz;
Point centre;
Surfprop spr;
status = OK;
initialize_argument_processing( argc, argv );
if( !get_string_argument( "", &output_filename ) ||
!get_int_argument( 0, &resolution ) )
{
(void) fprintf( stderr, "Must have a filename and resolution.\n" );
return( 1 );
}
(void) get_real_argument( 0.0, &cx );
(void) get_real_argument( 0.0, &cy );
(void) get_real_argument( 0.0, &cz );
(void) get_real_argument( 1.0, &rx );
(void) get_real_argument( 1.0, &ry );
(void) get_real_argument( 1.0, &rz );
object = create_object( POLYGONS );
fill_Surfprop( spr, 0.4, 0.5, 0.5, 40.0, 1.0 );
initialize_polygons( get_polygons_ptr(object), WHITE, &spr );
fill_Point( centre, cx, cy, cz );
create_polygons_sphere( ¢re, rx, ry, rz, resolution, 2 * resolution,
FALSE, get_polygons_ptr(object) );
status = output_graphics_file( output_filename, BINARY_FORMAT, 1, &object );
if( status == OK )
delete_object( object );
if( status == OK )
print( "Sphere output.\n" );
return( status != OK );
}