File: libgimpmath-GimpVector.html

package info (click to toggle)
gimp 2.2.6-1sarge4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 97,088 kB
  • ctags: 43,756
  • sloc: ansic: 525,782; xml: 36,543; lisp: 9,851; sh: 9,007; makefile: 7,974; python: 2,622; perl: 2,589; yacc: 520; lex: 334
file content (550 lines) | stat: -rw-r--r-- 76,103 bytes parent folder | download
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>GimpVector</title><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"><link rel="start" href="index.html" title="GIMP Math Library Reference Manual"><link rel="up" href="libgimpmath.html" title="PartI.GIMP Math Library"><link rel="prev" href="libgimpmath-GimpMatrix.html" title="GimpMatrix"><link rel="next" href="libgimpmath-GimpMD5.html" title="GimpMD5"><meta name="generator" content="GTK-Doc V1.2 (XML mode)"><style type="text/css">
        .synopsis, .classsynopsis {
            background: #eeeeee;
            border: solid 1px #aaaaaa;
            padding: 0.5em;
        }
        .programlisting {
            background: #eeeeff;
            border: solid 1px #aaaaff;
            padding: 0.5em;
        }
        .variablelist {
            padding: 4px;
            margin-left: 3em;
        }
        .navigation {
            background: #ffeeee;
            border: solid 1px #ffaaaa;
            margin-top: 0.5em;
            margin-bottom: 0.5em;
        }
        .navigation a {
            color: #770000;
        }
        .navigation a:visited {
            color: #550000;
        }
        .navigation .title {
            font-size: 200%;
        }
      </style></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libgimpmath-GimpMatrix.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="libgimpmath.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GIMP Math Library Reference Manual</th><td><a accesskey="n" href="libgimpmath-GimpMD5.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="libgimpmath-GimpVector"></a><div class="titlepage"></div><div class="refnamediv"><h2><span class="refentrytitle">GimpVector</span></h2><p>GimpVector &#8212; Utilities to set up and manipulate vectors.</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">



struct      <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a>;
struct      <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a>;
struct      <a href="libgimpmath-GimpVector.html#GimpVector4">GimpVector4</a>;
<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> <a href="libgimpmath-GimpVector.html#gimp-vector2-new">gimp_vector2_new</a>                (gdouble x,
                                             gdouble y);
void        <a href="libgimpmath-GimpVector.html#gimp-vector2-set">gimp_vector2_set</a>                (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector,
                                             gdouble x,
                                             gdouble y);
gdouble     <a href="libgimpmath-GimpVector.html#gimp-vector2-length">gimp_vector2_length</a>             (const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector);
gdouble     <a href="libgimpmath-GimpVector.html#gimp-vector2-length-val">gimp_vector2_length_val</a>         (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector);
void        <a href="libgimpmath-GimpVector.html#gimp-vector2-mul">gimp_vector2_mul</a>                (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector,
                                             gdouble factor);
<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> <a href="libgimpmath-GimpVector.html#gimp-vector2-mul-val">gimp_vector2_mul_val</a>            (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector,
                                             gdouble factor);
void        <a href="libgimpmath-GimpVector.html#gimp-vector2-normalize">gimp_vector2_normalize</a>          (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector);
<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> <a href="libgimpmath-GimpVector.html#gimp-vector2-normalize-val">gimp_vector2_normalize_val</a>      (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector);
void        <a href="libgimpmath-GimpVector.html#gimp-vector2-neg">gimp_vector2_neg</a>                (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector);
<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> <a href="libgimpmath-GimpVector.html#gimp-vector2-neg-val">gimp_vector2_neg_val</a>            (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector);
void        <a href="libgimpmath-GimpVector.html#gimp-vector2-add">gimp_vector2_add</a>                (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *result,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector2);
<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> <a href="libgimpmath-GimpVector.html#gimp-vector2-add-val">gimp_vector2_add_val</a>            (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector2);
void        <a href="libgimpmath-GimpVector.html#gimp-vector2-sub">gimp_vector2_sub</a>                (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *result,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector2);
<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> <a href="libgimpmath-GimpVector.html#gimp-vector2-sub-val">gimp_vector2_sub_val</a>            (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector2);
gdouble     <a href="libgimpmath-GimpVector.html#gimp-vector2-inner-product">gimp_vector2_inner_product</a>      (const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector2);
gdouble     <a href="libgimpmath-GimpVector.html#gimp-vector2-inner-product-val">gimp_vector2_inner_product_val</a>  (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector2);
<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> <a href="libgimpmath-GimpVector.html#gimp-vector2-cross-product">gimp_vector2_cross_product</a>      (const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector2);
<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> <a href="libgimpmath-GimpVector.html#gimp-vector2-cross-product-val">gimp_vector2_cross_product_val</a>  (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector2);
void        <a href="libgimpmath-GimpVector.html#gimp-vector2-rotate">gimp_vector2_rotate</a>             (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector,
                                             gdouble alpha);
