plot3d.h
Go to the documentation of this file.
1 #ifndef PLOT3D
2 #define PLOT3D
3 
4 #include "defines.h"
5 
6 #include "boolean.h"
7 #include "htransform.h"
8 #include "color.h"
9 
10 #include <stdio.h>
11 
23 /************************************************************************************/
30 #define DCP3D_R 0
31 
38 #define DCP3D_G 0
39 
46 #define DCP3D_B 1
47 /************************************************************************************/
48 
54 typedef struct {
55  FILE *f;
56  char *fileName;
60  unsigned int nobj;
64  boolean inObject;
66 } Tplot3d;
67 
80 void InitPlot3d(char *name,boolean axes,int argc,char **arg,Tplot3d *p);
81 
94 unsigned int StartNew3dObject(Tcolor *c,Tplot3d *p);
95 
96 
107 
115 void Close3dObject(Tplot3d *p);
116 
126 void Delete3dObject(unsigned int nobj,Tplot3d *p);
127 
137 void Start3dBlock(Tplot3d *p);
145 void Close3dBlock(Tplot3d *p);
146 
156 void SetColor3dObject(unsigned int nobj,Tcolor *c,Tplot3d *p);
157 
166 void Delay3dObject(double t,Tplot3d *p);
167 
168 
178 void Move3dObject(unsigned int nobj,THTransform *t,Tplot3d *p);
179 
195 void PlotBox3d(double min_x,double max_x,
196  double min_y,double max_y,
197  double min_z,double max_z,
198  Tplot3d *p);
217 void PlotTriangle3d(double x1,double y1,double z1,
218  double x2,double y2,double z2,
219  double x3,double y3,double z3,
220  Tplot3d *p);
239 void Plot3dObject(unsigned int nv,unsigned int nf,unsigned int ne,
240  double **v,
241  unsigned int *nvf,
242  unsigned int **fv,Tplot3d *p);
243 
264 void Plot3dObjectWithColor(unsigned int nv,unsigned int nf,unsigned int ne,
265  double **v,
266  unsigned int *nvf,
267  unsigned int **fv,Tcolor *c,Tplot3d *p);
295 void Plot3dObjectWithColors(unsigned int nv,unsigned int nf,unsigned int ne,
296  double **v,Tcolor *c,
297  unsigned int *nvf,
298  unsigned int **fv,Tplot3d *p);
299 
313 void PlotSphere(double r,double x,double y,double z,Tplot3d *p);
314 
329 void PlotCylinder(double r,double *p1,double *p2,Tplot3d *p);
330 
342 void PlotLine(double *p1,double *p2,Tplot3d *p);
343 
356 void PlotSegments(unsigned int n,double **pt,Tplot3d *p);
357 
372 void PlotVect3d(unsigned int n,
373  double *x,double *y,double *z,
374  Tplot3d *p);
386 void Take3dSnapshot(char *file,Tplot3d *p);
387 
406 void ClosePlot3d(boolean quit,double average_x,double average_y,double average_z,Tplot3d *p);
407 
408 #endif
Definition of the boolean type.
void PlotVect3d(unsigned int n, double *x, double *y, double *z, Tplot3d *p)
Adds a polyline to the current object.
Definition: plot3d.c:447
void PlotBox3d(double min_x, double max_x, double min_y, double max_y, double min_z, double max_z, Tplot3d *p)
Adds an axis aligned box to the current object.
Definition: plot3d.c:224
Tcolor color
Definition: plot3d.h:62
A homgeneous transform in R^3.
void PlotSegments(unsigned int n, double **pt, Tplot3d *p)
Adds a collecion of segments to the current object.
Definition: plot3d.c:412
char * fileName
Definition: plot3d.h:56
FILE * f
Definition: plot3d.h:55
void SetColor3dObject(unsigned int nobj, Tcolor *c, Tplot3d *p)
Changes the color of an object.
Definition: plot3d.c:196
void InitPlot3d(char *name, boolean axes, int argc, char **arg, Tplot3d *p)
Constructor.
Definition: plot3d.c:41
void Close3dBlock(Tplot3d *p)
Ends a block of commands.
Definition: plot3d.c:146
void PlotLine(double *p1, double *p2, Tplot3d *p)
Adds a line to the current object.
Definition: plot3d.c:395
A color.
Definition: color.h:23
void PlotSphere(double r, double x, double y, double z, Tplot3d *p)
Adds a sphere to the current object.
Definition: plot3d.c:369
void Delete3dObject(unsigned int nobj, Tplot3d *p)
Deletes a previously created geometric object.
Definition: plot3d.c:152
void Move3dObject(unsigned int nobj, THTransform *t, Tplot3d *p)
Moves a 3d object.
Definition: plot3d.c:217
A 3D plot.
Definition: plot3d.h:54
void Delay3dObject(double t, Tplot3d *p)
Introduces a delay in the generation of the geometry.
Definition: plot3d.c:211
void Close3dObjectNoColor(Tplot3d *p)
Closes a composed object without assigning any color.
Definition: plot3d.c:184
Definitions of constants and macros used in several parts of the cuik library.
void Plot3dObjectWithColor(unsigned int nv, unsigned int nf, unsigned int ne, double **v, unsigned int *nvf, unsigned int **fv, Tcolor *c, Tplot3d *p)
Adds a colored polytope to the current object.
Definition: plot3d.c:304
Definition of the THTransform type and the associated functions.
Definition of the Tcolor type and the associated functions.
void Take3dSnapshot(char *file, Tplot3d *p)
Takes a screenshot of the geometry.
Definition: plot3d.c:467
void PlotTriangle3d(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, Tplot3d *p)
Adds a triangle to the current object.
Definition: plot3d.c:256
unsigned int nobj
Definition: plot3d.h:60
void Plot3dObjectWithColors(unsigned int nv, unsigned int nf, unsigned int ne, double **v, Tcolor *c, unsigned int *nvf, unsigned int **fv, Tplot3d *p)
Adds a colored polytope to the current object.
Definition: plot3d.c:334
void Plot3dObject(unsigned int nv, unsigned int nf, unsigned int ne, double **v, unsigned int *nvf, unsigned int **fv, Tplot3d *p)
Adds a polytope to the current object.
Definition: plot3d.c:276
boolean inObject
Definition: plot3d.h:64
void PlotCylinder(double r, double *p1, double *p2, Tplot3d *p)
Adds a cylinder to the current object.
Definition: plot3d.c:377
unsigned int StartNew3dObject(Tcolor *c, Tplot3d *p)
Start a composed object.
Definition: plot3d.c:157
void Close3dObject(Tplot3d *p)
Closes a composed object.
Definition: plot3d.c:171
void Start3dBlock(Tplot3d *p)
Starts a block of commands.
Definition: plot3d.c:141
void ClosePlot3d(boolean quit, double average_x, double average_y, double average_z, Tplot3d *p)
Destructor.
Definition: plot3d.c:473