/usr/include/grits/objects/marching.h is in libgrits-dev 0.8.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | /*
* Copyright (C) 2002 Jamie Zawinski <jwz@jwz.org>
* Copyright (C) 2009-2011 Andy Spencer <andy753421@gmail.com>
*
* Marching cubes implementation based on code from from the xscreensaver
* package.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __VOLUME_H__
#define __VOLUME_H__
#include <glib.h>
/* VolCoord */
typedef struct {
double x, y, z;
} VolCoord;
/* VolPoint */
typedef struct {
VolCoord c; /* Coordinate of the point */
double value; /* Function value at point */
} VolPoint;
/* VolVertex */
typedef struct {
VolCoord c; /* Coordinate of the vertex */
gint tris; /* Count of associated triangles */
VolCoord norm; /* Vertex normal */
} VolVertex;
/* VolTriangle */
typedef struct {
VolVertex *v[3]; /* Vertices */
VolCoord norm; /* Surface normal */
} VolTriangle;
/* VolCell */
typedef struct {
VolPoint *corner[8]; /* Corners */
VolVertex *edge[12]; /* Points along the edges (for caching) */
} VolCell;
/* VolGrid */
typedef struct {
int xs, ys, zs; /* Dimensions of points */
gpointer data; /* 3-D grid of points */
} VolGrid;
/* Find triangles on an isosurface that pass through the cell */
GList *march_one_cube(VolCell *cell, double level);
/* Find triangles along an isosurface in a grid of points */
GList *marching_cubes(VolGrid *grid, double level);
/* Free/unref data for triangle */
void vol_triangle_free(VolTriangle *tri);
/* Grid functions */
static inline VolPoint *vol_grid_get(VolGrid *grid, int x, int y, int z)
{
VolPoint (*points)[grid->ys][grid->zs] = grid->data;
return &points[x][y][z];
}
VolGrid *vol_grid_new(int xs, int ys, int zs);
void vol_grid_free(VolGrid *grid);
#endif
|