typedef struct setface_ctx
{
int xmin, xmax, ymin, ymax;
- int aoff;
grid *g;
tree234 *points;
setface_ctx *sf_ctx = (setface_ctx *)state->ctx;
int i;
int xs[4], ys[4];
- double cosa = cos(sf_ctx->aoff * PI / 180.0);
- double sina = sin(sf_ctx->aoff * PI / 180.0);
if (depth < state->max_depth) return 0;
#ifdef DEBUG_PENROSE
for (i = 0; i < n; i++) {
double tx = v_x(vs, i), ty = v_y(vs, i);
- xs[i] = (int)round_int_nearest_away( tx*cosa + ty*sina);
- ys[i] = (int)round_int_nearest_away(-tx*sina + ty*cosa);
+ xs[i] = (int)round_int_nearest_away(tx);
+ ys[i] = (int)round_int_nearest_away(ty);
if (xs[i] < sf_ctx->xmin || xs[i] > sf_ctx->xmax) return 0;
if (ys[i] < sf_ctx->ymin || ys[i] > sf_ctx->ymax) return 0;
static grid *grid_new_penrose(int width, int height, int which, char *desc)
{
int max_faces, max_dots, tilesize = PENROSE_TILESIZE;
- int xsz, ysz, xoff, yoff;
+ int xsz, ysz, xoff, yoff, aoff;
double rradius;
tree234 *points;
sf_ctx.points = points;
if (desc != NULL) {
- if (sscanf(desc, "G%d,%d,%d", &xoff, &yoff, &sf_ctx.aoff) != 3)
+ if (sscanf(desc, "G%d,%d,%d", &xoff, &yoff, &aoff) != 3)
assert(!"Invalid grid description.");
} else {
xoff = yoff = 0;
debug(("penrose: x range (%f --> %f), y range (%f --> %f)",
sf_ctx.xmin, sf_ctx.xmax, sf_ctx.ymin, sf_ctx.ymax));
- penrose(&ps, which);
+ penrose(&ps, which, aoff);
freetree234(points);
assert(g->num_faces <= max_faces);
* (later mail: this is an overestimate by about 5%)
*/
-int penrose(penrose_state *state, int which)
+int penrose(penrose_state *state, int which, int angle)
{
vector vo = v_origin();
vector vb = v_origin();
vb.b = state->start_size;
+ vo = v_rotate(vo, angle);
+ vb = v_rotate(vb, angle);
+
if (which == PENROSE_P2)
return penrose_p2_large(state, 0, 1, vo, vb);
else
enum { PENROSE_P2, PENROSE_P3 };
-extern int penrose(penrose_state *state, int which);
+extern int penrose(penrose_state *state, int which, int angle);
/* Returns the side-length of a penrose tile at recursion level
* gen, given a starting side length. */