OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
trans.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2015 Peter Selinger.
2  This file is part of Potrace. It is free software and it is covered
3  by the GNU General Public License. See the file COPYING for details. */
4 
5 
6 #ifndef TRANS_H
7 #define TRANS_H
8 
9 #include "auxiliary.h"
10 
11 /* structure to hold a coordinate transformation */
12 struct trans_s {
13  double bb[2]; /* dimensions of bounding box */
14  double orig[2]; /* origin relative to bounding box */
15  double x[2]; /* basis vector for the "x" direction */
16  double y[2]; /* basis vector for the "y" direction */
17  double scalex, scaley; /* redundant info for some backends' benefit */
18 };
19 typedef struct trans_s trans_t;
20 
21 /* apply a coordinate transformation to a point */
22 static inline dpoint_t trans(dpoint_t p, trans_t t) {
23  dpoint_t res;
24 
25  res.x = t.orig[0] + p.x * t.x[0] + p.y * t.y[0];
26  res.y = t.orig[1] + p.x * t.x[1] + p.y * t.y[1];
27  return res;
28 }
29 
30 #endif /* TRANS_H */
double y[2]
Definition: trans.h:16
double bb[2]
Definition: trans.h:13
Definition: trans.h:12
double scalex
Definition: trans.h:17
double x[2]
Definition: trans.h:15
double scaley
Definition: trans.h:17
double orig[2]
Definition: trans.h:14