<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> <a href="libgimpmath-GimpVector.html#gimp-vector2-rotate-val">gimp_vector2_rotate_val</a>         (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector,
                                             gdouble alpha);
<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> <a href="libgimpmath-GimpVector.html#gimp-vector3-new">gimp_vector3_new</a>                (gdouble x,
                                             gdouble y,
                                             gdouble z);
void        <a href="libgimpmath-GimpVector.html#gimp-vector3-set">gimp_vector3_set</a>                (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector,
                                             gdouble x,
                                             gdouble y,
                                             gdouble z);
gdouble     <a href="libgimpmath-GimpVector.html#gimp-vector3-length">gimp_vector3_length</a>             (const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector);
gdouble     <a href="libgimpmath-GimpVector.html#gimp-vector3-length-val">gimp_vector3_length_val</a>         (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector);
void        <a href="libgimpmath-GimpVector.html#gimp-vector3-mul">gimp_vector3_mul</a>                (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector,
                                             gdouble factor);
<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> <a href="libgimpmath-GimpVector.html#gimp-vector3-mul-val">gimp_vector3_mul_val</a>            (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector,
                                             gdouble factor);
void        <a href="libgimpmath-GimpVector.html#gimp-vector3-normalize">gimp_vector3_normalize</a>          (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector);
<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> <a href="libgimpmath-GimpVector.html#gimp-vector3-normalize-val">gimp_vector3_normalize_val</a>      (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector);
void        <a href="libgimpmath-GimpVector.html#gimp-vector3-neg">gimp_vector3_neg</a>                (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector);
<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> <a href="libgimpmath-GimpVector.html#gimp-vector3-neg-val">gimp_vector3_neg_val</a>            (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector);
void        <a href="libgimpmath-GimpVector.html#gimp-vector3-add">gimp_vector3_add</a>                (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *result,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector2);
<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> <a href="libgimpmath-GimpVector.html#gimp-vector3-add-val">gimp_vector3_add_val</a>            (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector2);
void        <a href="libgimpmath-GimpVector.html#gimp-vector3-sub">gimp_vector3_sub</a>                (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *result,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector2);
<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> <a href="libgimpmath-GimpVector.html#gimp-vector3-sub-val">gimp_vector3_sub_val</a>            (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector2);
gdouble     <a href="libgimpmath-GimpVector.html#gimp-vector3-inner-product">gimp_vector3_inner_product</a>      (const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector2);
gdouble     <a href="libgimpmath-GimpVector.html#gimp-vector3-inner-product-val">gimp_vector3_inner_product_val</a>  (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector2);
<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> <a href="libgimpmath-GimpVector.html#gimp-vector3-cross-product">gimp_vector3_cross_product</a>      (const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector2);
<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> <a href="libgimpmath-GimpVector.html#gimp-vector3-cross-product-val">gimp_vector3_cross_product_val</a>  (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector2);
void        <a href="libgimpmath-GimpVector.html#gimp-vector3-rotate">gimp_vector3_rotate</a>             (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector,
                                             gdouble alpha,
                                             gdouble beta,
                                             gdouble gamma);
<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> <a href="libgimpmath-GimpVector.html#gimp-vector3-rotate-val">gimp_vector3_rotate_val</a>         (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector,
                                             gdouble alpha,
                                             gdouble beta,
                                             gdouble gamma);
void        <a href="libgimpmath-GimpVector.html#gimp-vector-2d-to-3d">gimp_vector_2d_to_3d</a>            (gint sx,
                                             gint sy,
                                             gint w,
                                             gint h,
                                             gint x,
                                             gint y,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vp,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *p);
<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> <a href="libgimpmath-GimpVector.html#gimp-vector-2d-to-3d-val">gimp_vector_2d_to_3d_val</a>        (gint sx,
                                             gint sy,
                                             gint w,
                                             gint h,
                                             gint x,
                                             gint y,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vp,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> p);
