1
0
mirror of git://projects.qi-hardware.com/ben-scans.git synced 2024-11-22 09:30:38 +02:00
ben-scans/solidify/face.h
Werner Almesberger 898970b3dd Instead of performing the tranformations stepwise for each point, pre-calculate
them once.

- solidify/matrix.h, solidify/matrix.c: 2D matrix operations
- solidify/Makefile (OBJS): added matrix.o
- solidify/face.h (struct matrix): moved to solidify/matrix.h
- solidify/overlap.c (point, merge_matrix, draw_map): precalculate a single
  vA+b transformation instead of stepwise transforming the vector inside
  the loop
- solidify/overlap.c (do_shift): now that the math is right (or at least
  better), reverse the shift
2010-09-24 16:42:36 -03:00

39 lines
825 B
C

/*
* 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.
*/
#ifndef FACE_H
#define FACE_H
#include "array.h"
#include "matrix.h"
struct face {
struct array *a;
int sx, sy; /* size */
int cx, cy; /* center */
int z_ref;
double fx, fy; /* inclination factor */
struct matrix m;
};
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);
}
struct face *read_face(const char *name);
#endif /* !FACE_H */