diff options
Diffstat (limited to 'manuals/chickadee/Vectors.html')
-rw-r--r-- | manuals/chickadee/Vectors.html | 90 |
1 files changed, 52 insertions, 38 deletions
diff --git a/manuals/chickadee/Vectors.html b/manuals/chickadee/Vectors.html index 4857f0a..20632cd 100644 --- a/manuals/chickadee/Vectors.html +++ b/manuals/chickadee/Vectors.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> -<!-- Copyright (C) 2017 David Thompson davet@gnu.org +<!-- Copyright (C) 2017, 2018, 2019 David Thompson davet@gnu.org Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 @@ -13,6 +13,8 @@ A copy of the license is also available from the Free Software Foundation Web site at http://www.gnu.org/licenses/fdl.html. +* Chickadee: (chickadee). Game programming toolkit for Guile. + The document was typeset with http://www.texinfo.org/ (GNU Texinfo). --> @@ -133,99 +135,105 @@ functions, they do not compose well and create more verbose code. <h4 class="subsubsection">2.2.2.2 2D Vectors</h4> <dl> -<dt><a name="index-vec2"></a>Procedure: <strong>vec2</strong> <em><var>x</var> <var>y</var></em></dt> +<dt><a name="index-vec2"></a>Procedure: <strong>vec2</strong> <em>x y</em></dt> <dd><p>Return a new 2D vector with coordinates (<var>x</var>, <var>y</var>). </p></dd></dl> <dl> -<dt><a name="index-vec2_002fpolar"></a>Procedure: <strong>vec2/polar</strong> <em><var>r</var> <var>theta</var></em></dt> +<dt><a name="index-vec2_002fpolar"></a>Procedure: <strong>vec2/polar</strong> <em>r theta</em></dt> <dd><p>Return a new 2D vector containing the Cartesian representation of the polar coordinate (<var>r</var>, <var>theta</var>). The angle <var>theta</var> is measured in radians. </p></dd></dl> <dl> -<dt><a name="index-vec2_003f"></a>Procedure: <strong>vec2?</strong> <em><var>obj</var></em></dt> +<dt><a name="index-vec2_003f"></a>Procedure: <strong>vec2?</strong> <em>obj</em></dt> <dd><p>Return <code>#t</code> if <var>obj</var> is a 2D vector. </p></dd></dl> <dl> -<dt><a name="index-vec2_002dx"></a>Procedure: <strong>vec2-x</strong> <em><var>v</var></em></dt> +<dt><a name="index-vec2_002dx"></a>Procedure: <strong>vec2-x</strong> <em>v</em></dt> <dd><p>Return the X coordinate of the 2D vector <var>v</var>. </p></dd></dl> <dl> -<dt><a name="index-vec2_002dy"></a>Procedure: <strong>vec2-y</strong> <em><var>v</var></em></dt> +<dt><a name="index-vec2_002dy"></a>Procedure: <strong>vec2-y</strong> <em>v</em></dt> <dd><p>Return the Y coordinate of the 2D vector <var>v</var>. </p></dd></dl> <dl> -<dt><a name="index-vec2_002dcopy"></a>Procedure: <strong>vec2-copy</strong> <em><var>v</var></em></dt> +<dt><a name="index-vec2_002dcopy"></a>Procedure: <strong>vec2-copy</strong> <em>v</em></dt> <dd><p>Return a fresh copy of the 2D vector <var>v</var>. </p></dd></dl> <dl> -<dt><a name="index-vec2_002dmagnitude"></a>Procedure: <strong>vec2-magnitude</strong> <em><var>v</var></em></dt> +<dt><a name="index-vec2_002dmagnitude"></a>Procedure: <strong>vec2-magnitude</strong> <em>v</em></dt> <dd><p>Return the magnitude of the 2D vector <var>v</var>. </p></dd></dl> <dl> -<dt><a name="index-vec2_002ddot_002dproduct"></a>Procedure: <strong>vec2-dot-product</strong> <em><var>v1</var> <var>v2</var></em></dt> +<dt><a name="index-vec2_002ddot_002dproduct"></a>Procedure: <strong>vec2-dot-product</strong> <em>v1 v2</em></dt> <dd><p>Return the dot product of the 2D vectors <var>v1</var> and <var>v2</var>. </p></dd></dl> <dl> -<dt><a name="index-vec2_002dnormalize"></a>Procedure: <strong>vec2-normalize</strong> <em><var>v</var></em></dt> +<dt><a name="index-vec2_002dnormalize"></a>Procedure: <strong>vec2-normalize</strong> <em>v</em></dt> <dd><p>Return the normalized form of the 2D vector <var>v</var>. </p></dd></dl> <dl> -<dt><a name="index-vec2_002b"></a>Procedure: <strong>vec2+</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-vec2_002b"></a>Procedure: <strong>vec2+</strong> <em>v x</em></dt> <dd><p>Add <var>x</var>, either a 2D vector or a scalar (i.e. a real number), to the 2D vector <var>v</var> and return a new vector containing the sum. </p></dd></dl> <dl> -<dt><a name="index-vec2_002d"></a>Procedure: <strong>vec2-</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-vec2_002d"></a>Procedure: <strong>vec2-</strong> <em>v x</em></dt> <dd><p>Subtract <var>x</var>, either a 2D vector or a scalar, from the 2D vector <var>v</var> and return a new vector containing the difference. </p></dd></dl> <dl> -<dt><a name="index-vec2_002a"></a>Procedure: <strong>vec2*</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-vec2_002a"></a>Procedure: <strong>vec2*</strong> <em>v x</em></dt> <dd><p>Multiply the 2D vector <var>v</var> by <var>x</var>, a 2D vector or a scalar, and return a new vector containing the product. </p></dd></dl> <dl> -<dt><a name="index-set_002dvec2_002dx_0021"></a>Procedure: <strong>set-vec2-x!</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-set_002dvec2_002dx_0021"></a>Procedure: <strong>set-vec2-x!</strong> <em>v x</em></dt> <dd><p>Set the X coordinate of the 2D vector <var>v</var> to <var>x</var>. </p></dd></dl> <dl> -<dt><a name="index-set_002dvec2_002dy_0021"></a>Procedure: <strong>set-vec2-y!</strong> <em><var>v</var> <var>y</var></em></dt> +<dt><a name="index-set_002dvec2_002dy_0021"></a>Procedure: <strong>set-vec2-y!</strong> <em>v y</em></dt> <dd><p>Set the Y coordinate of the 2D vector <var>v</var> to <var>y</var>. </p></dd></dl> <dl> -<dt><a name="index-vec2_002dcopy_0021"></a>Procedure: <strong>vec2-copy!</strong> <em><var>source</var> <var>target</var></em></dt> +<dt><a name="index-set_002dvec2_0021"></a>Procedure: <strong>set-vec2!</strong> <em>v x y</em></dt> +<dd><p>Set the X and Y coordinates of the 2D vector <var>v</var> to <var>x</var> and +<var>y</var>, respectively. +</p></dd></dl> + +<dl> +<dt><a name="index-vec2_002dcopy_0021"></a>Procedure: <strong>vec2-copy!</strong> <em>source target</em></dt> <dd><p>Copy the 2D vector <var>source</var> into the 2D vector <var>target</var>. </p></dd></dl> <dl> -<dt><a name="index-vec2_002dadd_0021"></a>Procedure: <strong>vec2-add!</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-vec2_002dadd_0021"></a>Procedure: <strong>vec2-add!</strong> <em>v x</em></dt> <dd><p>Perform an in-place modification of the 2D vector <var>v</var> by adding <var>x</var>, a 2D vector or a scalar. </p></dd></dl> <dl> -<dt><a name="index-vec2_002dsub_0021"></a>Procedure: <strong>vec2-sub!</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-vec2_002dsub_0021"></a>Procedure: <strong>vec2-sub!</strong> <em>v x</em></dt> <dd><p>Perform an in-place modification of the 2D vector <var>v</var> by subtracting <var>x</var>, a 2D vector or a scalar. </p></dd></dl> <dl> -<dt><a name="index-vec2_002dmult_0021"></a>Procedure: <strong>vec2-mult!</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-vec2_002dmult_0021"></a>Procedure: <strong>vec2-mult!</strong> <em>v x</em></dt> <dd><p>Perform an in-place modification of the 2D vector <var>v</var> by multiplying it by <var>x</var>, a 2D vector or a scalar. </p></dd></dl> @@ -234,102 +242,108 @@ multiplying it by <var>x</var>, a 2D vector or a scalar. <h4 class="subsubsection">2.2.2.3 3D Vectors</h4> <dl> -<dt><a name="index-vec3"></a>Procedure: <strong>vec3</strong> <em><var>x</var> <var>y</var></em></dt> +<dt><a name="index-vec3"></a>Procedure: <strong>vec3</strong> <em>x y</em></dt> <dd><p>Return a new 2D vector with coordinates (<var>x</var>, <var>y</var>). </p></dd></dl> <dl> -<dt><a name="index-vec3_003f"></a>Procedure: <strong>vec3?</strong> <em><var>obj</var></em></dt> +<dt><a name="index-vec3_003f"></a>Procedure: <strong>vec3?</strong> <em>obj</em></dt> <dd><p>Return <code>#t</code> if <var>obj</var> is a 3D vector. </p></dd></dl> <dl> -<dt><a name="index-vec3_002dx"></a>Procedure: <strong>vec3-x</strong> <em><var>v</var></em></dt> +<dt><a name="index-vec3_002dx"></a>Procedure: <strong>vec3-x</strong> <em>v</em></dt> <dd><p>Return the X coordinate of the 3D vector <var>v</var>. </p></dd></dl> <dl> -<dt><a name="index-vec3_002dy"></a>Procedure: <strong>vec3-y</strong> <em><var>v</var></em></dt> +<dt><a name="index-vec3_002dy"></a>Procedure: <strong>vec3-y</strong> <em>v</em></dt> <dd><p>Return the Y coordinate of the 3D vector <var>v</var>. </p></dd></dl> <dl> -<dt><a name="index-vec3_002dz"></a>Procedure: <strong>vec3-z</strong> <em><var>v</var></em></dt> +<dt><a name="index-vec3_002dz"></a>Procedure: <strong>vec3-z</strong> <em>v</em></dt> <dd><p>Return the Z coordinate of the 3D vector <var>v</var>. </p></dd></dl> <dl> -<dt><a name="index-vec3_002dcopy"></a>Procedure: <strong>vec3-copy</strong> <em><var>v</var></em></dt> +<dt><a name="index-vec3_002dcopy"></a>Procedure: <strong>vec3-copy</strong> <em>v</em></dt> <dd><p>Return a fresh copy of the 3D vector <var>v</var>. </p></dd></dl> <dl> -<dt><a name="index-vec3_002dmagnitude"></a>Procedure: <strong>vec3-magnitude</strong> <em><var>v</var></em></dt> +<dt><a name="index-vec3_002dmagnitude"></a>Procedure: <strong>vec3-magnitude</strong> <em>v</em></dt> <dd><p>Return the magnitude of the 3D vector <var>v</var>. </p></dd></dl> <dl> -<dt><a name="index-vec3_002ddot_002dproduct"></a>Procedure: <strong>vec3-dot-product</strong> <em><var>v1</var> <var>v2</var></em></dt> +<dt><a name="index-vec3_002ddot_002dproduct"></a>Procedure: <strong>vec3-dot-product</strong> <em>v1 v2</em></dt> <dd><p>Return the dot product of the 3D vectors <var>v1</var> and <var>v2</var>. </p></dd></dl> <dl> -<dt><a name="index-vec3_002dnormalize"></a>Procedure: <strong>vec3-normalize</strong> <em><var>v</var></em></dt> +<dt><a name="index-vec3_002dnormalize"></a>Procedure: <strong>vec3-normalize</strong> <em>v</em></dt> <dd><p>Return the normalized form of the 3D vector <var>v</var>. </p></dd></dl> <dl> -<dt><a name="index-vec3_002b"></a>Procedure: <strong>vec3+</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-vec3_002b"></a>Procedure: <strong>vec3+</strong> <em>v x</em></dt> <dd><p>Add <var>x</var>, either a 3D vector or a scalar (i.e. a real number), to the 3D vector <var>v</var> and return a new vector containing the sum. </p></dd></dl> <dl> -<dt><a name="index-vec3_002d"></a>Procedure: <strong>vec3-</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-vec3_002d"></a>Procedure: <strong>vec3-</strong> <em>v x</em></dt> <dd><p>Subtract <var>x</var>, either a 3D vector or a scalar, from the 3D vector <var>v</var> and return a new vector containing the difference. </p></dd></dl> <dl> -<dt><a name="index-vec3_002a"></a>Procedure: <strong>vec3*</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-vec3_002a"></a>Procedure: <strong>vec3*</strong> <em>v x</em></dt> <dd><p>Multiply the 3D vector <var>v</var> by <var>x</var>, a 3D vector or a scalar, and return a new vector containing the product. </p></dd></dl> <dl> -<dt><a name="index-set_002dvec3_002dx_0021"></a>Procedure: <strong>set-vec3-x!</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-set_002dvec3_002dx_0021"></a>Procedure: <strong>set-vec3-x!</strong> <em>v x</em></dt> <dd><p>Set the X coordinate of the 3D vector <var>v</var> to <var>x</var>. </p></dd></dl> <dl> -<dt><a name="index-set_002dvec3_002dy_0021"></a>Procedure: <strong>set-vec3-y!</strong> <em><var>v</var> <var>y</var></em></dt> +<dt><a name="index-set_002dvec3_002dy_0021"></a>Procedure: <strong>set-vec3-y!</strong> <em>v y</em></dt> <dd><p>Set the Y coordinate of the 3D vector <var>v</var> to <var>y</var>. </p></dd></dl> <dl> -<dt><a name="index-set_002dvec3_002dz_0021"></a>Procedure: <strong>set-vec3-z!</strong> <em><var>v</var> <var>z</var></em></dt> +<dt><a name="index-set_002dvec3_002dz_0021"></a>Procedure: <strong>set-vec3-z!</strong> <em>v z</em></dt> <dd><p>Set the Z coordinate of the 3D vector <var>v</var> to <var>z</var>. </p></dd></dl> <dl> -<dt><a name="index-vec3_002dcopy_0021"></a>Procedure: <strong>vec3-copy!</strong> <em><var>source</var> <var>target</var></em></dt> +<dt><a name="index-set_002dvec3_0021"></a>Procedure: <strong>set-vec3!</strong> <em>v x y z</em></dt> +<dd><p>Set the X, Y, and Z coordinates of the 3D vector <var>v</var> to <var>x</var>, +<var>y</var>, and <var>z</var>, respectively. +</p></dd></dl> + +<dl> +<dt><a name="index-vec3_002dcopy_0021"></a>Procedure: <strong>vec3-copy!</strong> <em>source target</em></dt> <dd><p>Copy the 3D vector <var>source</var> into the 3D vector <var>target</var>. </p></dd></dl> <dl> -<dt><a name="index-vec3_002dadd_0021"></a>Procedure: <strong>vec3-add!</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-vec3_002dadd_0021"></a>Procedure: <strong>vec3-add!</strong> <em>v x</em></dt> <dd><p>Perform an in-place modification of the 3D vector <var>v</var> by adding <var>x</var>, a 3D vector or a scalar. </p></dd></dl> <dl> -<dt><a name="index-vec3_002dsub_0021"></a>Procedure: <strong>vec3-sub!</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-vec3_002dsub_0021"></a>Procedure: <strong>vec3-sub!</strong> <em>v x</em></dt> <dd><p>Perform an in-place modification of the 3D vector <var>v</var> by subtracting <var>x</var>, a 3D vector or a scalar. </p></dd></dl> <dl> -<dt><a name="index-vec3_002dmult_0021"></a>Procedure: <strong>vec3-mult!</strong> <em><var>v</var> <var>x</var></em></dt> +<dt><a name="index-vec3_002dmult_0021"></a>Procedure: <strong>vec3-mult!</strong> <em>v x</em></dt> <dd><p>Perform an in-place modification of the 3D vector <var>v</var> by multiplying it by <var>x</var>, a 3D vector or a scalar. </p></dd></dl> |