~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/sel2path/vector.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* vector.c: vector/point operations.
2
 
 
3
 
Copyright (C) 1992 Free Software Foundation, Inc.
4
 
 
5
 
This program is free software; you can redistribute it and/or modify
6
 
it under the terms of the GNU General Public License as published by
7
 
the Free Software Foundation; either version 2, or (at your option)
8
 
any later version.
9
 
 
10
 
This program is distributed in the hope that it will be useful,
11
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
GNU General Public License for more details.
14
 
 
15
 
You should have received a copy of the GNU General Public License
16
 
along with this program; if not, write to the Free Software
17
 
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
2
 *
 
3
 * Copyright (C) 1992 Free Software Foundation, Inc.
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2, or (at your option)
 
8
 * any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
18
 */
 
19
 
 
20
#include "config.h"
18
21
 
19
22
#include <glib.h>
20
23
 
110
113
 
111
114
/* Given the IN_VECTOR and OUT_VECTOR, return the angle between them in
112
115
   degrees, in the range zero to 180.  */
113
 
   
 
116
 
114
117
real
115
118
Vangle (const vector_type in_vector, const vector_type out_vector)
116
119
{
147
150
Vadd_int_point (const coordinate_type c, const vector_type v)
148
151
{
149
152
  coordinate_type a;
150
 
  
 
153
 
151
154
  a.x = SROUND ((real) c.x + v.dx);
152
155
  a.y = SROUND ((real) c.y + v.dy);
153
156
  return a;
158
161
Vabs (const vector_type v)
159
162
{
160
163
  vector_type new_v;
161
 
  
 
164
 
162
165
  new_v.dx = fabs (v.dx);
163
166
  new_v.dy = fabs (v.dy);
164
167
  return new_v;
196
199
IPsubtractP (const coordinate_type c1, const coordinate_type c2)
197
200
{
198
201
  coordinate_type c;
199
 
  
 
202
 
200
203
  c.x = c1.x - c2.x;
201
204
  c.y = c1.y - c2.y;
202
 
  
 
205
 
203
206
  return c;
204
207
}
205
208
 
208
211
IPadd (const coordinate_type c1, const coordinate_type c2)
209
212
{
210
213
  coordinate_type c;
211
 
  
 
214
 
212
215
  c.x = c1.x + c2.x;
213
216
  c.y = c1.y + c2.y;
214
 
  
 
217
 
215
218
  return c;
216
219
}
217
220
 
220
223
IPmult_scalar (const coordinate_type c, const int i)
221
224
{
222
225
  coordinate_type a;
223
 
  
 
226
 
224
227
  a.x = c.x * i;
225
228
  a.y = c.y * i;
226
 
  
 
229
 
227
230
  return a;
228
231
}
229
232