void        <a href="libgimpmath-GimpVector.html#gimp-vector-3d-to-2d">gimp_vector_3d_to_2d</a>            (gint sx,
                                             gint sy,
                                             gint w,
                                             gint h,
                                             gdouble *x,
                                             gdouble *y,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vp,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *p);
</pre></div><div class="refsect1" lang="en"><a name="id2588177"></a><h2>Description</h2><p>
Utilities to set up and manipulate vectors.

</p></div><div class="refsect1" lang="en"><a name="id2588188"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2588193"></a><h3><a name="GimpVector2"></a>struct GimpVector2</h3><a class="indexterm" name="id2588201"></a><pre class="programlisting">struct GimpVector2 {

  gdouble x, y;
};
</pre><p>
A two dimensional vector.
</p></div><hr><div class="refsect2" lang="en"><a name="id2588211"></a><h3><a name="GimpVector3"></a>struct GimpVector3</h3><a class="indexterm" name="id2588219"></a><pre class="programlisting">struct GimpVector3 {

  gdouble x, y, z;
};
</pre><p>
A three dimensional vector.
</p></div><hr><div class="refsect2" lang="en"><a name="id2588230"></a><h3><a name="GimpVector4"></a>struct GimpVector4</h3><a class="indexterm" name="id2588238"></a><pre class="programlisting">struct GimpVector4 {

  gdouble x, y, z, w;
};
</pre><p>
A four dimensional vector.
</p></div><hr><div class="refsect2" lang="en"><a name="id2588249"></a><h3><a name="gimp-vector2-new"></a>gimp_vector2_new ()</h3><a class="indexterm" name="id2588257"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> gimp_vector2_new                (gdouble x,
                                             gdouble y);</pre><p>
Creates a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a> of coordinates <i class="parameter"><tt>x</tt></i> and <i class="parameter"><tt>y</tt></i>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td> the X coordinate.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td> the Y coordinate.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the resulting <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2588340"></a><h3><a name="gimp-vector2-set"></a>gimp_vector2_set ()</h3><a class="indexterm" name="id2588348"></a><pre class="programlisting">void        gimp_vector2_set                (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector,
                                             gdouble x,
                                             gdouble y);</pre><p>
Sets the X and Y coordinates of <i class="parameter"><tt>vector</tt></i> to <i class="parameter"><tt>x</tt></i> and <i class="parameter"><tt>y</tt></i>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a pointer to a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td> the X coordinate.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td> the Y coordinate.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2588435"></a><h3><a name="gimp-vector2-length"></a>gimp_vector2_length ()</h3><a class="indexterm" name="id2588444"></a><pre class="programlisting">gdouble     gimp_vector2_length             (const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector);</pre><p>
Computes the length of a 2D vector.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a pointer to a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the length of <i class="parameter"><tt>vector</tt></i> (a positive gdouble).
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2588500"></a><h3><a name="gimp-vector2-length-val"></a>gimp_vector2_length_val ()</h3><a class="indexterm" name="id2588509"></a><pre class="programlisting">gdouble     gimp_vector2_length_val         (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector2-length"><tt class="function">gimp_vector2_length()</tt></a> but the
vector is passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the length of <i class="parameter"><tt>vector</tt></i> (a positive gdouble).
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2588574"></a><h3><a name="gimp-vector2-mul"></a>gimp_vector2_mul ()</h3><a class="indexterm" name="id2588582"></a><pre class="programlisting">void        gimp_vector2_mul                (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector,
                                             gdouble factor);</pre><p>
Multiplies each component of the <i class="parameter"><tt>vector</tt></i> by <i class="parameter"><tt>factor</tt></i>. Note that this
is equivalent to multiplying the vectors length by <i class="parameter"><tt>factor</tt></i>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a pointer to a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>factor</tt></i>:</span></td><td> a scalar.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2588655"></a><h3><a name="gimp-vector2-mul-val"></a>gimp_vector2_mul_val ()</h3><a class="indexterm" name="id2588663"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> gimp_vector2_mul_val            (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector,
                                             gdouble factor);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector2-mul"><tt class="function">gimp_vector2_mul()</tt></a> but the vector is
passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>factor</tt></i>:</span></td><td> a scalar.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the resulting <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2588748"></a><h3><a name="gimp-vector2-normalize"></a>gimp_vector2_normalize ()</h3><a class="indexterm" name="id2588756"></a><pre class="programlisting">void        gimp_vector2_normalize          (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector);</pre><p>
Normalizes the <i class="parameter"><tt>vector</tt></i> so the length of the <i class="parameter"><tt>vector</tt></i> is 1.0. The nul
vector will not be changed.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a pointer to a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2588808"></a><h3><a name="gimp-vector2-normalize-val"></a>gimp_vector2_normalize_val ()</h3><a class="indexterm" name="id2588817"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> gimp_vector2_normalize_val      (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector2-normalize"><tt class="function">gimp_vector2_normalize()</tt></a> but the
vector is passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a> parallel to <i class="parameter"><tt>vector</tt></i>, pointing in the same
direction but with a length of 1.0.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2588889"></a><h3><a name="gimp-vector2-neg"></a>gimp_vector2_neg ()</h3><a class="indexterm" name="id2588897"></a><pre class="programlisting">void        gimp_vector2_neg                (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector);</pre><p>
Negates the <i class="parameter"><tt>vector</tt></i> (i.e. negate all its coordinates).</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a pointer to a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2588945"></a><h3><a name="gimp-vector2-neg-val"></a>gimp_vector2_neg_val ()</h3><a class="indexterm" name="id2588954"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> gimp_vector2_neg_val            (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector2-neg"><tt class="function">gimp_vector2_neg()</tt></a> but the vector
is passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the negated <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2589021"></a><h3><a name="gimp-vector2-add"></a>gimp_vector2_add ()</h3><a class="indexterm" name="id2589030"></a><pre class="programlisting">void        gimp_vector2_add                (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *result,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector2);</pre><p>
Computes the sum of two 2D vectors. The resulting <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a> is
stored in <i class="parameter"><tt>result</tt></i>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>result</tt></i>:</span></td><td> destination for the resulting <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> a pointer to the first <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> a pointer to the second <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2589132"></a><h3><a name="gimp-vector2-add-val"></a>gimp_vector2_add_val ()</h3><a class="indexterm" name="id2589140"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> gimp_vector2_add_val            (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector2);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector2-add"><tt class="function">gimp_vector2_add()</tt></a> but the vectors
are passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> the first <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> the second <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the resulting <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2589231"></a><h3><a name="gimp-vector2-sub"></a>gimp_vector2_sub ()</h3><a class="indexterm" name="id2589239"></a><pre class="programlisting">void        gimp_vector2_sub                (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *result,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector2);</pre><p>
Computes the difference of two 2D vectors (<i class="parameter"><tt>vector1</tt></i> minus <i class="parameter"><tt>vector2</tt></i>).
The resulting <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a> is stored in <i class="parameter"><tt>result</tt></i>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>result</tt></i>:</span></td><td> the destination for the resulting <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> a pointer to the first <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> a pointer to the second <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2589348"></a><h3><a name="gimp-vector2-sub-val"></a>gimp_vector2_sub_val ()</h3><a class="indexterm" name="id2589356"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> gimp_vector2_sub_val            (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector2);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector2-sub"><tt class="function">gimp_vector2_sub()</tt></a> but the vectors
are passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> the first <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> the second <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the resulting <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2589447"></a><h3><a name="gimp-vector2-inner-product"></a>gimp_vector2_inner_product ()</h3><a class="indexterm" name="id2589456"></a><pre class="programlisting">gdouble     gimp_vector2_inner_product      (const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector2);</pre><p>
Computes the inner (dot) product of two 2D vectors.
This product is zero if and only if the two vectors are orthognal.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> a pointer to the first <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> a pointer to the second <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The inner product.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2589535"></a><h3><a name="gimp-vector2-inner-product-val"></a>gimp_vector2_inner_product_val ()</h3><a class="indexterm" name="id2589546"></a><pre class="programlisting">gdouble     gimp_vector2_inner_product_val  (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector2);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector2-inner-product"><tt class="function">gimp_vector2_inner_product()</tt></a> but the
vectors are passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> the first <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> the second <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The inner product.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2589633"></a><h3><a name="gimp-vector2-cross-product"></a>gimp_vector2_cross_product ()</h3><a class="indexterm" name="id2589642"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> gimp_vector2_cross_product      (const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector2);</pre><p>
Compute the cross product of two vectors. The result is a
<a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a> which is orthognal to both <i class="parameter"><tt>vector1</tt></i> and <i class="parameter"><tt>vector2</tt></i>. If
<i class="parameter"><tt>vector1</tt></i> and <i class="parameter"><tt>vector2</tt></i> are parallel, the result will be the nul
vector.
</p><p>
Note that in 2D, this function is useful to test if two vectors are
parallel or not, or to compute the area spawned by two vectors.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> a pointer to the first <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> a pointer to the second <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The cross product.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2589746"></a><h3><a name="gimp-vector2-cross-product-val"></a>gimp_vector2_cross_product_val ()</h3><a class="indexterm" name="id2589757"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> gimp_vector2_cross_product_val  (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector2);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector2-cross-product"><tt class="function">gimp_vector2_cross_product()</tt></a> but the
vectors are passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> the first <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> the second <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The cross product.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2589843"></a><h3><a name="gimp-vector2-rotate"></a>gimp_vector2_rotate ()</h3><a class="indexterm" name="id2589853"></a><pre class="programlisting">void        gimp_vector2_rotate             (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> *vector,
                                             gdouble alpha);</pre><p>
