home *** CD-ROM | disk | FTP | other *** search
- /*
- * FILE: anring.c
- * AUTHOR: R. Gonzalez
- * CREATED: November 8, 1990
- *
- * defines methods for ring animated segment
- */
-
- # include "anring.h"
- # include "trans.h"
- # include "atring.h"
-
- # define NUM_SATELLITES 2
- # define RADIUS 3.
- # define SATELLITE_TYPE Atomic_Ring
- # define ANIMATED_SATELLITES TRUE
- # define ANGULAR_VELOCITY PI/20.
-
- /******************************************************************
- * initialize
- ******************************************************************/
- boolean Animated_Ring::init(void)
- {
- int i;
- Translation *transl;
- Rotation_Y *roty;
- Transformation *combination;
- /* The following temps are needed due to a bug in Think C when
- handling arrays of pointers, when the array is an instance var.
- */
- Segment *temp_seg;
- Transformation *temp_trans;
-
- Animated_Segment::init();
-
- transl = new(Translation);
- transl->init();
- transl->set(0.,0.,RADIUS);
- roty = new(Rotation_Y);
- roty->init();
- combination = new(Transformation);
- combination->init();
-
- num_segments = NUM_SATELLITES;
-
- for (i=0 ; i<NUM_SATELLITES ; i++)
- {
- temp_seg = new(SATELLITE_TYPE);
- segment[i] = temp_seg;
- segment[i]->init();
- roty->set(i*2.*PI/NUM_SATELLITES);
- combination->combine(transl,roty);
- segment[i]->move(combination);
- temp_trans = new(Rotation_Y);
- animation[i] = temp_trans;
- animation[i]->init();
- ((Rotation_Y*) animation[i])->set(ANGULAR_VELOCITY);
- if (ANIMATED_SATELLITES)
- log_animated_segment(segment[i]);
- }
-
- transl->destroy();
- delete(transl);
- roty->destroy();
- delete(roty);
- combination->destroy();
- delete(combination);
-
- return TRUE;
- }
-
-