Go to the documentation of this file.
88 int main( int argc, char **arg)
105 double frameDelay,axesLength,t;
109 GtkWidget *window,*slider;
114 fprintf(stderr, "RECORD MODE ON\n");
124 NEW(snapshotFile,l+100, char);
129 Error( "Solution file can not be opened");
135 axesLength=atof(arg[3]);
140 frameDelay=atof(arg[4]);
147 PlotWorld(¶meters,&pt,axesLength,&world);
154 Error( "Empty list of solutions");
162 gtk_init(&argc,&arg);
164 window=create_window_cuikplay((gpointer)(&status),status. maxFrame);
165 slider=lookup_widget(window, "hscale1");
166 gtk_widget_show(window);
168 gettimeofday(&tp,NULL);
169 status. time=(tp.tv_sec+tp.tv_usec/1000)+frameDelay;
172 fprintf(stderr, "Max frame %u \n",status. maxFrame);
181 gettimeofday(&tp,NULL);
182 t=(tp.tv_sec+tp.tv_usec/1000)+frameDelay;
195 fprintf(stderr, "Moving Slider from %g to %g \n",
196 gtk_range_get_value(GTK_RANGE(slider)),v);
199 gtk_range_set_value(GTK_RANGE(slider),v);
212 fprintf(stderr, "Displaying: %u\n",status. nextFrame+1);
217 sprintf(snapshotFile, "/tmp/%s_%04u", GetFileName(&fworld),
224 gettimeofday(&tp,NULL);
225 t=(tp.tv_sec+tp.tv_usec/1000)+frameDelay;
226 status. time=t+frameDelay;
234 gtk_main_iteration_do( FALSE);
253 fprintf(stdout, " Wrong number of parameters.\n");
254 fprintf(stdout, " Use:\n");
255 fprintf(stdout, " cuikplay <world>.world <solutions>.sol [<axes> <delay>]\n");
256 fprintf(stdout, " Where:\n");
257 fprintf(stdout, " <world>: File describing the problem\n");
258 fprintf(stdout, " <solutions>: Is the path of solutions to be animated\n");
259 fprintf(stdout, " <axes>: Optional. Length for the axes for each link.\n");
260 fprintf(stdout, " The default value is 0, i.e., not to display them.\n");
261 fprintf(stdout, " <delay>: Optional. Delay (in seconds) between frames.\n");
262 fprintf(stdout, " The default delay is 0.1 seconds.\n");
263 fprintf(stdout, " File extensions are not required\n");
266 return(EXIT_SUCCESS);
void First(Titerator *i) Moves an iterator to the first position of its associated list.
int main(int argc, char **arg) Main body of the cuikplay application.
char * GetFileName(Tfilename *fn) Gets the file name.
void MoveWorld(Tparameters *pr, Tplot3d *pt, Tbox *b, Tworld *w) Moves the mechanisms defined in a world information to a given configuration.
#define NEW(_var, _n, _type) Allocates memory space.
Data structure to hold the information about the name of a file.
void InitWorldFromFile(Tparameters *p, Tfilename *f, Tworld *w) Constructor.
void InitPlot3d(char *name, boolean axes, int argc, char **arg, Tplot3d *p) Constructor.
void Close3dBlock(Tplot3d *p) Ends a block of commands.
void Error(const char *s) General error function.
#define PARAM_EXT File extension for parameter files.
All the necessary information to generate equations for mechanisms.
boolean MoveTo(unsigned int n, Titerator *i) Moves an iterator to a given position of its associated list.
boolean ReadListOfBoxes(char *filename, Tlist *l) Reads a list of boxes from a file.
Headers of the GTK interface functions for cuikplay.
Definition of the cuikplay control structure.
Collection of methods to work on Tlist of boxes.
unsigned int currentFrame
Definition of the Tworld type and the associated functions.
void DeleteWorld(Tworld *w) Destructor.
Error and warning functions.
void DeleteFileName(Tfilename *fn) Destructor.
void DeleteListOfBoxes(Tlist *l) Destructor.
void InitIterator(Titerator *i, Tlist *list) Constructor.
void CreateFileName(char *path, char *name, char *suffix, char *ext, Tfilename *fn) Constructor.
void InitParametersFromFile(char *file, Tparameters *p) Constructor from a file.
Definition of the cuikplay control structure.
char * GetFileFullName(Tfilename *fn) Gets the file full name (paht+name+extension).
#define SOL_EXT File extension for solution files.
#define WORLD_EXT File extension for problem files.
void * GetCurrent(Titerator *i) Gets the element pointed by the iterator.
void DeleteParameters(Tparameters *p) Destructor.
void Take3dSnapshot(char *file, Tplot3d *p) Takes a screenshot of the geometry.
void PlotWorld(Tparameters *pr, Tplot3d *pt, double axesLength, Tworld *w) Adds a world (environment plus mechanism) in a 3D scene.
unsigned int ListSize(Tlist *list) Gets the number of elements in the list.
void Start3dBlock(Tplot3d *p) Starts a block of commands.
void ClosePlot3d(boolean quit, double average_x, double average_y, double average_z, Tplot3d *p) Destructor.
Headers of the GTK support functions for cuikplay.
|
Follow us!