Rotates the <i class="parameter"><tt>vector</tt></i> counterclockwise by <i class="parameter"><tt>alpha</tt></i> radians.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a pointer to a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>alpha</tt></i>:</span></td><td> an angle (in radians).
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2589934"></a><h3><a name="gimp-vector2-rotate-val"></a>gimp_vector2_rotate_val ()</h3><a class="indexterm" name="id2589944"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> gimp_vector2_rotate_val         (<a href="libgimpmath-GimpVector.html#GimpVector2">GimpVector2</a> vector,
                                             gdouble alpha);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector2-rotate"><tt class="function">gimp_vector2_rotate()</tt></a> but the vector
is passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>alpha</tt></i>:</span></td><td> an angle (in radians).
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector2"><span class="type">GimpVector2</span></a> representing <i class="parameter"><tt>vector</tt></i> rotated by <i class="parameter"><tt>alpha</tt></i>
radians.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2590018"></a><h3><a name="gimp-vector3-new"></a>gimp_vector3_new ()</h3><a class="indexterm" name="id2590026"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> gimp_vector3_new                (gdouble x,
                                             gdouble y,
                                             gdouble z);</pre><p>
Creates a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a> of coordinate <i class="parameter"><tt>x</tt></i>, <i class="parameter"><tt>y</tt></i> and <i class="parameter"><tt>z</tt></i>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td> the X coordinate.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td> the Y coordinate.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>z</tt></i>:</span></td><td> the Z coordinate.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the resulting <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2590120"></a><h3><a name="gimp-vector3-set"></a>gimp_vector3_set ()</h3><a class="indexterm" name="id2590128"></a><pre class="programlisting">void        gimp_vector3_set                (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector,
                                             gdouble x,
                                             gdouble y,
                                             gdouble z);</pre><p>
Sets the X, Y and Z coordinates of <i class="parameter"><tt>vector</tt></i> to <i class="parameter"><tt>x</tt></i>, <i class="parameter"><tt>y</tt></i> and <i class="parameter"><tt>z</tt></i>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a pointer to a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td> the X coordinate.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td> the Y coordinate.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>z</tt></i>:</span></td><td> the Z coordinate.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2590236"></a><h3><a name="gimp-vector3-length"></a>gimp_vector3_length ()</h3><a class="indexterm" name="id2590245"></a><pre class="programlisting">gdouble     gimp_vector3_length             (const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector);</pre><p>
Computes the length of a 3D vector.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a pointer to a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the length of <i class="parameter"><tt>vector</tt></i> (a positive gdouble).
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2590302"></a><h3><a name="gimp-vector3-length-val"></a>gimp_vector3_length_val ()</h3><a class="indexterm" name="id2590311"></a><pre class="programlisting">gdouble     gimp_vector3_length_val         (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector3-length"><tt class="function">gimp_vector3_length()</tt></a> but the vector
is passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the length of <i class="parameter"><tt>vector</tt></i> (a positive gdouble).
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2590376"></a><h3><a name="gimp-vector3-mul"></a>gimp_vector3_mul ()</h3><a class="indexterm" name="id2590384"></a><pre class="programlisting">void        gimp_vector3_mul                (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector,
                                             gdouble factor);</pre><p>
Multiplies each component of the <i class="parameter"><tt>vector</tt></i> by <i class="parameter"><tt>factor</tt></i>. Note that
this is equivalent to multiplying the vectors length by <i class="parameter"><tt>factor</tt></i>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a pointer to a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>factor</tt></i>:</span></td><td> a scalar.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2590457"></a><h3><a name="gimp-vector3-mul-val"></a>gimp_vector3_mul_val ()</h3><a class="indexterm" name="id2590465"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> gimp_vector3_mul_val            (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector,
                                             gdouble factor);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector3-mul"><tt class="function">gimp_vector3_mul()</tt></a> but the vector is
passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>factor</tt></i>:</span></td><td> a scalar.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the resulting <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2590550"></a><h3><a name="gimp-vector3-normalize"></a>gimp_vector3_normalize ()</h3><a class="indexterm" name="id2590558"></a><pre class="programlisting">void        gimp_vector3_normalize          (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector);</pre><p>
Normalizes the <i class="parameter"><tt>vector</tt></i> so the length of the <i class="parameter"><tt>vector</tt></i> is 1.0. The nul
vector will not be changed.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a pointer to a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2590610"></a><h3><a name="gimp-vector3-normalize-val"></a>gimp_vector3_normalize_val ()</h3><a class="indexterm" name="id2590619"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> gimp_vector3_normalize_val      (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector3-normalize"><tt class="function">gimp_vector3_normalize()</tt></a> but the
vector is passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a> parallel to <i class="parameter"><tt>vector</tt></i>, pointing in the same
direction but with a length of 1.0.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2590691"></a><h3><a name="gimp-vector3-neg"></a>gimp_vector3_neg ()</h3><a class="indexterm" name="id2590699"></a><pre class="programlisting">void        gimp_vector3_neg                (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector);</pre><p>
Negates the <i class="parameter"><tt>vector</tt></i> (i.e. negate all its coordinates).</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a pointer to a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2590747"></a><h3><a name="gimp-vector3-neg-val"></a>gimp_vector3_neg_val ()</h3><a class="indexterm" name="id2590756"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> gimp_vector3_neg_val            (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector3-neg"><tt class="function">gimp_vector3_neg()</tt></a> but the vector
is passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the negated <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2590823"></a><h3><a name="gimp-vector3-add"></a>gimp_vector3_add ()</h3><a class="indexterm" name="id2590832"></a><pre class="programlisting">void        gimp_vector3_add                (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *result,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector2);</pre><p>
Computes the sum of two 3D vectors. The resulting <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a> is
stored in <i class="parameter"><tt>result</tt></i>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>result</tt></i>:</span></td><td> destination for the resulting <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> a pointer to the first <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> a pointer to the second <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2590934"></a><h3><a name="gimp-vector3-add-val"></a>gimp_vector3_add_val ()</h3><a class="indexterm" name="id2590942"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> gimp_vector3_add_val            (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector2);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector3-add"><tt class="function">gimp_vector3_add()</tt></a> but the vectors
are passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the resulting <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2591033"></a><h3><a name="gimp-vector3-sub"></a>gimp_vector3_sub ()</h3><a class="indexterm" name="id2591041"></a><pre class="programlisting">void        gimp_vector3_sub                (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *result,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector2);</pre><p>
Computes the difference of two 3D vectors (<i class="parameter"><tt>vector1</tt></i> minus <i class="parameter"><tt>vector2</tt></i>).
The resulting <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a> is stored in <i class="parameter"><tt>result</tt></i>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>result</tt></i>:</span></td><td> the destination for the resulting <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> a pointer to the first <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> a pointer to the second <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2591150"></a><h3><a name="gimp-vector3-sub-val"></a>gimp_vector3_sub_val ()</h3><a class="indexterm" name="id2591158"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> gimp_vector3_sub_val            (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector2);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector3-sub"><tt class="function">gimp_vector3_sub()</tt></a> but the vectors
are passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the resulting <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2591249"></a><h3><a name="gimp-vector3-inner-product"></a>gimp_vector3_inner_product ()</h3><a class="indexterm" name="id2591258"></a><pre class="programlisting">gdouble     gimp_vector3_inner_product      (const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector2);</pre><p>
Computes the inner (dot) product of two 3D vectors. This product
is zero if and only if the two vectors are orthognal.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> a pointer to the first <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> a pointer to the second <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The inner product.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2591337"></a><h3><a name="gimp-vector3-inner-product-val"></a>gimp_vector3_inner_product_val ()</h3><a class="indexterm" name="id2591348"></a><pre class="programlisting">gdouble     gimp_vector3_inner_product_val  (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector2);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector3-inner-product"><tt class="function">gimp_vector3_inner_product()</tt></a> but the
vectors are passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> the first <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> the second <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The inner product.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2591452"></a><h3><a name="gimp-vector3-cross-product"></a>gimp_vector3_cross_product ()</h3><a class="indexterm" name="id2591465"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> gimp_vector3_cross_product      (const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector1,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector2);</pre><p>
Compute the cross product of two vectors. The result is a
<a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a> which is orthognal to both <i class="parameter"><tt>vector1</tt></i> and <i class="parameter"><tt>vector2</tt></i>. If
<i class="parameter"><tt>vector1</tt></i> and <i class="parameter"><tt>vector2</tt></i> and parallel, the result will be the nul
vector.
</p><p>
This function can be used to compute the normal of the plane
defined by <i class="parameter"><tt>vector1</tt></i> and <i class="parameter"><tt>vector2</tt></i>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> a pointer to the first <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> a pointer to the second <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The cross product.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2591601"></a><h3><a name="gimp-vector3-cross-product-val"></a>gimp_vector3_cross_product_val ()</h3><a class="indexterm" name="id2591614"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> gimp_vector3_cross_product_val  (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector1,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector2);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector3-cross-product"><tt class="function">gimp_vector3_cross_product()</tt></a> but the
vectors are passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector1</tt></i>:</span></td><td> the first <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vector2</tt></i>:</span></td><td> the second <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The cross product.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2591721"></a><h3><a name="gimp-vector3-rotate"></a>gimp_vector3_rotate ()</h3><a class="indexterm" name="id2591734"></a><pre class="programlisting">void        gimp_vector3_rotate             (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vector,
                                             gdouble alpha,
                                             gdouble beta,
                                             gdouble gamma);</pre><p>
