2010-09-24 02:13:48 +03:00
|
|
|
/*
|
|
|
|
* face.h - Data structure and handling of one face of a part
|
|
|
|
*
|
|
|
|
* Written 2010 by Werner Almesberger
|
|
|
|
* Copyright 2010 by Werner Almesberger
|
|
|
|
*
|
|
|
|
* 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 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
2010-09-22 23:04:43 +03:00
|
|
|
#ifndef FACE_H
|
|
|
|
#define FACE_H
|
|
|
|
|
|
|
|
#include "array.h"
|
2010-09-24 22:42:36 +03:00
|
|
|
#include "matrix.h"
|
2010-09-22 23:04:43 +03:00
|
|
|
|
|
|
|
|
|
|
|
struct face {
|
|
|
|
struct array *a;
|
2010-09-25 01:53:06 +03:00
|
|
|
double x_step, y_step, z_step;
|
2010-09-23 01:20:29 +03:00
|
|
|
int sx, sy; /* size */
|
2010-09-24 09:46:32 +03:00
|
|
|
int cx, cy; /* center */
|
2010-09-22 23:04:43 +03:00
|
|
|
int z_ref;
|
2010-09-23 01:20:29 +03:00
|
|
|
double fx, fy; /* inclination factor */
|
2010-09-24 04:17:19 +03:00
|
|
|
struct matrix m;
|
2010-09-22 23:04:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-09-24 06:43:56 +03:00
|
|
|
static inline double face_z0(const struct face *f, int x, int y)
|
|
|
|
{
|
|
|
|
return f->z_ref+f->fx*(x-f->sx/2)+f->fy*(y-f->sy/2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-22 23:04:43 +03:00
|
|
|
struct face *read_face(const char *name);
|
|
|
|
|
2010-09-24 22:42:36 +03:00
|
|
|
#endif /* !FACE_H */
|