blob: 40f37cd2ce5ad05eaa8623b28974e1cd0f1232af (
plain)
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
|
/* Copyright (C) 2001-2015 Peter Selinger.
This file is part of Potrace. It is free software and it is covered
by the GNU General Public License. See the file COPYING for details. */
#ifndef TRANS_H
#define TRANS_H
#include "auxiliary.h"
/* structure to hold a coordinate transformation */
struct trans_s {
double bb[2]; /* dimensions of bounding box */
double orig[2]; /* origin relative to bounding box */
double x[2]; /* basis vector for the "x" direction */
double y[2]; /* basis vector for the "y" direction */
double scalex, scaley; /* redundant info for some backends' benefit */
};
typedef struct trans_s trans_t;
/* apply a coordinate transformation to a point */
static inline dpoint_t trans(dpoint_t p, trans_t t) {
dpoint_t res;
res.x = t.orig[0] + p.x * t.x[0] + p.y * t.y[0];
res.y = t.orig[1] + p.x * t.x[1] + p.y * t.y[1];
return res;
}
void trans_rotate(trans_t *r, double alpha);
void trans_from_rect(trans_t *r, double w, double h);
void trans_rescale(trans_t *r, double sc);
void trans_scale_to_size(trans_t *r, double w, double h);
void trans_tighten(trans_t *r, potrace_path_t *plist);
#endif /* TRANS_H */
|