1
0
mirror of git://projects.qi-hardware.com/ben-scans.git synced 2024-11-22 13:52:48 +02:00
ben-scans/solidify/array.h

30 lines
471 B
C
Raw Normal View History

#ifndef ARRAY_H
#define ARRAY_H
#include <limits.h>
#define UNDEF INT_MAX
struct array {
int min_x, max_x;
int min_y, max_y;
int min_z, max_z;
int *data; /* NULL if there are no points */
};
struct array *new_array(void);
void free_array(struct array *a);
void set(struct array *a, int x, int y, int z);
static inline int get(const struct array *a, int x, int y)
{
return a->data[(x)-a->min_x+(a->max_x-a->min_x+1)*((y)-a->min_y)];
}
#endif /* ARRAY_H */