initial setup of thesis repository
[cluster_expansion_thesis.git] / little_helpers / tikz / sketch-0.2.161 / scene.h
blob555e539119ff7d25d2a05ec73e8b77df4badff02
1 /* scene.h
2 Copyright (C) 2005,2006,2007,2008 Eugene K. Ressler, Jr.
4 This file is part of Sketch, a small, simple system for making
5 3d drawings with LaTeX and the PSTricks or TikZ package.
7 Sketch is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
12 Sketch is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Sketch; see the file COPYING.txt. If not, see
19 http://www.gnu.org/copyleft */
21 #ifndef __SCENE_H
22 #define __SCENE_H
24 #include "opts.h"
25 #include "error.h"
26 #include "geometry.h"
27 #include "expr.h"
28 #include "bsp.h"
29 #include "dynarray.h"
30 #include "global.h"
32 typedef struct point_list_3d_t
34 DYNAMIC_2D_ARRAY_FIELDS (POINT_3D, v, n_pts);
36 POINT_LIST_3D;
38 DECLARE_DYNAMIC_2D_ARRAY_PROTOS (POINT_LIST_3D, POINT_3D, FLOAT,
39 point_list_3d, v, n_pts)
40 typedef struct transform_list_t
42 DYNAMIC_2D_ARRAY_FIELDS (TRANSFORM, xf, n_xfs);
44 TRANSFORM_LIST;
46 DECLARE_DYNAMIC_2D_ARRAY_PROTOS (TRANSFORM_LIST, TRANSFORM, FLOAT,
47 transform_list, xf, n_xfs)
48 // object_type_str[] definition in scene.c must match!
49 typedef enum object_type_t
51 O_BASE,
52 O_TAG_DEF,
53 O_OPTS_DEF,
54 O_SCALAR_DEF,
55 O_POINT_DEF,
56 O_VECTOR_DEF,
57 O_TRANSFORM_DEF,
58 O_DOTS,
59 O_LINE,
60 O_CURVE,
61 O_POLYGON,
62 O_SPECIAL,
63 O_SWEEP,
64 O_REPEAT,
65 O_COMPOUND,
67 OBJECT_TYPE;
69 #define is_drawable(P) ((P)->tag >= O_DOTS)
71 extern char *object_type_str[];
73 #define BASE_OBJECT_FIELDS \
74 struct object_t *sibling; \
75 OBJECT_TYPE tag
77 typedef struct object_t
79 BASE_OBJECT_FIELDS;
81 OBJECT;
83 typedef OBJECT TAG_DEF;
84 OBJECT *new_tag_def (void);
86 typedef struct opts_def_t
88 BASE_OBJECT_FIELDS;
89 OPTS *opts;
91 OPTS_DEF;
93 OBJECT *new_opts_def (char *opts_str, SRC_LINE line);
95 typedef struct scalar_def_t
97 BASE_OBJECT_FIELDS;
98 FLOAT val;
100 SCALAR_DEF;
102 OBJECT *new_scalar_def (FLOAT val);
104 typedef struct point_def_t
106 BASE_OBJECT_FIELDS;
107 POINT_3D p;
109 POINT_DEF;
111 OBJECT *new_point_def (POINT_3D p);
113 typedef struct vector_def_t
115 BASE_OBJECT_FIELDS;
116 VECTOR_3D v;
118 VECTOR_DEF;
120 OBJECT *new_vector_def (VECTOR_3D v);
122 typedef struct transform_def_t
124 BASE_OBJECT_FIELDS;
125 TRANSFORM xf;
127 TRANSFORM_DEF;
129 OBJECT *new_transform_def (TRANSFORM xf);
131 typedef struct dots_t
133 BASE_OBJECT_FIELDS;
134 OPTS *opts;
135 POINT_LIST_3D pts[1];
137 DOTS_OBJECT;
139 OBJECT *new_dots (OPTS * opts, OBJECT * pts);
141 typedef struct line_object_t
143 BASE_OBJECT_FIELDS;
144 OPTS *opts;
145 POINT_LIST_3D pts[1];
147 LINE_OBJECT;
149 OBJECT *new_line (OPTS * opts, OBJECT * pts);
151 typedef struct curve_t
153 BASE_OBJECT_FIELDS;
154 OPTS *opts;
155 POINT_LIST_3D pts[1];
157 CURVE_OBJECT;
159 OBJECT *new_curve (OPTS * opts, OBJECT * pts);
161 typedef struct polygon_t
163 BASE_OBJECT_FIELDS;
164 OPTS *opts;
165 int border_p;
166 POINT_LIST_3D pts[1];
168 POLYGON_OBJECT;
170 OBJECT *new_polygon (OPTS * opts, OBJECT * pts);
172 typedef struct special_t
174 BASE_OBJECT_FIELDS;
175 char *code;
176 OPTS *opts;
177 POINT_LIST_3D pts[1];
179 SPECIAL_OBJECT;
181 OBJECT *new_special (char *code, OPTS * opts, OBJECT * pts,
182 SRC_LINE line);
184 typedef struct sweep_t
186 BASE_OBJECT_FIELDS;
187 OPTS *opts;
188 int n_slices;
189 int closed_p;
190 TRANSFORM_LIST xforms[1];
191 OBJECT *swept;
193 SWEEP_OBJECT;
195 OBJECT *new_sweep (OPTS * opts, int n_slices, int closed_p, OBJECT * xfs,
196 OBJECT * swept);
198 typedef struct repeat_t
200 BASE_OBJECT_FIELDS;
201 int n;
202 TRANSFORM_LIST xforms[1];
203 OBJECT *repeated;
205 REPEAT_OBJECT;
207 OBJECT *new_repeat (int n, OBJECT * xfs, OBJECT * repeated);
209 typedef struct compound_t
211 BASE_OBJECT_FIELDS;
212 TRANSFORM xform;
213 OBJECT *child;
215 COMPOUND_OBJECT;
217 OBJECT *new_compound (TRANSFORM xform, OBJECT * child);
219 OBJECT *copy_drawable (OBJECT * obj);
220 OBJECT *cat_objects (OBJECT * lft, OBJECT * rgt);
221 OBJECT *sibling_reverse (OBJECT * obj);
222 OBJECT *object_from_expr (EXPR_VAL * val);
224 OBJECT *flat_scene (OBJECT * obj, GLOBAL_ENV * env);
225 OBJECT *hsr_scene_with_bsp (OBJECT * scene);
226 OBJECT *hsr_scene_with_depth_sort (OBJECT * scene);
227 void get_extent (OBJECT * obj, BOX_3D * e, int *n_obj);
228 int xy_overlap_p (OBJECT * obj, BOX_3D * e);
230 #endif