Initial release of Maemo 5 port of gnuplot
[gnuplot] / src / util3d.h
1 /*
2  * $Id: util3d.h,v 1.13 2005/12/05 04:25:18 sfeam Exp $
3  */
4
5 /* GNUPLOT - util3d.h */
6
7 /*[
8  * Copyright 1986 - 1993, 1998, 1999, 2004   Thomas Williams, Colin Kelley
9  *
10  * Permission to use, copy, and distribute this software and its
11  * documentation for any purpose with or without fee is hereby granted,
12  * provided that the above copyright notice appear in all copies and
13  * that both that copyright notice and this permission notice appear
14  * in supporting documentation.
15  *
16  * Permission to modify the software is granted, but not the right to
17  * distribute the complete modified source code.  Modifications are to
18  * be distributed as patches to the released version.  Permission to
19  * distribute binaries produced by compiling modified sources is granted,
20  * provided you
21  *   1. distribute the corresponding source modifications from the
22  *    released version in the form of a patch file along with the binaries,
23  *   2. add special version identification to distinguish your version
24  *    in addition to the base release version number,
25  *   3. provide your name and address as the primary contact for the
26  *    support of your modified version, and
27  *   4. retain our contact information in regard to use of the base
28  *    software.
29  * Permission to distribute the released version of the source code along
30  * with corresponding source modifications in the form of a patch file is
31  * granted with same provisions 2 through 4 for binary distributions.
32  *
33  * This software is provided "as is" without express or implied warranty
34  * to the extent permitted by applicable law.
35 ]*/
36
37 #ifndef GNUPLOT_UTIL3D_H
38 # define GNUPLOT_UTIL3D_H
39
40 /* HBB 990828: moved all those variable decl's and #defines to new
41  * file "graph3d.h", as the definitions are in graph3d.c, not in
42  * util3d.c. Include that file from here, to ensure everything is
43  * known */
44
45 #include "graph3d.h"
46
47 /* All the necessary information about one vertex. */
48 typedef struct vertex {
49     coordval x, y, z;           /* vertex coordinates */
50     lp_style_type *lp_style;    /* where to find point symbol type (if any) */
51     coordval real_z;
52 #ifdef EAM_DATASTRINGS
53     struct text_label *label;
54 #endif
55 #ifdef HIDDEN3D_VAR_PTSIZE      /* Needed for variable pointsize, but takes space */
56     struct coordinate *original;
57 #endif
58 } vertex;
59 typedef vertex GPHUGE * p_vertex;
60
61
62 /* Utility macros for vertices: */
63 #define FLAG_VERTEX_AS_UNDEFINED(v) \
64   do { (v).z = -2.0; } while (0)
65 #define VERTEX_IS_UNDEFINED(v) ((v).z == -2.0)
66 #define V_EQUAL(a,b) ( GE(0.0, fabs((a)->x - (b)->x) + \
67    fabs((a)->y - (b)->y) + fabs((a)->z - (b)->z)) )
68
69
70 /* Maps from normalized space to terminal coordinates */
71 #define TERMCOORD(v,xvar,yvar)                  \
72 {                                               \
73     xvar = ((int)((v)->x * xscaler)) + xmiddle; \
74     yvar = ((int)((v)->y * yscaler)) + ymiddle; \
75 }
76
77 /* Prototypes of functions exported by "util3d.c" */
78
79 void edge3d_intersect __PROTO((struct coordinate GPHUGE *, int, double *, double *, double *));
80 TBOOLEAN two_edge3d_intersect __PROTO((struct coordinate GPHUGE *, int, double *, double *, double *));
81 void mat_scale __PROTO((double sx, double sy, double sz, double mat[4][4]));
82 void mat_rot_x __PROTO((double teta, double mat[4][4]));
83 void mat_rot_z __PROTO((double teta, double mat[4][4]));
84 void mat_mult __PROTO((double mat_res[4][4], double mat1[4][4], double mat2[4][4]));
85 void map3d_xyz __PROTO((double x, double y, double z, p_vertex out));
86 void map3d_xy __PROTO((double x, double y, double z, unsigned int *xt, unsigned int *yt));
87 void map3d_xy_double __PROTO((double x, double y, double z, double *xt, double *yt));
88 void draw3d_line __PROTO((p_vertex, p_vertex, struct lp_style_type *));
89 void draw3d_line_unconditional __PROTO((p_vertex, p_vertex, struct lp_style_type *, int));
90 void draw3d_point __PROTO((p_vertex v, struct lp_style_type *lp));
91
92 /* HBB NEW 20031218: 3D polyline support */
93 void polyline3d_start __PROTO((p_vertex v1));
94 void polyline3d_next __PROTO((p_vertex v2, struct lp_style_type *lp));
95
96 #endif /* GNUPLOT_UTIL3D_H */