1 /* Copyright (C) 1992-1998 The Geometry Center
2 * Copyright (C) 1998-2000 Stuart Levy, Tamara Munzner, Mark Phillips
3 * Copyright (C) 2006-2007 Claus-Justus Heine
4 *
5 * This file is part of Geomview.
6 *
7 * Geomview is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * Geomview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with Geomview; see the file COPYING. If not, write
19 * to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
20 * USA, or visit http://www.gnu.org.
21 */
22
23
24 /* Authors: Charlie Gunn, Stuart Levy, Tamara Munzner, Mark Phillips */
25
26 #ifndef NDMESHPDEF
27 #define NDMESHPDEF
28
29 #include "geomclass.h"
30 #include "hpointn.h"
31 #include "ndmesh.h"
32
33 struct NDMesh {
34 GEOMFIELDS;
35 int seq; /* cH: what is this??? */
36 int meshd; /* mesh dimension */
37 int *mdim; /* mesh size, indexed 0..meshd-1 */
38 HPointN **p; /* N-D vertices; dim[0] axis varies fastest */
39 ColorA *c; /* vertex colors, indexed likewise */
40 TxST *u; /* texture coordinates, should we need any */
41 };
42
NDMeshRef(NDMesh * m)43 static inline Ref *NDMeshRef(NDMesh *m)
44 {
45 union castit {
46 Ref ref;
47 NDMesh mesh;
48 };
49
50 return &((union castit *)m)->ref;
51 }
52
NDMeshGeom(NDMesh * m)53 static inline Geom *NDMeshGeom(NDMesh *m)
54 {
55 union castit {
56 Geom geom;
57 NDMesh mesh;
58 };
59
60 return &((union castit *)m)->geom;
61 }
62
63
64 /* NOTE that these meshes may have missing vertices; some of the p[]
65 * and c[] entries may be NULL.
66 */
67
68 /*
69 * mesh indexing:
70 * given a mesh index vector (of length 'meshd') i[0] i[1] ... i[meshd-1]
71 * the corresponding index into the p[] and c[] arrays is given by
72 * index = 0; size = 1;
73 * for(k = 0; k < meshd; k++) { index += size*i[k]; size *= dim[k]; }
74 */
75
76 #endif /* ! NDMESHPDEF */
77