1077 lines
72 KiB
XML
1077 lines
72 KiB
XML
<?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 role="top_of_page">GimpVector</refentrytitle>
|
|
<manvolnum>3</manvolnum>
|
|
<refmiscinfo>LIBGIMPMATH Library</refmiscinfo>
|
|
</refmeta>
|
|
|
|
<refnamediv>
|
|
<refname>GimpVector</refname>
|
|
<refpurpose>Utilities to set up and manipulate vectors.</refpurpose>
|
|
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv role="synopsis">
|
|
<title role="synopsis.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 role="desc">
|
|
<title role="desc.title">Description</title>
|
|
<para>
|
|
Utilities to set up and manipulate vectors.
|
|
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="details">
|
|
<title role="details.title">Details</title>
|
|
<refsect2>
|
|
<title><anchor id="GimpVector2" role="struct"/>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" role="struct"/>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" role="struct"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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" role="function"/>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>
|