Rotates the <i class="parameter"><tt>vector</tt></i> around the three axis (Z, Y, and X) by <i class="parameter"><tt>alpha</tt></i>,
<i class="parameter"><tt>beta</tt></i> and <i class="parameter"><tt>gamma</tt></i>, respectively.
</p><p>
Note that the order of the rotation is very important. If you
expect a vector to be rotated around X, and then around Y, you will
have to call this function twice. Also, it is often wise to call
this function with only one of <i class="parameter"><tt>alpha</tt></i>, <i class="parameter"><tt>beta</tt></i> and <i class="parameter"><tt>gamma</tt></i> non-zero.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a pointer to a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>alpha</tt></i>:</span></td><td> the angle (in radian) of rotation around the Z axis.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>beta</tt></i>:</span></td><td> the angle (in radian) of rotation around the Y axis.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>gamma</tt></i>:</span></td><td> the angle (in radian) of rotation around the X axis.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2591890"></a><h3><a name="gimp-vector3-rotate-val"></a>gimp_vector3_rotate_val ()</h3><a class="indexterm" name="id2591902"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> gimp_vector3_rotate_val         (<a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vector,
                                             gdouble alpha,
                                             gdouble beta,
                                             gdouble gamma);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector3-rotate"><tt class="function">gimp_vector3_rotate()</tt></a> but the vectors
are passed by value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>vector</tt></i>:</span></td><td> a <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>alpha</tt></i>:</span></td><td> the angle (in radian) of rotation around the Z axis.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>beta</tt></i>:</span></td><td> the angle (in radian) of rotation around the Y axis.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>gamma</tt></i>:</span></td><td> the angle (in radian) of rotation around the X axis.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the rotated vector.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2592044"></a><h3><a name="gimp-vector-2d-to-3d"></a>gimp_vector_2d_to_3d ()</h3><a class="indexterm" name="id2592058"></a><pre class="programlisting">void        gimp_vector_2d_to_3d            (gint sx,
                                             gint sy,
                                             gint w,
                                             gint h,
                                             gint x,
                                             gint y,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vp,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *p);</pre><p>
