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 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073
|
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="libgimpmath-GimpVector">
<refmeta>
<refentrytitle>GimpVector</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBGIMPMATH Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GimpVector</refname><refpurpose>Utilities to set up and manipulate vectors.</refpurpose>
</refnamediv>
<refsynopsisdiv><title>Synopsis</title>
<synopsis>
<link linkend="GimpVector2">GimpVector2</link>;
<link linkend="GimpVector3">GimpVector3</link>;
<link linkend="GimpVector4">GimpVector4</link>;
<link linkend="GimpVector2">GimpVector2</link> <link linkend="gimp-vector2-new">gimp_vector2_new</link> (<link linkend="gdouble">gdouble</link> x,
<link linkend="gdouble">gdouble</link> y);
<link linkend="void">void</link> <link linkend="gimp-vector2-set">gimp_vector2_set</link> (<link linkend="GimpVector2">GimpVector2</link> *vector,
<link linkend="gdouble">gdouble</link> x,
<link linkend="gdouble">gdouble</link> y);
<link linkend="gdouble">gdouble</link> <link linkend="gimp-vector2-length">gimp_vector2_length</link> (const <link linkend="GimpVector2">GimpVector2</link> *vector);
<link linkend="gdouble">gdouble</link> <link linkend="gimp-vector2-length-val">gimp_vector2_length_val</link> (<link linkend="GimpVector2">GimpVector2</link> vector);
<link linkend="void">void</link> <link linkend="gimp-vector2-mul">gimp_vector2_mul</link> (<link linkend="GimpVector2">GimpVector2</link> *vector,
<link linkend="gdouble">gdouble</link> factor);
<link linkend="GimpVector2">GimpVector2</link> <link linkend="gimp-vector2-mul-val">gimp_vector2_mul_val</link> (<link linkend="GimpVector2">GimpVector2</link> vector,
<link linkend="gdouble">gdouble</link> factor);
<link linkend="void">void</link> <link linkend="gimp-vector2-normalize">gimp_vector2_normalize</link> (<link linkend="GimpVector2">GimpVector2</link> *vector);
<link linkend="GimpVector2">GimpVector2</link> <link linkend="gimp-vector2-normalize-val">gimp_vector2_normalize_val</link> (<link linkend="GimpVector2">GimpVector2</link> vector);
<link linkend="void">void</link> <link linkend="gimp-vector2-neg">gimp_vector2_neg</link> (<link linkend="GimpVector2">GimpVector2</link> *vector);
<link linkend="GimpVector2">GimpVector2</link> <link linkend="gimp-vector2-neg-val">gimp_vector2_neg_val</link> (<link linkend="GimpVector2">GimpVector2</link> vector);
<link linkend="void">void</link> <link linkend="gimp-vector2-add">gimp_vector2_add</link> (<link linkend="GimpVector2">GimpVector2</link> *result,
const <link linkend="GimpVector2">GimpVector2</link> *vector1,
const <link linkend="GimpVector2">GimpVector2</link> *vector2);
<link linkend="GimpVector2">GimpVector2</link> <link linkend="gimp-vector2-add-val">gimp_vector2_add_val</link> (<link linkend="GimpVector2">GimpVector2</link> vector1,
<link linkend="GimpVector2">GimpVector2</link> vector2);
<link linkend="void">void</link> <link linkend="gimp-vector2-sub">gimp_vector2_sub</link> (<link linkend="GimpVector2">GimpVector2</link> *result,
const <link linkend="GimpVector2">GimpVector2</link> *vector1,
const <link linkend="GimpVector2">GimpVector2</link> *vector2);
<link linkend="GimpVector2">GimpVector2</link> <link linkend="gimp-vector2-sub-val">gimp_vector2_sub_val</link> (<link linkend="GimpVector2">GimpVector2</link> vector1,
<link linkend="GimpVector2">GimpVector2</link> vector2);
<link linkend="gdouble">gdouble</link> <link linkend="gimp-vector2-inner-product">gimp_vector2_inner_product</link> (const <link linkend="GimpVector2">GimpVector2</link> *vector1,
const <link linkend="GimpVector2">GimpVector2</link> *vector2);
<link linkend="gdouble">gdouble</link> <link linkend="gimp-vector2-inner-product-val">gimp_vector2_inner_product_val</link> (<link linkend="GimpVector2">GimpVector2</link> vector1,
<link linkend="GimpVector2">GimpVector2</link> vector2);
<link linkend="GimpVector2">GimpVector2</link> <link linkend="gimp-vector2-cross-product">gimp_vector2_cross_product</link> (const <link linkend="GimpVector2">GimpVector2</link> *vector1,
const <link linkend="GimpVector2">GimpVector2</link> *vector2);
<link linkend="GimpVector2">GimpVector2</link> <link linkend="gimp-vector2-cross-product-val">gimp_vector2_cross_product_val</link> (<link linkend="GimpVector2">GimpVector2</link> vector1,
<link linkend="GimpVector2">GimpVector2</link> vector2);
<link linkend="void">void</link> <link linkend="gimp-vector2-rotate">gimp_vector2_rotate</link> (<link linkend="GimpVector2">GimpVector2</link> *vector,
<link linkend="gdouble">gdouble</link> alpha);
<link linkend="GimpVector2">GimpVector2</link> <link linkend="gimp-vector2-rotate-val">gimp_vector2_rotate_val</link> (<link linkend="GimpVector2">GimpVector2</link> vector,
<link linkend="gdouble">gdouble</link> alpha);
<link linkend="GimpVector3">GimpVector3</link> <link linkend="gimp-vector3-new">gimp_vector3_new</link> (<link linkend="gdouble">gdouble</link> x,
<link linkend="gdouble">gdouble</link> y,
<link linkend="gdouble">gdouble</link> z);
<link linkend="void">void</link> <link linkend="gimp-vector3-set">gimp_vector3_set</link> (<link linkend="GimpVector3">GimpVector3</link> *vector,
<link linkend="gdouble">gdouble</link> x,
<link linkend="gdouble">gdouble</link> y,
<link linkend="gdouble">gdouble</link> z);
<link linkend="gdouble">gdouble</link> <link linkend="gimp-vector3-length">gimp_vector3_length</link> (const <link linkend="GimpVector3">GimpVector3</link> *vector);
<link linkend="gdouble">gdouble</link> <link linkend="gimp-vector3-length-val">gimp_vector3_length_val</link> (<link linkend="GimpVector3">GimpVector3</link> vector);
<link linkend="void">void</link> <link linkend="gimp-vector3-mul">gimp_vector3_mul</link> (<link linkend="GimpVector3">GimpVector3</link> *vector,
<link linkend="gdouble">gdouble</link> factor);
<link linkend="GimpVector3">GimpVector3</link> <link linkend="gimp-vector3-mul-val">gimp_vector3_mul_val</link> (<link linkend="GimpVector3">GimpVector3</link> vector,
<link linkend="gdouble">gdouble</link> factor);
<link linkend="void">void</link> <link linkend="gimp-vector3-normalize">gimp_vector3_normalize</link> (<link linkend="GimpVector3">GimpVector3</link> *vector);
<link linkend="GimpVector3">GimpVector3</link> <link linkend="gimp-vector3-normalize-val">gimp_vector3_normalize_val</link> (<link linkend="GimpVector3">GimpVector3</link> vector);
<link linkend="void">void</link> <link linkend="gimp-vector3-neg">gimp_vector3_neg</link> (<link linkend="GimpVector3">GimpVector3</link> *vector);
<link linkend="GimpVector3">GimpVector3</link> <link linkend="gimp-vector3-neg-val">gimp_vector3_neg_val</link> (<link linkend="GimpVector3">GimpVector3</link> vector);
<link linkend="void">void</link> <link linkend="gimp-vector3-add">gimp_vector3_add</link> (<link linkend="GimpVector3">GimpVector3</link> *result,
const <link linkend="GimpVector3">GimpVector3</link> *vector1,
const <link linkend="GimpVector3">GimpVector3</link> *vector2);
<link linkend="GimpVector3">GimpVector3</link> <link linkend="gimp-vector3-add-val">gimp_vector3_add_val</link> (<link linkend="GimpVector3">GimpVector3</link> vector1,
<link linkend="GimpVector3">GimpVector3</link> vector2);
<link linkend="void">void</link> <link linkend="gimp-vector3-sub">gimp_vector3_sub</link> (<link linkend="GimpVector3">GimpVector3</link> *result,
const <link linkend="GimpVector3">GimpVector3</link> *vector1,
const <link linkend="GimpVector3">GimpVector3</link> *vector2);
<link linkend="GimpVector3">GimpVector3</link> <link linkend="gimp-vector3-sub-val">gimp_vector3_sub_val</link> (<link linkend="GimpVector3">GimpVector3</link> vector1,
<link linkend="GimpVector3">GimpVector3</link> vector2);
<link linkend="gdouble">gdouble</link> <link linkend="gimp-vector3-inner-product">gimp_vector3_inner_product</link> (const <link linkend="GimpVector3">GimpVector3</link> *vector1,
const <link linkend="GimpVector3">GimpVector3</link> *vector2);
<link linkend="gdouble">gdouble</link> <link linkend="gimp-vector3-inner-product-val">gimp_vector3_inner_product_val</link> (<link linkend="GimpVector3">GimpVector3</link> vector1,
<link linkend="GimpVector3">GimpVector3</link> vector2);
<link linkend="GimpVector3">GimpVector3</link> <link linkend="gimp-vector3-cross-product">gimp_vector3_cross_product</link> (const <link linkend="GimpVector3">GimpVector3</link> *vector1,
const <link linkend="GimpVector3">GimpVector3</link> *vector2);
<link linkend="GimpVector3">GimpVector3</link> <link linkend="gimp-vector3-cross-product-val">gimp_vector3_cross_product_val</link> (<link linkend="GimpVector3">GimpVector3</link> vector1,
<link linkend="GimpVector3">GimpVector3</link> vector2);
<link linkend="void">void</link> <link linkend="gimp-vector3-rotate">gimp_vector3_rotate</link> (<link linkend="GimpVector3">GimpVector3</link> *vector,
<link linkend="gdouble">gdouble</link> alpha,
<link linkend="gdouble">gdouble</link> beta,
<link linkend="gdouble">gdouble</link> gamma);
<link linkend="GimpVector3">GimpVector3</link> <link linkend="gimp-vector3-rotate-val">gimp_vector3_rotate_val</link> (<link linkend="GimpVector3">GimpVector3</link> vector,
<link linkend="gdouble">gdouble</link> alpha,
<link linkend="gdouble">gdouble</link> beta,
<link linkend="gdouble">gdouble</link> gamma);
<link linkend="void">void</link> <link linkend="gimp-vector-2d-to-3d">gimp_vector_2d_to_3d</link> (<link linkend="gint">gint</link> sx,
<link linkend="gint">gint</link> sy,
<link linkend="gint">gint</link> w,
<link linkend="gint">gint</link> h,
<link linkend="gint">gint</link> x,
<link linkend="gint">gint</link> y,
const <link linkend="GimpVector3">GimpVector3</link> *vp,
<link linkend="GimpVector3">GimpVector3</link> *p);
<link linkend="GimpVector3">GimpVector3</link> <link linkend="gimp-vector-2d-to-3d-val">gimp_vector_2d_to_3d_val</link> (<link linkend="gint">gint</link> sx,
<link linkend="gint">gint</link> sy,
<link linkend="gint">gint</link> w,
<link linkend="gint">gint</link> h,
<link linkend="gint">gint</link> x,
<link linkend="gint">gint</link> y,
<link linkend="GimpVector3">GimpVector3</link> vp,
<link linkend="GimpVector3">GimpVector3</link> p);
<link linkend="void">void</link> <link linkend="gimp-vector-3d-to-2d">gimp_vector_3d_to_2d</link> (<link linkend="gint">gint</link> sx,
<link linkend="gint">gint</link> sy,
<link linkend="gint">gint</link> w,
<link linkend="gint">gint</link> h,
<link linkend="gdouble">gdouble</link> *x,
<link linkend="gdouble">gdouble</link> *y,
const <link linkend="GimpVector3">GimpVector3</link> *vp,
const <link linkend="GimpVector3">GimpVector3</link> *p);
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Utilities to set up and manipulate vectors.
</para>
</refsect1>
<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="GimpVector2"/>GimpVector2</title>
<indexterm><primary>GimpVector2</primary></indexterm><programlisting>typedef struct {
gdouble x, y;
} GimpVector2;
</programlisting>
<para>
A two dimensional vector.
</para></refsect2>
<refsect2>
<title><anchor id="GimpVector3"/>GimpVector3</title>
<indexterm><primary>GimpVector3</primary></indexterm><programlisting>typedef struct {
gdouble x, y, z;
} GimpVector3;
</programlisting>
<para>
A three dimensional vector.
</para></refsect2>
<refsect2>
<title><anchor id="GimpVector4"/>GimpVector4</title>
<indexterm><primary>GimpVector4</primary></indexterm><programlisting>typedef struct {
gdouble x, y, z, w;
} GimpVector4;
</programlisting>
<para>
A four dimensional vector.
</para></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-new"/>gimp_vector2_new ()</title>
<indexterm><primary>gimp_vector2_new</primary></indexterm><programlisting><link linkend="GimpVector2">GimpVector2</link> gimp_vector2_new (<link linkend="gdouble">gdouble</link> x,
<link linkend="gdouble">gdouble</link> y);</programlisting>
<para>
Creates a <link linkend="GimpVector2"><type>GimpVector2</type></link> of coordinates <parameter>x</parameter> and <parameter>y</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>x</parameter> :</term>
<listitem><simpara> the X coordinate.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter> :</term>
<listitem><simpara> the Y coordinate.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the resulting <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-set"/>gimp_vector2_set ()</title>
<indexterm><primary>gimp_vector2_set</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector2_set (<link linkend="GimpVector2">GimpVector2</link> *vector,
<link linkend="gdouble">gdouble</link> x,
<link linkend="gdouble">gdouble</link> y);</programlisting>
<para>
Sets the X and Y coordinates of <parameter>vector</parameter> to <parameter>x</parameter> and <parameter>y</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a pointer to a <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x</parameter> :</term>
<listitem><simpara> the X coordinate.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter> :</term>
<listitem><simpara> the Y coordinate.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-length"/>gimp_vector2_length ()</title>
<indexterm><primary>gimp_vector2_length</primary></indexterm><programlisting><link linkend="gdouble">gdouble</link> gimp_vector2_length (const <link linkend="GimpVector2">GimpVector2</link> *vector);</programlisting>
<para>
Computes the length of a 2D vector.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a pointer to a <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the length of <parameter>vector</parameter> (a positive gdouble).
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-length-val"/>gimp_vector2_length_val ()</title>
<indexterm><primary>gimp_vector2_length_val</primary></indexterm><programlisting><link linkend="gdouble">gdouble</link> gimp_vector2_length_val (<link linkend="GimpVector2">GimpVector2</link> vector);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector2-length"><function>gimp_vector2_length()</function></link> but the
vector is passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the length of <parameter>vector</parameter> (a positive gdouble).
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-mul"/>gimp_vector2_mul ()</title>
<indexterm><primary>gimp_vector2_mul</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector2_mul (<link linkend="GimpVector2">GimpVector2</link> *vector,
<link linkend="gdouble">gdouble</link> factor);</programlisting>
<para>
Multiplies each component of the <parameter>vector</parameter> by <parameter>factor</parameter>. Note that this
is equivalent to multiplying the vectors length by <parameter>factor</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a pointer to a <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>factor</parameter> :</term>
<listitem><simpara> a scalar.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-mul-val"/>gimp_vector2_mul_val ()</title>
<indexterm><primary>gimp_vector2_mul_val</primary></indexterm><programlisting><link linkend="GimpVector2">GimpVector2</link> gimp_vector2_mul_val (<link linkend="GimpVector2">GimpVector2</link> vector,
<link linkend="gdouble">gdouble</link> factor);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector2-mul"><function>gimp_vector2_mul()</function></link> but the vector is
passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>factor</parameter> :</term>
<listitem><simpara> a scalar.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the resulting <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-normalize"/>gimp_vector2_normalize ()</title>
<indexterm><primary>gimp_vector2_normalize</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector2_normalize (<link linkend="GimpVector2">GimpVector2</link> *vector);</programlisting>
<para>
Normalizes the <parameter>vector</parameter> so the length of the <parameter>vector</parameter> is 1.0. The nul
vector will not be changed.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a pointer to a <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-normalize-val"/>gimp_vector2_normalize_val ()</title>
<indexterm><primary>gimp_vector2_normalize_val</primary></indexterm><programlisting><link linkend="GimpVector2">GimpVector2</link> gimp_vector2_normalize_val (<link linkend="GimpVector2">GimpVector2</link> vector);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector2-normalize"><function>gimp_vector2_normalize()</function></link> but the
vector is passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a <link linkend="GimpVector2"><type>GimpVector2</type></link> parallel to <parameter>vector</parameter>, pointing in the same
direction but with a length of 1.0.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-neg"/>gimp_vector2_neg ()</title>
<indexterm><primary>gimp_vector2_neg</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector2_neg (<link linkend="GimpVector2">GimpVector2</link> *vector);</programlisting>
<para>
Negates the <parameter>vector</parameter> (i.e. negate all its coordinates).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a pointer to a <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-neg-val"/>gimp_vector2_neg_val ()</title>
<indexterm><primary>gimp_vector2_neg_val</primary></indexterm><programlisting><link linkend="GimpVector2">GimpVector2</link> gimp_vector2_neg_val (<link linkend="GimpVector2">GimpVector2</link> vector);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector2-neg"><function>gimp_vector2_neg()</function></link> but the vector
is passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the negated <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-add"/>gimp_vector2_add ()</title>
<indexterm><primary>gimp_vector2_add</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector2_add (<link linkend="GimpVector2">GimpVector2</link> *result,
const <link linkend="GimpVector2">GimpVector2</link> *vector1,
const <link linkend="GimpVector2">GimpVector2</link> *vector2);</programlisting>
<para>
Computes the sum of two 2D vectors. The resulting <link linkend="GimpVector2"><type>GimpVector2</type></link> is
stored in <parameter>result</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>result</parameter> :</term>
<listitem><simpara> destination for the resulting <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> a pointer to the first <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> a pointer to the second <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-add-val"/>gimp_vector2_add_val ()</title>
<indexterm><primary>gimp_vector2_add_val</primary></indexterm><programlisting><link linkend="GimpVector2">GimpVector2</link> gimp_vector2_add_val (<link linkend="GimpVector2">GimpVector2</link> vector1,
<link linkend="GimpVector2">GimpVector2</link> vector2);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector2-add"><function>gimp_vector2_add()</function></link> but the vectors
are passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> the first <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> the second <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the resulting <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-sub"/>gimp_vector2_sub ()</title>
<indexterm><primary>gimp_vector2_sub</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector2_sub (<link linkend="GimpVector2">GimpVector2</link> *result,
const <link linkend="GimpVector2">GimpVector2</link> *vector1,
const <link linkend="GimpVector2">GimpVector2</link> *vector2);</programlisting>
<para>
Computes the difference of two 2D vectors (<parameter>vector1</parameter> minus <parameter>vector2</parameter>).
The resulting <link linkend="GimpVector2"><type>GimpVector2</type></link> is stored in <parameter>result</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>result</parameter> :</term>
<listitem><simpara> the destination for the resulting <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> a pointer to the first <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> a pointer to the second <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-sub-val"/>gimp_vector2_sub_val ()</title>
<indexterm><primary>gimp_vector2_sub_val</primary></indexterm><programlisting><link linkend="GimpVector2">GimpVector2</link> gimp_vector2_sub_val (<link linkend="GimpVector2">GimpVector2</link> vector1,
<link linkend="GimpVector2">GimpVector2</link> vector2);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector2-sub"><function>gimp_vector2_sub()</function></link> but the vectors
are passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> the first <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> the second <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the resulting <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-inner-product"/>gimp_vector2_inner_product ()</title>
<indexterm><primary>gimp_vector2_inner_product</primary></indexterm><programlisting><link linkend="gdouble">gdouble</link> gimp_vector2_inner_product (const <link linkend="GimpVector2">GimpVector2</link> *vector1,
const <link linkend="GimpVector2">GimpVector2</link> *vector2);</programlisting>
<para>
Computes the inner (dot) product of two 2D vectors.
This product is zero if and only if the two vectors are orthognal.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> a pointer to the first <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> a pointer to the second <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The inner product.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-inner-product-val"/>gimp_vector2_inner_product_val ()</title>
<indexterm><primary>gimp_vector2_inner_product_val</primary></indexterm><programlisting><link linkend="gdouble">gdouble</link> gimp_vector2_inner_product_val (<link linkend="GimpVector2">GimpVector2</link> vector1,
<link linkend="GimpVector2">GimpVector2</link> vector2);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector2-inner-product"><function>gimp_vector2_inner_product()</function></link> but the
vectors are passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> the first <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> the second <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The inner product.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-cross-product"/>gimp_vector2_cross_product ()</title>
<indexterm><primary>gimp_vector2_cross_product</primary></indexterm><programlisting><link linkend="GimpVector2">GimpVector2</link> gimp_vector2_cross_product (const <link linkend="GimpVector2">GimpVector2</link> *vector1,
const <link linkend="GimpVector2">GimpVector2</link> *vector2);</programlisting>
<para>
Compute the cross product of two vectors. The result is a
<link linkend="GimpVector2"><type>GimpVector2</type></link> which is orthognal to both <parameter>vector1</parameter> and <parameter>vector2</parameter>. If
<parameter>vector1</parameter> and <parameter>vector2</parameter> are parallel, the result will be the nul
vector.
</para>
<para>
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.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> a pointer to the first <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> a pointer to the second <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The cross product.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-cross-product-val"/>gimp_vector2_cross_product_val ()</title>
<indexterm><primary>gimp_vector2_cross_product_val</primary></indexterm><programlisting><link linkend="GimpVector2">GimpVector2</link> gimp_vector2_cross_product_val (<link linkend="GimpVector2">GimpVector2</link> vector1,
<link linkend="GimpVector2">GimpVector2</link> vector2);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector2-cross-product"><function>gimp_vector2_cross_product()</function></link> but the
vectors are passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> the first <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> the second <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The cross product.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-rotate"/>gimp_vector2_rotate ()</title>
<indexterm><primary>gimp_vector2_rotate</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector2_rotate (<link linkend="GimpVector2">GimpVector2</link> *vector,
<link linkend="gdouble">gdouble</link> alpha);</programlisting>
<para>
Rotates the <parameter>vector</parameter> counterclockwise by <parameter>alpha</parameter> radians.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a pointer to a <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>alpha</parameter> :</term>
<listitem><simpara> an angle (in radians).
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector2-rotate-val"/>gimp_vector2_rotate_val ()</title>
<indexterm><primary>gimp_vector2_rotate_val</primary></indexterm><programlisting><link linkend="GimpVector2">GimpVector2</link> gimp_vector2_rotate_val (<link linkend="GimpVector2">GimpVector2</link> vector,
<link linkend="gdouble">gdouble</link> alpha);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector2-rotate"><function>gimp_vector2_rotate()</function></link> but the vector
is passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector2"><type>GimpVector2</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>alpha</parameter> :</term>
<listitem><simpara> an angle (in radians).
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a <link linkend="GimpVector2"><type>GimpVector2</type></link> representing <parameter>vector</parameter> rotated by <parameter>alpha</parameter>
radians.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-new"/>gimp_vector3_new ()</title>
<indexterm><primary>gimp_vector3_new</primary></indexterm><programlisting><link linkend="GimpVector3">GimpVector3</link> gimp_vector3_new (<link linkend="gdouble">gdouble</link> x,
<link linkend="gdouble">gdouble</link> y,
<link linkend="gdouble">gdouble</link> z);</programlisting>
<para>
Creates a <link linkend="GimpVector3"><type>GimpVector3</type></link> of coordinate <parameter>x</parameter>, <parameter>y</parameter> and <parameter>z</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>x</parameter> :</term>
<listitem><simpara> the X coordinate.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter> :</term>
<listitem><simpara> the Y coordinate.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>z</parameter> :</term>
<listitem><simpara> the Z coordinate.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the resulting <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-set"/>gimp_vector3_set ()</title>
<indexterm><primary>gimp_vector3_set</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector3_set (<link linkend="GimpVector3">GimpVector3</link> *vector,
<link linkend="gdouble">gdouble</link> x,
<link linkend="gdouble">gdouble</link> y,
<link linkend="gdouble">gdouble</link> z);</programlisting>
<para>
Sets the X, Y and Z coordinates of <parameter>vector</parameter> to <parameter>x</parameter>, <parameter>y</parameter> and <parameter>z</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a pointer to a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x</parameter> :</term>
<listitem><simpara> the X coordinate.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter> :</term>
<listitem><simpara> the Y coordinate.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>z</parameter> :</term>
<listitem><simpara> the Z coordinate.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-length"/>gimp_vector3_length ()</title>
<indexterm><primary>gimp_vector3_length</primary></indexterm><programlisting><link linkend="gdouble">gdouble</link> gimp_vector3_length (const <link linkend="GimpVector3">GimpVector3</link> *vector);</programlisting>
<para>
Computes the length of a 3D vector.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a pointer to a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the length of <parameter>vector</parameter> (a positive gdouble).
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-length-val"/>gimp_vector3_length_val ()</title>
<indexterm><primary>gimp_vector3_length_val</primary></indexterm><programlisting><link linkend="gdouble">gdouble</link> gimp_vector3_length_val (<link linkend="GimpVector3">GimpVector3</link> vector);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector3-length"><function>gimp_vector3_length()</function></link> but the vector
is passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the length of <parameter>vector</parameter> (a positive gdouble).
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-mul"/>gimp_vector3_mul ()</title>
<indexterm><primary>gimp_vector3_mul</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector3_mul (<link linkend="GimpVector3">GimpVector3</link> *vector,
<link linkend="gdouble">gdouble</link> factor);</programlisting>
<para>
Multiplies each component of the <parameter>vector</parameter> by <parameter>factor</parameter>. Note that
this is equivalent to multiplying the vectors length by <parameter>factor</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a pointer to a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>factor</parameter> :</term>
<listitem><simpara> a scalar.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-mul-val"/>gimp_vector3_mul_val ()</title>
<indexterm><primary>gimp_vector3_mul_val</primary></indexterm><programlisting><link linkend="GimpVector3">GimpVector3</link> gimp_vector3_mul_val (<link linkend="GimpVector3">GimpVector3</link> vector,
<link linkend="gdouble">gdouble</link> factor);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector3-mul"><function>gimp_vector3_mul()</function></link> but the vector is
passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>factor</parameter> :</term>
<listitem><simpara> a scalar.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the resulting <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-normalize"/>gimp_vector3_normalize ()</title>
<indexterm><primary>gimp_vector3_normalize</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector3_normalize (<link linkend="GimpVector3">GimpVector3</link> *vector);</programlisting>
<para>
Normalizes the <parameter>vector</parameter> so the length of the <parameter>vector</parameter> is 1.0. The nul
vector will not be changed.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a pointer to a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-normalize-val"/>gimp_vector3_normalize_val ()</title>
<indexterm><primary>gimp_vector3_normalize_val</primary></indexterm><programlisting><link linkend="GimpVector3">GimpVector3</link> gimp_vector3_normalize_val (<link linkend="GimpVector3">GimpVector3</link> vector);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector3-normalize"><function>gimp_vector3_normalize()</function></link> but the
vector is passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a <link linkend="GimpVector3"><type>GimpVector3</type></link> parallel to <parameter>vector</parameter>, pointing in the same
direction but with a length of 1.0.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-neg"/>gimp_vector3_neg ()</title>
<indexterm><primary>gimp_vector3_neg</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector3_neg (<link linkend="GimpVector3">GimpVector3</link> *vector);</programlisting>
<para>
Negates the <parameter>vector</parameter> (i.e. negate all its coordinates).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a pointer to a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-neg-val"/>gimp_vector3_neg_val ()</title>
<indexterm><primary>gimp_vector3_neg_val</primary></indexterm><programlisting><link linkend="GimpVector3">GimpVector3</link> gimp_vector3_neg_val (<link linkend="GimpVector3">GimpVector3</link> vector);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector3-neg"><function>gimp_vector3_neg()</function></link> but the vector
is passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the negated <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-add"/>gimp_vector3_add ()</title>
<indexterm><primary>gimp_vector3_add</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector3_add (<link linkend="GimpVector3">GimpVector3</link> *result,
const <link linkend="GimpVector3">GimpVector3</link> *vector1,
const <link linkend="GimpVector3">GimpVector3</link> *vector2);</programlisting>
<para>
Computes the sum of two 3D vectors. The resulting <link linkend="GimpVector3"><type>GimpVector3</type></link> is
stored in <parameter>result</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>result</parameter> :</term>
<listitem><simpara> destination for the resulting <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> a pointer to the first <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> a pointer to the second <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-add-val"/>gimp_vector3_add_val ()</title>
<indexterm><primary>gimp_vector3_add_val</primary></indexterm><programlisting><link linkend="GimpVector3">GimpVector3</link> gimp_vector3_add_val (<link linkend="GimpVector3">GimpVector3</link> vector1,
<link linkend="GimpVector3">GimpVector3</link> vector2);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector3-add"><function>gimp_vector3_add()</function></link> but the vectors
are passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the resulting <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-sub"/>gimp_vector3_sub ()</title>
<indexterm><primary>gimp_vector3_sub</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector3_sub (<link linkend="GimpVector3">GimpVector3</link> *result,
const <link linkend="GimpVector3">GimpVector3</link> *vector1,
const <link linkend="GimpVector3">GimpVector3</link> *vector2);</programlisting>
<para>
Computes the difference of two 3D vectors (<parameter>vector1</parameter> minus <parameter>vector2</parameter>).
The resulting <link linkend="GimpVector3"><type>GimpVector3</type></link> is stored in <parameter>result</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>result</parameter> :</term>
<listitem><simpara> the destination for the resulting <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> a pointer to the first <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> a pointer to the second <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-sub-val"/>gimp_vector3_sub_val ()</title>
<indexterm><primary>gimp_vector3_sub_val</primary></indexterm><programlisting><link linkend="GimpVector3">GimpVector3</link> gimp_vector3_sub_val (<link linkend="GimpVector3">GimpVector3</link> vector1,
<link linkend="GimpVector3">GimpVector3</link> vector2);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector3-sub"><function>gimp_vector3_sub()</function></link> but the vectors
are passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the resulting <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-inner-product"/>gimp_vector3_inner_product ()</title>
<indexterm><primary>gimp_vector3_inner_product</primary></indexterm><programlisting><link linkend="gdouble">gdouble</link> gimp_vector3_inner_product (const <link linkend="GimpVector3">GimpVector3</link> *vector1,
const <link linkend="GimpVector3">GimpVector3</link> *vector2);</programlisting>
<para>
Computes the inner (dot) product of two 3D vectors. This product
is zero if and only if the two vectors are orthognal.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> a pointer to the first <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> a pointer to the second <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The inner product.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-inner-product-val"/>gimp_vector3_inner_product_val ()</title>
<indexterm><primary>gimp_vector3_inner_product_val</primary></indexterm><programlisting><link linkend="gdouble">gdouble</link> gimp_vector3_inner_product_val (<link linkend="GimpVector3">GimpVector3</link> vector1,
<link linkend="GimpVector3">GimpVector3</link> vector2);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector3-inner-product"><function>gimp_vector3_inner_product()</function></link> but the
vectors are passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> the first <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> the second <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The inner product.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-cross-product"/>gimp_vector3_cross_product ()</title>
<indexterm><primary>gimp_vector3_cross_product</primary></indexterm><programlisting><link linkend="GimpVector3">GimpVector3</link> gimp_vector3_cross_product (const <link linkend="GimpVector3">GimpVector3</link> *vector1,
const <link linkend="GimpVector3">GimpVector3</link> *vector2);</programlisting>
<para>
Compute the cross product of two vectors. The result is a
<link linkend="GimpVector3"><type>GimpVector3</type></link> which is orthognal to both <parameter>vector1</parameter> and <parameter>vector2</parameter>. If
<parameter>vector1</parameter> and <parameter>vector2</parameter> and parallel, the result will be the nul
vector.
</para>
<para>
This function can be used to compute the normal of the plane
defined by <parameter>vector1</parameter> and <parameter>vector2</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> a pointer to the first <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> a pointer to the second <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The cross product.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-cross-product-val"/>gimp_vector3_cross_product_val ()</title>
<indexterm><primary>gimp_vector3_cross_product_val</primary></indexterm><programlisting><link linkend="GimpVector3">GimpVector3</link> gimp_vector3_cross_product_val (<link linkend="GimpVector3">GimpVector3</link> vector1,
<link linkend="GimpVector3">GimpVector3</link> vector2);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector3-cross-product"><function>gimp_vector3_cross_product()</function></link> but the
vectors are passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector1</parameter> :</term>
<listitem><simpara> the first <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vector2</parameter> :</term>
<listitem><simpara> the second <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The cross product.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-rotate"/>gimp_vector3_rotate ()</title>
<indexterm><primary>gimp_vector3_rotate</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector3_rotate (<link linkend="GimpVector3">GimpVector3</link> *vector,
<link linkend="gdouble">gdouble</link> alpha,
<link linkend="gdouble">gdouble</link> beta,
<link linkend="gdouble">gdouble</link> gamma);</programlisting>
<para>
Rotates the <parameter>vector</parameter> around the three axis (Z, Y, and X) by <parameter>alpha</parameter>,
<parameter>beta</parameter> and <parameter>gamma</parameter>, respectively.
</para>
<para>
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 <parameter>alpha</parameter>, <parameter>beta</parameter> and <parameter>gamma</parameter> non-zero.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a pointer to a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>alpha</parameter> :</term>
<listitem><simpara> the angle (in radian) of rotation around the Z axis.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>beta</parameter> :</term>
<listitem><simpara> the angle (in radian) of rotation around the Y axis.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>gamma</parameter> :</term>
<listitem><simpara> the angle (in radian) of rotation around the X axis.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector3-rotate-val"/>gimp_vector3_rotate_val ()</title>
<indexterm><primary>gimp_vector3_rotate_val</primary></indexterm><programlisting><link linkend="GimpVector3">GimpVector3</link> gimp_vector3_rotate_val (<link linkend="GimpVector3">GimpVector3</link> vector,
<link linkend="gdouble">gdouble</link> alpha,
<link linkend="gdouble">gdouble</link> beta,
<link linkend="gdouble">gdouble</link> gamma);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector3-rotate"><function>gimp_vector3_rotate()</function></link> but the vectors
are passed by value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vector</parameter> :</term>
<listitem><simpara> a <link linkend="GimpVector3"><type>GimpVector3</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>alpha</parameter> :</term>
<listitem><simpara> the angle (in radian) of rotation around the Z axis.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>beta</parameter> :</term>
<listitem><simpara> the angle (in radian) of rotation around the Y axis.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>gamma</parameter> :</term>
<listitem><simpara> the angle (in radian) of rotation around the X axis.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the rotated vector.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector-2d-to-3d"/>gimp_vector_2d_to_3d ()</title>
<indexterm><primary>gimp_vector_2d_to_3d</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector_2d_to_3d (<link linkend="gint">gint</link> sx,
<link linkend="gint">gint</link> sy,
<link linkend="gint">gint</link> w,
<link linkend="gint">gint</link> h,
<link linkend="gint">gint</link> x,
<link linkend="gint">gint</link> y,
const <link linkend="GimpVector3">GimpVector3</link> *vp,
<link linkend="GimpVector3">GimpVector3</link> *p);</programlisting>
<para>
\"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->z != 0.0).\"
</para>
<para>
In other words, this computes the projection of the point (<parameter>x</parameter>, <parameter>y</parameter>)
to the plane z = <parameter>p->z</parameter> (parallel to XY), from the <parameter>vp</parameter> point of view
through the screen (<parameter>sx</parameter>, <parameter>sy</parameter>)->(<parameter>sx</parameter> + <parameter>w</parameter>, <parameter>sy</parameter> + <parameter>h</parameter>)</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>sx</parameter> :</term>
<listitem><simpara> the abscisse of the upper-left screen rectangle.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>sy</parameter> :</term>
<listitem><simpara> the ordinate of the upper-left screen rectangle.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>w</parameter> :</term>
<listitem><simpara> the width of the screen rectangle.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>h</parameter> :</term>
<listitem><simpara> the height of the screen rectangle.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x</parameter> :</term>
<listitem><simpara> the abscisse of the point in the screen rectangle to map.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter> :</term>
<listitem><simpara> the ordinate of the point in the screen rectangle to map.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vp</parameter> :</term>
<listitem><simpara> the position of the observer.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>p</parameter> :</term>
<listitem><simpara> the resulting point.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector-2d-to-3d-val"/>gimp_vector_2d_to_3d_val ()</title>
<indexterm><primary>gimp_vector_2d_to_3d_val</primary></indexterm><programlisting><link linkend="GimpVector3">GimpVector3</link> gimp_vector_2d_to_3d_val (<link linkend="gint">gint</link> sx,
<link linkend="gint">gint</link> sy,
<link linkend="gint">gint</link> w,
<link linkend="gint">gint</link> h,
<link linkend="gint">gint</link> x,
<link linkend="gint">gint</link> y,
<link linkend="GimpVector3">GimpVector3</link> vp,
<link linkend="GimpVector3">GimpVector3</link> p);</programlisting>
<para>
This function is identical to <link linkend="gimp-vector-2d-to-3d"><function>gimp_vector_2d_to_3d()</function></link> but the
position of the <parameter>observer</parameter> and the resulting point <parameter>p</parameter> are passed by
value rather than by reference.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>sx</parameter> :</term>
<listitem><simpara> the abscisse of the upper-left screen rectangle.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>sy</parameter> :</term>
<listitem><simpara> the ordinate of the upper-left screen rectangle.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>w</parameter> :</term>
<listitem><simpara> the width of the screen rectangle.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>h</parameter> :</term>
<listitem><simpara> the height of the screen rectangle.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x</parameter> :</term>
<listitem><simpara> the abscisse of the point in the screen rectangle to map.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter> :</term>
<listitem><simpara> the ordinate of the point in the screen rectangle to map.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vp</parameter> :</term>
<listitem><simpara> position of the observer.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>p</parameter> :</term>
<listitem><simpara> the resulting point.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the computed <link linkend="GimpVector3"><type>GimpVector3</type></link> point.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-vector-3d-to-2d"/>gimp_vector_3d_to_2d ()</title>
<indexterm><primary>gimp_vector_3d_to_2d</primary></indexterm><programlisting><link linkend="void">void</link> gimp_vector_3d_to_2d (<link linkend="gint">gint</link> sx,
<link linkend="gint">gint</link> sy,
<link linkend="gint">gint</link> w,
<link linkend="gint">gint</link> h,
<link linkend="gdouble">gdouble</link> *x,
<link linkend="gdouble">gdouble</link> *y,
const <link linkend="GimpVector3">GimpVector3</link> *vp,
const <link linkend="GimpVector3">GimpVector3</link> *p);</programlisting>
<para>
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.
</para>
<para>
This is basically the opposite of <link linkend="gimp-vector-2d-to-3d"><function>gimp_vector_2d_to_3d()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>sx</parameter> :</term>
<listitem><simpara> the abscisse of the upper-left screen rectangle.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>sy</parameter> :</term>
<listitem><simpara> the ordinate of the upper-left screen rectangle.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>w</parameter> :</term>
<listitem><simpara> the width of the screen rectangle.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>h</parameter> :</term>
<listitem><simpara> the height of the screen rectangle.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x</parameter> :</term>
<listitem><simpara> the abscisse of the point in the screen rectangle to map (return value).
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter> :</term>
<listitem><simpara> the ordinate of the point in the screen rectangle to map (return value).
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>vp</parameter> :</term>
<listitem><simpara> position of the observer.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>p</parameter> :</term>
<listitem><simpara> the 3D point to project to the plane.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<link linkend="GimpMatrix3"><type>GimpMatrix3</type></link>
</para>
<para>
<link linkend="GimpMatrix4"><type>GimpMatrix4</type></link>
</para>
</refsect1>
</refentry>
|