/usr/share/gtk-doc/html/cogl/cogl-Vectors.html is in libcogl-doc 1.22.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Vectors: Cogl Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="Cogl Reference Manual">
<link rel="up" href="ch02.html" title="Cogl experimental API">
<link rel="prev" href="cogl-Buffers.html" title="Buffers">
<link rel="next" href="cogl-3D-textures.html" title="3D textures">
<meta name="generator" content="GTK-Doc V1.24 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
<a href="#cogl-Vectors.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="cogl-Buffers.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="cogl-3D-textures.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="cogl-Vectors"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="cogl-Vectors.top_of_page"></a>Vectors</span></h2>
<p>Vectors — Functions for handling single precision float
vectors.</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="cogl-Vectors.functions"></a><h2>Functions</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-init" title="cogl_vector3_init ()">cogl_vector3_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-init-zero" title="cogl_vector3_init_zero ()">cogl_vector3_init_zero</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">CoglBool</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-equal" title="cogl_vector3_equal ()">cogl_vector3_equal</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">CoglBool</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-equal-with-epsilon" title="cogl_vector3_equal_with_epsilon ()">cogl_vector3_equal_with_epsilon</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">float</span> *
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-copy" title="cogl_vector3_copy ()">cogl_vector3_copy</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-free" title="cogl_vector3_free ()">cogl_vector3_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-invert" title="cogl_vector3_invert ()">cogl_vector3_invert</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-add" title="cogl_vector3_add ()">cogl_vector3_add</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-subtract" title="cogl_vector3_subtract ()">cogl_vector3_subtract</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-multiply-scalar" title="cogl_vector3_multiply_scalar ()">cogl_vector3_multiply_scalar</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-divide-scalar" title="cogl_vector3_divide_scalar ()">cogl_vector3_divide_scalar</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-normalize" title="cogl_vector3_normalize ()">cogl_vector3_normalize</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">float</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-magnitude" title="cogl_vector3_magnitude ()">cogl_vector3_magnitude</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-cross-product" title="cogl_vector3_cross_product ()">cogl_vector3_cross_product</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">float</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-dot-product" title="cogl_vector3_dot_product ()">cogl_vector3_dot_product</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">float</span>
</td>
<td class="function_name">
<a class="link" href="cogl-Vectors.html#cogl-vector3-distance" title="cogl_vector3_distance ()">cogl_vector3_distance</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="cogl-Vectors.description"></a><h2>Description</h2>
<p>This exposes a utility API that can be used for basic manipulation of 3
component float vectors.</p>
</div>
<div class="refsect1">
<a name="cogl-Vectors.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="cogl-vector3-init"></a><h3>cogl_vector3_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
cogl_vector3_init (<em class="parameter"><code><span class="type">float</span> *vector</code></em>,
<em class="parameter"><code><span class="type">float</span> x</code></em>,
<em class="parameter"><code><span class="type">float</span> y</code></em>,
<em class="parameter"><code><span class="type">float</span> z</code></em>);</pre>
<p>Initializes a 3 component, single precision float vector which can
then be manipulated with the cogl_vector convenience APIs. Vectors
can also be used in places where a "point" is often desired.</p>
<div class="refsect3">
<a name="id-1.3.4.5.2.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>vector</p></td>
<td class="parameter_description"><p>The 3 component vector you want to initialize</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>x</p></td>
<td class="parameter_description"><p>The x component</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>y</p></td>
<td class="parameter_description"><p>The y component</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>z</p></td>
<td class="parameter_description"><p>The z component</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-init-zero"></a><h3>cogl_vector3_init_zero ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
cogl_vector3_init_zero (<em class="parameter"><code><span class="type">float</span> *vector</code></em>);</pre>
<p>Initializes a 3 component, single precision float vector with zero
for each component.</p>
<div class="refsect3">
<a name="id-1.3.4.5.3.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>vector</p></td>
<td class="parameter_description"><p>The 3 component vector you want to initialize</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-equal"></a><h3>cogl_vector3_equal ()</h3>
<pre class="programlisting"><span class="returnvalue">CoglBool</span>
cogl_vector3_equal (<em class="parameter"><code>const <span class="type">void</span> *v1</code></em>,
<em class="parameter"><code>const <span class="type">void</span> *v2</code></em>);</pre>
<p>Compares the components of two vectors and returns TRUE if they are
the same.</p>
<p>The comparison of the components is done with the '==' operator
such that -0 is considered equal to 0, but otherwise there is no
fuzziness such as an epsilon to consider vectors that are
essentially identical except for some minor precision error
differences due to the way they have been manipulated.</p>
<div class="refsect3">
<a name="id-1.3.4.5.4.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>v1</p></td>
<td class="parameter_description"><p>The first 3 component vector you want to compare</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>v2</p></td>
<td class="parameter_description"><p>The second 3 component vector you want to compare</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.4.5.4.7"></a><h4>Returns</h4>
<p> TRUE if the vectors are equal else FALSE.</p>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-equal-with-epsilon"></a><h3>cogl_vector3_equal_with_epsilon ()</h3>
<pre class="programlisting"><span class="returnvalue">CoglBool</span>
cogl_vector3_equal_with_epsilon (<em class="parameter"><code>const <span class="type">float</span> *vector0</code></em>,
<em class="parameter"><code>const <span class="type">float</span> *vector1</code></em>,
<em class="parameter"><code><span class="type">float</span> epsilon</code></em>);</pre>
<p>Compares the components of two vectors using the given epsilon and
returns TRUE if they are the same, using an internal epsilon for
comparing the floats.</p>
<p>Each component is compared against the epsilon value in this way:</p>
<div class="informalexample"><pre class="programlisting">
if (fabsf (vector0->x - vector1->x) < epsilon)
</pre></div>
<p></p>
<div class="refsect3">
<a name="id-1.3.4.5.5.8"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>vector0</p></td>
<td class="parameter_description"><p>The first 3 component vector you want to compare</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>vector1</p></td>
<td class="parameter_description"><p>The second 3 component vector you want to compare</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>epsilon</p></td>
<td class="parameter_description"><p>The allowable difference between components to still be
considered equal</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.4.5.5.9"></a><h4>Returns</h4>
<p> TRUE if the vectors are equal else FALSE.</p>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-copy"></a><h3>cogl_vector3_copy ()</h3>
<pre class="programlisting"><span class="returnvalue">float</span> *
cogl_vector3_copy (<em class="parameter"><code>const <span class="type">float</span> *vector</code></em>);</pre>
<p>Allocates a new 3 component float vector on the heap initializing
the components from the given <em class="parameter"><code>vector</code></em>
and returns a pointer to the
newly allocated vector. You should free the memory using
<a class="link" href="cogl-Vectors.html#cogl-vector3-free" title="cogl_vector3_free ()"><code class="function">cogl_vector3_free()</code></a></p>
<div class="refsect3">
<a name="id-1.3.4.5.6.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>vector</p></td>
<td class="parameter_description"><p>The 3 component vector you want to copy</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.4.5.6.6"></a><h4>Returns</h4>
<p> A newly allocated 3 component float vector</p>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-free"></a><h3>cogl_vector3_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
cogl_vector3_free (<em class="parameter"><code><span class="type">float</span> *vector</code></em>);</pre>
<p>Frees a 3 component vector that was previously allocated with
<a class="link" href="cogl-Vectors.html#cogl-vector3-copy" title="cogl_vector3_copy ()"><code class="function">cogl_vector3_copy()</code></a></p>
<div class="refsect3">
<a name="id-1.3.4.5.7.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>vector</p></td>
<td class="parameter_description"><p>The 3 component you want to free</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-invert"></a><h3>cogl_vector3_invert ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
cogl_vector3_invert (<em class="parameter"><code><span class="type">float</span> *vector</code></em>);</pre>
<p>Inverts/negates all the components of the given <em class="parameter"><code>vector</code></em>
.</p>
<div class="refsect3">
<a name="id-1.3.4.5.8.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>vector</p></td>
<td class="parameter_description"><p>The 3 component vector you want to manipulate</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-add"></a><h3>cogl_vector3_add ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
cogl_vector3_add (<em class="parameter"><code><span class="type">float</span> *result</code></em>,
<em class="parameter"><code>const <span class="type">float</span> *a</code></em>,
<em class="parameter"><code>const <span class="type">float</span> *b</code></em>);</pre>
<p>Adds each of the corresponding components in vectors <em class="parameter"><code>a</code></em>
and <em class="parameter"><code>b</code></em>
storing the results in <em class="parameter"><code>result</code></em>
.</p>
<div class="refsect3">
<a name="id-1.3.4.5.9.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>result</p></td>
<td class="parameter_description"><p>Where you want the result written</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>a</p></td>
<td class="parameter_description"><p>The first vector operand</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>b</p></td>
<td class="parameter_description"><p>The second vector operand</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-subtract"></a><h3>cogl_vector3_subtract ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
cogl_vector3_subtract (<em class="parameter"><code><span class="type">float</span> *result</code></em>,
<em class="parameter"><code>const <span class="type">float</span> *a</code></em>,
<em class="parameter"><code>const <span class="type">float</span> *b</code></em>);</pre>
<p>Subtracts each of the corresponding components in vector <em class="parameter"><code>b</code></em>
from
<em class="parameter"><code>a</code></em>
storing the results in <em class="parameter"><code>result</code></em>
.</p>
<div class="refsect3">
<a name="id-1.3.4.5.10.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>result</p></td>
<td class="parameter_description"><p>Where you want the result written</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>a</p></td>
<td class="parameter_description"><p>The first vector operand</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>b</p></td>
<td class="parameter_description"><p>The second vector operand</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-multiply-scalar"></a><h3>cogl_vector3_multiply_scalar ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
cogl_vector3_multiply_scalar (<em class="parameter"><code><span class="type">float</span> *vector</code></em>,
<em class="parameter"><code><span class="type">float</span> scalar</code></em>);</pre>
<p>Multiplies each of the <em class="parameter"><code>vector</code></em>
components by the given scalar.</p>
<div class="refsect3">
<a name="id-1.3.4.5.11.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>vector</p></td>
<td class="parameter_description"><p>The 3 component vector you want to manipulate</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>scalar</p></td>
<td class="parameter_description"><p>The scalar you want to multiply the vector components by</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-divide-scalar"></a><h3>cogl_vector3_divide_scalar ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
cogl_vector3_divide_scalar (<em class="parameter"><code><span class="type">float</span> *vector</code></em>,
<em class="parameter"><code><span class="type">float</span> scalar</code></em>);</pre>
<p>Divides each of the <em class="parameter"><code>vector</code></em>
components by the given scalar.</p>
<div class="refsect3">
<a name="id-1.3.4.5.12.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>vector</p></td>
<td class="parameter_description"><p>The 3 component vector you want to manipulate</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>scalar</p></td>
<td class="parameter_description"><p>The scalar you want to divide the vector components by</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-normalize"></a><h3>cogl_vector3_normalize ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
cogl_vector3_normalize (<em class="parameter"><code><span class="type">float</span> *vector</code></em>);</pre>
<p>Updates the vector so it is a "unit vector" such that the
<em class="parameter"><code>vector</code></em>
s magnitude or length is equal to 1.</p>
<div class="note">It's safe to use this function with the [0, 0, 0] vector, it will not
try to divide components by 0 (its norm) and will leave the vector
untouched.</div>
<div class="refsect3">
<a name="id-1.3.4.5.13.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>vector</p></td>
<td class="parameter_description"><p>The 3 component vector you want to manipulate</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-magnitude"></a><h3>cogl_vector3_magnitude ()</h3>
<pre class="programlisting"><span class="returnvalue">float</span>
cogl_vector3_magnitude (<em class="parameter"><code>const <span class="type">float</span> *vector</code></em>);</pre>
<p>Calculates the scalar magnitude or length of <em class="parameter"><code>vector</code></em>
.</p>
<div class="refsect3">
<a name="id-1.3.4.5.14.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>vector</p></td>
<td class="parameter_description"><p>The 3 component vector you want the magnitude for</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.4.5.14.6"></a><h4>Returns</h4>
<p> The magnitude of <em class="parameter"><code>vector</code></em>
.</p>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-cross-product"></a><h3>cogl_vector3_cross_product ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
cogl_vector3_cross_product (<em class="parameter"><code><span class="type">float</span> *result</code></em>,
<em class="parameter"><code>const <span class="type">float</span> *u</code></em>,
<em class="parameter"><code>const <span class="type">float</span> *v</code></em>);</pre>
<p>Calculates the cross product between the two vectors <em class="parameter"><code>u</code></em>
and <em class="parameter"><code>v</code></em>
.</p>
<p>The cross product is a vector perpendicular to both <em class="parameter"><code>u</code></em>
and <em class="parameter"><code>v</code></em>
. This
can be useful for calculating the normal of a polygon by creating
two vectors in its plane using the polygons vertices and taking
their cross product.</p>
<p>If the two vectors are parallel then the cross product is 0.</p>
<p>You can use a right hand rule to determine which direction the
perpendicular vector will point: If you place the two vectors tail,
to tail and imagine grabbing the perpendicular line that extends
through the common tail with your right hand such that you fingers
rotate in the direction from <em class="parameter"><code>u</code></em>
to <em class="parameter"><code>v</code></em>
then the resulting vector
points along your extended thumb.</p>
<div class="refsect3">
<a name="id-1.3.4.5.15.8"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>result</p></td>
<td class="parameter_description"><p>Where you want the result written</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>u</p></td>
<td class="parameter_description"><p>Your first 3 component vector</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>v</p></td>
<td class="parameter_description"><p>Your second 3 component vector</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.4.5.15.9"></a><h4>Returns</h4>
<p> The cross product between two vectors <em class="parameter"><code>u</code></em>
and <em class="parameter"><code>v</code></em>
.</p>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-dot-product"></a><h3>cogl_vector3_dot_product ()</h3>
<pre class="programlisting"><span class="returnvalue">float</span>
cogl_vector3_dot_product (<em class="parameter"><code>const <span class="type">float</span> *a</code></em>,
<em class="parameter"><code>const <span class="type">float</span> *b</code></em>);</pre>
<p>Calculates the dot product of the two 3 component vectors. This
can be used to determine the magnitude of one vector projected onto
another. (for example a surface normal)</p>
<p>For example if you have a polygon with a given normal vector and
some other point for which you want to calculate its distance from
the polygon, you can create a vector between one of the polygon
vertices and that point and use the dot product to calculate the
magnitude for that vector but projected onto the normal of the
polygon. This way you don't just get the distance from the point to
the edge of the polygon you get the distance from the point to the
nearest part of the polygon.</p>
<div class="note">If you don't use a unit length normal in the above example
then you would then also have to divide the result by the magnitude
of the normal</div>
<p>The dot product is calculated as:</p>
<div class="informalexample"><pre class="programlisting">
(a->x * b->x + a->y * b->y + a->z * b->z)
</pre></div>
<p></p>
<p>For reference, the dot product can also be calculated from the
angle between two vectors as:</p>
<div class="informalexample"><pre class="programlisting">
|a||b|cos𝜃
</pre></div>
<p></p>
<div class="refsect3">
<a name="id-1.3.4.5.16.13"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>a</p></td>
<td class="parameter_description"><p>Your first 3 component vector</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>b</p></td>
<td class="parameter_description"><p>Your second 3 component vector</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.4.5.16.14"></a><h4>Returns</h4>
<p> The dot product of two vectors.</p>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
<hr>
<div class="refsect2">
<a name="cogl-vector3-distance"></a><h3>cogl_vector3_distance ()</h3>
<pre class="programlisting"><span class="returnvalue">float</span>
cogl_vector3_distance (<em class="parameter"><code>const <span class="type">float</span> *a</code></em>,
<em class="parameter"><code>const <span class="type">float</span> *b</code></em>);</pre>
<p>If you consider the two given vectors as (x,y,z) points instead
then this will compute the distance between those two points.</p>
<div class="refsect3">
<a name="id-1.3.4.5.17.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>a</p></td>
<td class="parameter_description"><p>The first point</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>b</p></td>
<td class="parameter_description"><p>The second point</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.4.5.17.6"></a><h4>Returns</h4>
<p> The distance between two points given as 3 component
vectors.</p>
</div>
<p class="since">Since: <a class="link" href="ix06.html#api-index-1.4">1.4</a></p>
<p class="stability">Stability Level: <acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym></p>
</div>
</div>
<div class="refsect1">
<a name="cogl-Vectors.other_details"></a><h2>Types and Values</h2>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.24</div>
</body>
</html>
|