\"Compute screen (sx, sy) - (sx + w, sy + h) to 3D unit square
mapping. The plane to map to is given in the z field of p. The
observer is located at position vp (vp-&gt;z != 0.0).\"
</p><p>
In other words, this computes the projection of the point (<i class="parameter"><tt>x</tt></i>, <i class="parameter"><tt>y</tt></i>)
to the plane z = <i class="parameter"><tt>p-&gt;z</tt></i> (parallel to XY), from the <i class="parameter"><tt>vp</tt></i> point of view
through the screen (<i class="parameter"><tt>sx</tt></i>, <i class="parameter"><tt>sy</tt></i>)-&gt;(<i class="parameter"><tt>sx</tt></i> + <i class="parameter"><tt>w</tt></i>, <i class="parameter"><tt>sy</tt></i> + <i class="parameter"><tt>h</tt></i>)</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>sx</tt></i>:</span></td><td> the abscisse of the upper-left screen rectangle.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>sy</tt></i>:</span></td><td> the ordinate of the upper-left screen rectangle.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>w</tt></i>:</span></td><td> the width of the screen rectangle.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>h</tt></i>:</span></td><td> the height of the screen rectangle.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td> the abscisse of the point in the screen rectangle to map.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td> the ordinate of the point in the screen rectangle to map.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vp</tt></i>:</span></td><td> the position of the observer.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>p</tt></i>:</span></td><td> the resulting point.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2592303"></a><h3><a name="gimp-vector-2d-to-3d-val"></a>gimp_vector_2d_to_3d_val ()</h3><a class="indexterm" name="id2592316"></a><pre class="programlisting"><a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> gimp_vector_2d_to_3d_val        (gint sx,
                                             gint sy,
                                             gint w,
                                             gint h,
                                             gint x,
                                             gint y,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> vp,
                                             <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> p);</pre><p>
This function is identical to <a href="libgimpmath-GimpVector.html#gimp-vector-2d-to-3d"><tt class="function">gimp_vector_2d_to_3d()</tt></a> but the
position of the <i class="parameter"><tt>observer</tt></i> and the resulting point <i class="parameter"><tt>p</tt></i> are passed by
value rather than by reference.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>sx</tt></i>:</span></td><td> the abscisse of the upper-left screen rectangle.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>sy</tt></i>:</span></td><td> the ordinate of the upper-left screen rectangle.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>w</tt></i>:</span></td><td> the width of the screen rectangle.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>h</tt></i>:</span></td><td> the height of the screen rectangle.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td> the abscisse of the point in the screen rectangle to map.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td> the ordinate of the point in the screen rectangle to map.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vp</tt></i>:</span></td><td> position of the observer.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>p</tt></i>:</span></td><td> the resulting point.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the computed <a href="libgimpmath-GimpVector.html#GimpVector3"><span class="type">GimpVector3</span></a> point.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2592551"></a><h3><a name="gimp-vector-3d-to-2d"></a>gimp_vector_3d_to_2d ()</h3><a class="indexterm" name="id2592564"></a><pre class="programlisting">void        gimp_vector_3d_to_2d            (gint sx,
                                             gint sy,
                                             gint w,
                                             gint h,
                                             gdouble *x,
                                             gdouble *y,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *vp,
                                             const <a href="libgimpmath-GimpVector.html#GimpVector3">GimpVector3</a> *p);</pre><p>
Convert the given 3D point to 2D (project it onto the viewing
plane, (sx, sy, 0) - (sx + w, sy + h, 0). The input is assumed to
be in the unit square (0, 0, z) - (1, 1, z). The viewpoint of the
observer is passed in vp.
</p><p>
This is basically the opposite of <a href="libgimpmath-GimpVector.html#gimp-vector-2d-to-3d"><tt class="function">gimp_vector_2d_to_3d()</tt></a>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>sx</tt></i>:</span></td><td> the abscisse of the upper-left screen rectangle.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>sy</tt></i>:</span></td><td> the ordinate of the upper-left screen rectangle.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>w</tt></i>:</span></td><td> the width of the screen rectangle.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>h</tt></i>:</span></td><td> the height of the screen rectangle.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td> the abscisse of the point in the screen rectangle to map (return value).
</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td> the ordinate of the point in the screen rectangle to map (return value).
</td></tr><tr><td><span class="term"><i class="parameter"><tt>vp</tt></i>:</span></td><td> position of the observer.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>p</tt></i>:</span></td><td> the 3D point to project to the plane.
</td></tr></tbody></table></div></div></div><div class="refsect1" lang="en"><a name="id2592780"></a><h2>See Also</h2><p>
<a href="libgimpmath-GimpMatrix.html#GimpMatrix3"><span class="type">GimpMatrix3</span></a>
</p><p>
<a href="libgimpmath-GimpMatrix.html#GimpMatrix4"><span class="type">GimpMatrix4</span></a>
</p></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="libgimpmath-GimpMatrix.html"><b>&lt;&lt;GimpMatrix</b></a></td><td align="right"><a accesskey="n" href="libgimpmath-GimpMD5.html"><b>GimpMD5&gt;&gt;</b></a></td></tr></table></body></html>