Jason McKesson avatar Jason McKesson committed c40c94c

Tot00: Added images.

Comments (0)

Files changed (17)

Documents/Basics/GenVectorAddition.lua

+require "SvgWriter"
+require "vmath"
+require "Viewport"
+require "SubImage"
+require "GridAxis"
+require "_utils"
+
+local subImages = SubImage.SubImage(1, 1, 300, 300, 100, 0);
+
+local coordSize = 10;
+
+local vp = Viewport.Viewport({300, 300}, {0, 3}, coordSize)
+local trans2 = Viewport.Transform2D()
+vp:SetTransform(trans2);
+
+local styleLib = SvgWriter.StyleLibrary();
+
+local vectorColor = "black";
+local vectorSumColor = "red";
+local pointSize = 15;
+
+styleLib:AddStyle(nil, "vector",
+	SvgWriter.Style():stroke(vectorColor):marker_end(SvgWriter.uriLocalElement("arrow")));
+styleLib:AddStyle(nil, "arrowhead",
+	SvgWriter.Style():stroke(vectorColor):fill(vectorColor));
+styleLib:AddStyle(nil, "text",
+	SvgWriter.Style():stroke("none"):fill(vectorColor):font_weight("bold"):font_size("25px"):font_family("monospace") );
+	
+styleLib:AddStyle(nil, "vector-sum",
+	SvgWriter.Style():stroke(vectorSumColor):marker_end(SvgWriter.uriLocalElement("arrow-sum")));
+styleLib:AddStyle(nil, "arrowhead-sum",
+	SvgWriter.Style():stroke(vectorSumColor):fill(vectorSumColor));
+styleLib:AddStyle(nil, "text-sum",
+	SvgWriter.Style():stroke("none"):fill(vectorSumColor):font_weight("bold"):font_size("25px"):font_family("monospace") );
+	
+local axisData = GridAxis.GridAxis2D(vp, nil, styleLib, true, nil);
+
+local vectors =
+{
+	vmath.vec2(0, 0),
+	vmath.vec2(3, 4),
+
+	vmath.vec2(0, 0),
+	vmath.vec2(-4, 2),
+
+	vmath.vec2(0, 0),
+	vmath.vec2(-2, 6),
+};
+
+local labelOffset = vmath.vec2(5, -12);
+
+local vectorLabels = 
+{
+	"A", vmath.vec2(10, 10),
+	"B", vmath.vec2(5, -5),
+	"A+B", vmath.vec2(-7, -40),
+}
+
+local styles =
+{
+	{{"vector"}, {"text"}}, 
+	{{"vector"}, {"text"}}, 
+	{{"vector-sum"}, {"text-sum"}}, 
+};
+
+vectors = vp:Transform(vectors);
+
+local writer = SvgWriter.SvgWriter(ConstructSVGName(arg[0]), {subImages:Size().x .."px", subImages:Size().y .. "px"});
+	writer:StyleLibrary(styleLib);
+	axisData:AddDefinitions(writer, "g_axes");
+	writer:BeginDefinitions();
+		WriteStandardArrowhead(writer, "arrow", {"arrowhead"});
+		WriteStandardArrowhead(writer, "arrow-sum", {"arrowhead-sum"});
+	writer:EndDefinitions();
+
+	writer:Use("g_axes", subImages:Offset(1, 1), subImages:SubSize());
+
+	for i=1, #vectors, 2 do
+		writer:Line(vectors[i], vectors[i + 1], styles[(i+1)/2][1]);
+		writer:Text(vectorLabels[i],
+			((vectors[i] + vectors[i + 1]) / 2) + vectorLabels[i + 1], styles[(i+1)/2][2]);
+	end
+writer:Close();

Documents/Basics/GenVectorAdditionHeads.lua

+require "SvgWriter"
+require "vmath"
+require "Viewport"
+require "SubImage"
+require "GridAxis"
+require "_utils"
+
+local subImages = SubImage.SubImage(1, 1, 300, 300, 100, 0);
+
+local coordSize = 10;
+
+local vp = Viewport.Viewport({300, 300}, {0, 3}, coordSize)
+local trans2 = Viewport.Transform2D()
+vp:SetTransform(trans2);
+
+local styleLib = SvgWriter.StyleLibrary();
+
+local vectorColor = "black";
+local vectorSumColor = "red";
+local pointSize = 15;
+
+styleLib:AddStyle(nil, "vector",
+	SvgWriter.Style():stroke(vectorColor):marker_end(SvgWriter.uriLocalElement("arrow")));
+styleLib:AddStyle(nil, "arrowhead",
+	SvgWriter.Style():stroke(vectorColor):fill(vectorColor));
+styleLib:AddStyle(nil, "text",
+	SvgWriter.Style():stroke("none"):fill(vectorColor):font_weight("bold"):font_size("25px"):font_family("monospace") );
+	
+styleLib:AddStyle(nil, "vector-sum",
+	SvgWriter.Style():stroke(vectorSumColor):marker_end(SvgWriter.uriLocalElement("arrow-sum")));
+styleLib:AddStyle(nil, "arrowhead-sum",
+	SvgWriter.Style():stroke(vectorSumColor):fill(vectorSumColor));
+styleLib:AddStyle(nil, "text-sum",
+	SvgWriter.Style():stroke("none"):fill(vectorSumColor):font_weight("bold"):font_size("25px"):font_family("monospace"):text_anchor("end") );
+	
+local axisData = GridAxis.GridAxis2D(vp, nil, styleLib, true, nil);
+
+local vectors =
+{
+	vmath.vec2(0, 0),
+	vmath.vec2(3, 4),
+
+	vmath.vec2(3, 4),
+	vmath.vec2(-2, 6),
+
+	vmath.vec2(0, 0),
+	vmath.vec2(-2, 6),
+};
+
+local labelOffset = vmath.vec2(5, -12);
+
+local vectorLabels = 
+{
+	"A", vmath.vec2(10, 10),
+	"B", vmath.vec2(5, -5),
+	"A+B", vmath.vec2(-5, 20),
+}
+
+local styles =
+{
+	{{"vector"}, {"text"}}, 
+	{{"vector"}, {"text"}}, 
+	{{"vector-sum"}, {"text-sum"}}, 
+};
+
+vectors = vp:Transform(vectors);
+
+local writer = SvgWriter.SvgWriter(ConstructSVGName(arg[0]), {subImages:Size().x .."px", subImages:Size().y .. "px"});
+	writer:StyleLibrary(styleLib);
+	axisData:AddDefinitions(writer, "g_axes");
+	writer:BeginDefinitions();
+		WriteStandardArrowhead(writer, "arrow", {"arrowhead"});
+		WriteStandardArrowhead(writer, "arrow-sum", {"arrowhead-sum"});
+	writer:EndDefinitions();
+
+	writer:Use("g_axes", subImages:Offset(1, 1), subImages:SubSize());
+
+	for i=1, #vectors, 2 do
+		writer:Line(vectors[i], vectors[i + 1], styles[(i+1)/2][1]);
+		writer:Text(vectorLabels[i],
+			((vectors[i] + vectors[i + 1]) / 2) + vectorLabels[i + 1], styles[(i+1)/2][2]);
+	end
+writer:Close();

Documents/Basics/GenVectorDirections.lua

+require "SvgWriter"
+require "vmath"
+require "Viewport"
+require "SubImage"
+require "GridAxis"
+require "_utils"
+
+local subImages = SubImage.SubImage(1, 1, 300, 300, 100, 0);
+
+local coordSize = 10;
+
+local vp = Viewport.Viewport({300, 300}, {0, 0}, coordSize)
+local trans2 = Viewport.Transform2D()
+vp:SetTransform(trans2);
+
+local styleLib = SvgWriter.StyleLibrary();
+
+local vectorColor = "black";
+local pointSize = 15;
+
+styleLib:AddStyle(nil, "vector",
+	SvgWriter.Style():stroke(vectorColor):marker_end(SvgWriter.uriLocalElement("arrow")));
+styleLib:AddStyle(nil, "text",
+	SvgWriter.Style():stroke("none"):fill(vectorColor):font_weight("bold"):font_size("25px"):font_family("monospace") );
+
+local axisData = GridAxis.GridAxis2D(vp, nil, styleLib, true, nil);
+
+local vectors =
+{
+	vmath.vec2(0, 0),
+	vmath.vec2(2, 3),
+
+	vmath.vec2(4, -4),
+	vmath.vec2(2, -3),
+
+	vmath.vec2(-2.5, 4),
+	vmath.vec2(-1.5, -1),
+
+	vmath.vec2(-2.3, -2.7),
+	vmath.vec2(-4.3, -1.7),
+};
+
+local labelOffset = vmath.vec2(5, -12);
+
+local vectorLabels = 
+{
+	"A", vmath.vec2(10, 10),
+	"B", vmath.vec2(5, -5),
+	"C", vmath.vec2(5, 0),
+	"D", vmath.vec2(-10, 25),
+}
+
+vectors = vp:Transform(vectors);
+
+local writer = SvgWriter.SvgWriter(ConstructSVGName(arg[0]), {subImages:Size().x .."px", subImages:Size().y .. "px"});
+	writer:StyleLibrary(styleLib);
+	axisData:AddDefinitions(writer, "g_axes");
+	writer:BeginDefinitions();
+		writer:BeginMarker({10, 8}, {10, 4}, "auto", true, nil, "arrow");
+			writer:Path(StandardArrowheadPath(), {"fill_black", "thin"});
+		writer:EndMarker();
+	writer:EndDefinitions();
+
+	writer:Use("g_axes", subImages:Offset(1, 1), subImages:SubSize());
+
+	for i=1, #vectors, 2 do
+		writer:Line(vectors[i], vectors[i + 1], {"vector"});
+		writer:Text(vectorLabels[i],
+			((vectors[i] + vectors[i + 1]) / 2) + vectorLabels[i + 1], {"text"});
+	end
+writer:Close();

Documents/Basics/GenVectorNegation.lua

+require "SvgWriter"
+require "vmath"
+require "Viewport"
+require "SubImage"
+require "GridAxis"
+require "_utils"
+
+local subImages = SubImage.SubImage(1, 1, 300, 300, 100, 0);
+
+local coordSize = 10;
+
+local vp = Viewport.Viewport({300, 300}, {0, 2}, coordSize)
+local trans2 = Viewport.Transform2D()
+vp:SetTransform(trans2);
+
+local styleLib = SvgWriter.StyleLibrary();
+
+local vectorColor = "black";
+local vectorSumColor = "red";
+local pointSize = 15;
+
+styleLib:AddStyle(nil, "vector",
+	SvgWriter.Style():stroke(vectorColor):marker_end(SvgWriter.uriLocalElement("arrow")));
+styleLib:AddStyle(nil, "arrowhead",
+	SvgWriter.Style():stroke(vectorColor):fill(vectorColor));
+styleLib:AddStyle(nil, "text",
+	SvgWriter.Style():stroke("none"):fill(vectorColor):font_weight("bold"):font_size("25px"):font_family("monospace") );
+	
+styleLib:AddStyle(nil, "vector-sum",
+	SvgWriter.Style():stroke(vectorSumColor):marker_end(SvgWriter.uriLocalElement("arrow-sum")));
+styleLib:AddStyle(nil, "arrowhead-sum",
+	SvgWriter.Style():stroke(vectorSumColor):fill(vectorSumColor));
+styleLib:AddStyle(nil, "text-sum",
+	SvgWriter.Style():stroke("none"):fill(vectorSumColor):font_weight("bold"):font_size("25px"):font_family("monospace"):text_anchor("end") );
+	
+local axisData = GridAxis.GridAxis2D(vp, nil, styleLib, true, nil);
+
+local vectors =
+{
+	vmath.vec2(0, 0),
+	vmath.vec2(3, 4),
+
+	vmath.vec2(0, 4),
+	vmath.vec2(-3, 0),
+};
+
+local labelOffset = vmath.vec2(5, -12);
+
+local vectorLabels = 
+{
+	"A", vmath.vec2(10, 10),
+	"-A", vmath.vec2(-5, -5),
+}
+
+local styles =
+{
+	{{"vector"}, {"text"}}, 
+	{{"vector-sum"}, {"text-sum"}}, 
+};
+
+vectors = vp:Transform(vectors);
+
+local writer = SvgWriter.SvgWriter(ConstructSVGName(arg[0]), {subImages:Size().x .."px", subImages:Size().y .. "px"});
+	writer:StyleLibrary(styleLib);
+	axisData:AddDefinitions(writer, "g_axes");
+	writer:BeginDefinitions();
+		WriteStandardArrowhead(writer, "arrow", {"arrowhead"});
+		WriteStandardArrowhead(writer, "arrow-sum", {"arrowhead-sum"});
+	writer:EndDefinitions();
+
+	writer:Use("g_axes", subImages:Offset(1, 1), subImages:SubSize());
+
+	for i=1, #vectors, 2 do
+		writer:Line(vectors[i], vectors[i + 1], styles[(i+1)/2][1]);
+		writer:Text(vectorLabels[i],
+			((vectors[i] + vectors[i + 1]) / 2) + vectorLabels[i + 1], styles[(i+1)/2][2]);
+	end
+writer:Close();

Documents/Basics/GenVectorPosition.lua

+require "SvgWriter"
+require "vmath"
+require "Viewport"
+require "SubImage"
+require "GridAxis"
+
+local subImages = SubImage.SubImage(1, 1, 300, 300, 100, 0);
+
+local coordSize = 10;
+
+local vp = Viewport.Viewport({300, 300}, {0, 0}, coordSize)
+local trans2 = Viewport.Transform2D()
+vp:SetTransform(trans2);
+
+local styleLib = SvgWriter.StyleLibrary();
+
+local objectColor = "#AFAFFF";
+local pointSize = 15;
+
+styleLib:AddStyle(nil, "point",
+	SvgWriter.Style():stroke(objectColor):fill(objectColor));
+styleLib:AddStyle(nil, "text",
+	SvgWriter.Style():stroke("none"):fill(objectColor):font_size("25px"):font_family("monospace"):font_weight("bold") );
+
+local axisData = GridAxis.GridAxis2D(vp, nil, styleLib, true, nil);
+
+local points =
+{
+	vmath.vec2(2, 3),
+	vmath.vec2(-3, 2.5),
+	vmath.vec2(0.5, -3),
+};
+
+local labelOffset = vmath.vec2(5, -12);
+
+local pointLabels = 
+{
+	"A",
+	"B",
+	"C",
+}
+
+points = vp:Transform(points);
+
+local writer = SvgWriter.SvgWriter("VectorPosition.svg", {subImages:Size().x .."px", subImages:Size().y .. "px"});
+	writer:StyleLibrary(styleLib);
+	axisData:AddDefinitions(writer, "g_axes");
+	
+	writer:Use("g_axes", subImages:Offset(1, 1), subImages:SubSize());
+
+	local circlePos = vp:Transform(vmath.vec2(2, 3));
+
+	for i=1, #points do
+		writer:Circle(points[i], pointSize / 2, {"point"});
+		writer:Text(pointLabels[i], points[i] + labelOffset, {"text"});
+	end
+writer:Close();

Documents/Basics/GenVectorScalarMult.lua

+require "SvgWriter"
+require "vmath"
+require "Viewport"
+require "SubImage"
+require "GridAxis"
+require "_utils"
+
+local subImages = SubImage.SubImage(1, 1, 300, 300, 100, 0);
+
+local coordSize = 14;
+
+local vp = Viewport.Viewport({300, 300}, {0, 4}, coordSize)
+local trans2 = Viewport.Transform2D()
+vp:SetTransform(trans2);
+
+local styleLib = SvgWriter.StyleLibrary();
+
+local vectorColor = "black";
+local vectorSumColor = "red";
+local pointSize = 15;
+
+styleLib:AddStyle(nil, "vector",
+	SvgWriter.Style():stroke(vectorColor):marker_end(SvgWriter.uriLocalElement("arrow")));
+styleLib:AddStyle(nil, "arrowhead",
+	SvgWriter.Style():stroke(vectorColor):fill(vectorColor));
+styleLib:AddStyle(nil, "text",
+	SvgWriter.Style():stroke("none"):fill(vectorColor):font_weight("bold"):font_size("25px"):font_family("monospace") );
+	
+styleLib:AddStyle(nil, "vector-sum",
+	SvgWriter.Style():stroke(vectorSumColor):marker_end(SvgWriter.uriLocalElement("arrow-sum")));
+styleLib:AddStyle(nil, "arrowhead-sum",
+	SvgWriter.Style():stroke(vectorSumColor):fill(vectorSumColor));
+styleLib:AddStyle(nil, "text-sum",
+	SvgWriter.Style():stroke("none"):fill(vectorSumColor):font_weight("bold"):font_size("25px"):font_family("monospace") );
+	
+local axisData = GridAxis.GridAxis2D(vp, nil, styleLib, true, nil);
+
+local vectors =
+{
+	vmath.vec2(0, 0),
+	vmath.vec2(2, 3),
+
+	vmath.vec2(-4, 0),
+	vmath.vec2(2, 9),
+
+	vmath.vec2(3, 0),
+	vmath.vec2(4, 1.5),
+};
+
+local labelOffset = vmath.vec2(5, -12);
+
+local vectorLabels = 
+{
+	"A", vmath.vec2(-20, 5),
+	"3*A", vmath.vec2(-50, -5),
+	"0.5*A", vmath.vec2(-7, -20),
+}
+
+local styles =
+{
+	{{"vector"}, {"text"}}, 
+	{{"vector-sum"}, {"text-sum"}}, 
+	{{"vector-sum"}, {"text-sum"}}, 
+};
+
+vectors = vp:Transform(vectors);
+
+local writer = SvgWriter.SvgWriter(ConstructSVGName(arg[0]), {subImages:Size().x .."px", subImages:Size().y .. "px"});
+	writer:StyleLibrary(styleLib);
+	axisData:AddDefinitions(writer, "g_axes");
+	writer:BeginDefinitions();
+		WriteStandardArrowhead(writer, "arrow", {"arrowhead"});
+		WriteStandardArrowhead(writer, "arrow-sum", {"arrowhead-sum"});
+	writer:EndDefinitions();
+
+	writer:Use("g_axes", subImages:Offset(1, 1), subImages:SubSize());
+
+	for i=1, #vectors, 2 do
+		writer:Line(vectors[i], vectors[i + 1], styles[(i+1)/2][1]);
+		writer:Text(vectorLabels[i],
+			((vectors[i] + vectors[i + 1]) / 2) + vectorLabels[i + 1], styles[(i+1)/2][2]);
+	end
+writer:Close();

Documents/Basics/GenVectorSubtraction.lua

+require "SvgWriter"
+require "vmath"
+require "Viewport"
+require "SubImage"
+require "GridAxis"
+require "_utils"
+
+local subImages = SubImage.SubImage(1, 1, 300, 300, 100, 0);
+
+local coordSize = 10;
+
+local vp = Viewport.Viewport({300, 300}, {2, 3}, coordSize)
+local trans2 = Viewport.Transform2D()
+vp:SetTransform(trans2);
+
+local styleLib = SvgWriter.StyleLibrary();
+
+local vectorColor = "black";
+local vectorSumColor = "red";
+local pointSize = 15;
+
+styleLib:AddStyle(nil, "vector",
+	SvgWriter.Style():stroke(vectorColor):marker_end(SvgWriter.uriLocalElement("arrow")));
+styleLib:AddStyle(nil, "arrowhead",
+	SvgWriter.Style():stroke(vectorColor):fill(vectorColor));
+styleLib:AddStyle(nil, "text",
+	SvgWriter.Style():stroke("none"):fill(vectorColor):font_weight("bold"):font_size("25px"):font_family("monospace") );
+	
+styleLib:AddStyle(nil, "vector-sum",
+	SvgWriter.Style():stroke(vectorSumColor):marker_end(SvgWriter.uriLocalElement("arrow-sum")));
+styleLib:AddStyle(nil, "arrowhead-sum",
+	SvgWriter.Style():stroke(vectorSumColor):fill(vectorSumColor));
+styleLib:AddStyle(nil, "text-sum",
+	SvgWriter.Style():stroke("none"):fill(vectorSumColor):font_weight("bold"):font_size("25px"):font_family("monospace") );
+	
+local axisData = GridAxis.GridAxis2D(vp, nil, styleLib, true, nil);
+
+local vectors =
+{
+	vmath.vec2(0, 0),
+	vmath.vec2(2, 4),
+
+	vmath.vec2(2, 4),
+	vmath.vec2(-1, 6),
+
+	vmath.vec2(2, 4),
+	vmath.vec2(5, 2),
+
+	vmath.vec2(0, 0),
+	vmath.vec2(5, 2),
+};
+
+local labelOffset = vmath.vec2(5, -12);
+
+local vectorLabels = 
+{
+	"A", vmath.vec2(-23, 5),
+	"B", vmath.vec2(5, -5),
+	"-B", vmath.vec2(5, -5),
+	"A-B", vmath.vec2(10, 20),
+}
+
+local styles =
+{
+	{{"vector"}, {"text"}}, 
+	{{"vector"}, {"text"}}, 
+	{{"vector-sum"}, {"text-sum"}}, 
+	{{"vector-sum"}, {"text-sum"}}, 
+};
+
+vectors = vp:Transform(vectors);
+
+local writer = SvgWriter.SvgWriter(ConstructSVGName(arg[0]), {subImages:Size().x .."px", subImages:Size().y .. "px"});
+	writer:StyleLibrary(styleLib);
+	axisData:AddDefinitions(writer, "g_axes");
+	writer:BeginDefinitions();
+		WriteStandardArrowhead(writer, "arrow", {"arrowhead"});
+		WriteStandardArrowhead(writer, "arrow-sum", {"arrowhead-sum"});
+	writer:EndDefinitions();
+
+	writer:Use("g_axes", subImages:Offset(1, 1), subImages:SubSize());
+
+	for i=1, #vectors, 2 do
+		writer:Line(vectors[i], vectors[i + 1], styles[(i+1)/2][1]);
+		writer:Text(vectorLabels[i],
+			((vectors[i] + vectors[i + 1]) / 2) + vectorLabels[i + 1], styles[(i+1)/2][2]);
+	end
+writer:Close();

Documents/Basics/Tutorial 00.xml

             direction within a particular space. A vector <glossterm>position</glossterm> represents
             a specific location in space. For example, on this graph, we have a vector position
             A:</para>
-        <!--TODO: Show a graph with a position labeled A.-->
+        <figure>
+            <title>Position Vectors</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="VectorPosition.svg" format="SVG"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
         <para>A vector can also represent a <glossterm>direction</glossterm>. Direction vectors do
             not have an origin; they simply specify a direction in space. These are all direction
             vectors, but the vectors B and D are the same, even though they are drawn in different
             locations:</para>
-        <!--TODO: Show a graph with several labeled vector directions.
-Directions B and D should be the same length and point in the same direction.-->
+        <figure>
+            <title>Direction Vectors</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="VectorDirections.svg" format="SVG"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
         <para>That's all well and good for geometry, but vectors can also be described numerically.
             A vector in this case is a sequence of numbers, one for each dimension. So a
             two-dimensional vector has two numbers; a three-dimensional vector has three. And so
             <para>You can take two vectors and add them together. Graphically, this works as
             follows:</para>
             </formalpara>
-            <!--TODO: Show vectors A, B, and A+B, geometrically.-->
+        <figure>
+            <title>Vector Addition</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="VectorAddition.svg" format="SVG"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
             <para>Remember that vector directions can be shifted around without changing their
                 values. So if you put two vectors head to tail, the vector sum is simply the
                 direction from the tail of the first vector to the head of the last.</para>
-            <!--TODO: Show A+B again, with B moved to the tip of A.-->
+        <figure>
+            <title>Vector Addition Head-to-Tail</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="VectorAdditionHeads.svg" format="SVG"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
             <para>Numerically, the sum of two vectors is just the sum of the corresponding
                 components:</para>
         <equation>
             <title>Vector Negation and Subtraction</title>
             <para>You can negate a vector. This reverses its direction:</para>
         </formalpara>
-        <!--TODO: Show vectors A and -A.-->
+        <figure>
+            <title>Vector Negation</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="VectorNegation.svg" format="SVG"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
             <para>Numerically, this means negating each component of the vector.</para>
         <equation>
             <title>Vector Negation</title>
         </equation>
             <para>Just as with scalar math, vector subtraction is the same as addition with the
             negation of the second vector.</para>
-            <!--TODO: Geometrically show vector subtraction.-->
+        <figure>
+            <title>Vector Subtraction</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="VectorSubtraction.svg" format="SVG"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
         <formalpara>
             <title>Vector Multiplication</title>
             <para>Vector multiplication is one of the few vector operations that has no real
                 numbers. Vectors can be multiplied by scalars. This magnifies or shrinks the length
                 of the vector, depending on the scalar value.</para>
         </formalpara>
-        <!--TODO: Graph of a vector, that vector times 3, and that vector times 0.5.-->
+        <figure>
+            <title>Vector Scaling</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="VectorScalarMult.svg" format="SVG"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
         <para>Numerically, this is a component-wise multiplication, where each component of the
             vector is multiplied with each component of the scalar.</para>
         <equation>
         <para>Vector/scalar operations have similar properties.</para>
         <formalpara>
             <title>Length</title>
-            <para>Vectors have a length. The length of a vector is the distance from the starting
-                point to the ending point. Geometrically, this is as follows:</para>
+            <para>Vectors have a length. The length of a vector direction is the distance from the
+                starting point to the ending point.</para>
         </formalpara>
-        <!--TODO: Show a graph of a vector and its length.-->
         <para>Numerically, computing the distance requires this equation:</para>
         <equation>
             <title>Vector Length</title>
                 </imageobject>
             </mediaobject>
         </equation>
+        <para>This uses the Pythagorean theorem to compute the length of the vector. This works for
+            vectors of arbitrary dimensions, not just two or three.</para>
         <formalpara>
             <title>Unit Vectors and Normalization</title>
             <para>A vector that has a length of exactly one is called a <glossterm>unit
Add a comment to this file

Documents/Basics/VectorAddition.svg

Added
New image
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" height="300px" width="300px" >
+	<style type="text/css" ><![CDATA[.vector
+{
+	marker-end: url(#arrow);
+	stroke: black;
+}
+
+.__grid1
+{
+	stroke: #CCC;
+	stroke-width: 1px;
+	fill: none;
+}
+
+.text
+{
+	font-size: 25px;
+	font-family: monospace;
+	stroke: none;
+	font-weight: bold;
+	fill: black;
+}
+
+.arrowhead
+{
+	fill: black;
+	stroke: black;
+}
+
+.vector-sum
+{
+	marker-end: url(#arrow-sum);
+	stroke: red;
+}
+
+.__axis_arrow_end1
+{
+	marker-end: url(#__axis_arrow1);
+}
+
+.text-sum
+{
+	font-size: 25px;
+	font-family: monospace;
+	stroke: none;
+	font-weight: bold;
+	fill: red;
+}
+
+.arrowhead-sum
+{
+	fill: red;
+	stroke: red;
+}
+
+.__axis1
+{
+	stroke: black;
+	stroke-width: 2px;
+	fill: none;
+}]]></style>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="__axis_arrow1" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="fill_black thin" />
+		</marker>
+		<g id="g_axes" >
+			<path d="M 0 300 V 0 M 30 300 V 0 M 60 300 V 0 M 90 300 V 0 M 120 300 V 0 M 150 300 V 0 M 180 300 V 0 M 210 300 V 0 M 240 300 V 0 M 270 300 V 0 M 300 300 V 0 M 0 300 H 300 M 0 270 H 300 M 0 240 H 300 M 0 210 H 300 M 0 180 H 300 M 0 150 H 300 M 0 120 H 300 M 0 90 H 300 M 0 60 H 300 M 0 30 H 300 M 0 0 H 300" class="__grid1" />
+			<line x2="150" y2="300" y1="240" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="150" y2="0" y1="240" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="300" y2="240" y1="240" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="0" y2="240" y1="240" x1="150" class="__axis1 __axis_arrow_end1" />
+		</g>
+	</defs>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="arrow" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="arrowhead" />
+		</marker>
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="arrow-sum" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="arrowhead-sum" />
+		</marker>
+	</defs>
+	<use xlink:href="#g_axes" y="0" x="0" height="300" width="300" />
+	<line x2="240" y2="120" y1="240" x1="150" class="vector" />
+	<text y="190" x="205" class="text" >A</text>
+	<line x2="30" y2="180" y1="240" x1="150" class="vector" />
+	<text y="205" x="95" class="text" >B</text>
+	<line x2="90" y2="60" y1="240" x1="150" class="vector-sum" />
+	<text y="110" x="113" class="text-sum" >A+B</text>
+</svg>
Add a comment to this file

Documents/Basics/VectorAdditionHeads.svg

Added
New image
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" height="300px" width="300px" >
+	<style type="text/css" ><![CDATA[.arrowhead
+{
+	fill: black;
+	stroke: black;
+}
+
+.vector
+{
+	marker-end: url(#arrow);
+	stroke: black;
+}
+
+.text
+{
+	font-size: 25px;
+	font-family: monospace;
+	stroke: none;
+	font-weight: bold;
+	fill: black;
+}
+
+.__grid1
+{
+	stroke: #CCC;
+	stroke-width: 1px;
+	fill: none;
+}
+
+.__axis_arrow_end1
+{
+	marker-end: url(#__axis_arrow1);
+}
+
+.vector-sum
+{
+	marker-end: url(#arrow-sum);
+	stroke: red;
+}
+
+.__axis1
+{
+	stroke: black;
+	stroke-width: 2px;
+	fill: none;
+}
+
+.text-sum
+{
+	font-size: 25px;
+	font-weight: bold;
+	font-family: monospace;
+	stroke: none;
+	text-anchor: end;
+	fill: red;
+}
+
+.arrowhead-sum
+{
+	fill: red;
+	stroke: red;
+}]]></style>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="__axis_arrow1" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="fill_black thin" />
+		</marker>
+		<g id="g_axes" >
+			<path d="M 0 300 V 0 M 30 300 V 0 M 60 300 V 0 M 90 300 V 0 M 120 300 V 0 M 150 300 V 0 M 180 300 V 0 M 210 300 V 0 M 240 300 V 0 M 270 300 V 0 M 300 300 V 0 M 0 300 H 300 M 0 270 H 300 M 0 240 H 300 M 0 210 H 300 M 0 180 H 300 M 0 150 H 300 M 0 120 H 300 M 0 90 H 300 M 0 60 H 300 M 0 30 H 300 M 0 0 H 300" class="__grid1" />
+			<line x2="150" y2="300" y1="240" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="150" y2="0" y1="240" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="300" y2="240" y1="240" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="0" y2="240" y1="240" x1="150" class="__axis1 __axis_arrow_end1" />
+		</g>
+	</defs>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="arrow" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="arrowhead" />
+		</marker>
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="arrow-sum" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="arrowhead-sum" />
+		</marker>
+	</defs>
+	<use xlink:href="#g_axes" y="0" x="0" height="300" width="300" />
+	<line x2="240" y2="120" y1="240" x1="150" class="vector" />
+	<text y="190" x="205" class="text" >A</text>
+	<line x2="90" y2="60" y1="120" x1="240" class="vector" />
+	<text y="85" x="170" class="text" >B</text>
+	<line x2="90" y2="60" y1="240" x1="150" class="vector-sum" />
+	<text y="170" x="115" class="text-sum" >A+B</text>
+</svg>
Add a comment to this file

Documents/Basics/VectorDirections.svg

Added
New image
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" height="300px" width="300px" >
+	<style type="text/css" ><![CDATA[.__axis_arrow_end1
+{
+	marker-end: url(#__axis_arrow1);
+}
+
+.__grid1
+{
+	stroke: #CCC;
+	stroke-width: 1px;
+	fill: none;
+}
+
+.text
+{
+	font-size: 25px;
+	font-family: monospace;
+	stroke: none;
+	font-weight: bold;
+	fill: black;
+}
+
+.vector
+{
+	marker-end: url(#arrow);
+	stroke: black;
+}
+
+.__axis1
+{
+	stroke: black;
+	stroke-width: 2px;
+	fill: none;
+}]]></style>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="__axis_arrow1" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="fill_black thin" />
+		</marker>
+		<g id="g_axes" >
+			<path d="M 0 300 V 0 M 30 300 V 0 M 60 300 V 0 M 90 300 V 0 M 120 300 V 0 M 150 300 V 0 M 180 300 V 0 M 210 300 V 0 M 240 300 V 0 M 270 300 V 0 M 300 300 V 0 M 0 300 H 300 M 0 270 H 300 M 0 240 H 300 M 0 210 H 300 M 0 180 H 300 M 0 150 H 300 M 0 120 H 300 M 0 90 H 300 M 0 60 H 300 M 0 30 H 300 M 0 0 H 300" class="__grid1" />
+			<line x2="150" y2="300" y1="150" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="150" y2="0" y1="150" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="300" y2="150" y1="150" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="0" y2="150" y1="150" x1="150" class="__axis1 __axis_arrow_end1" />
+		</g>
+	</defs>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="arrow" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="fill_black thin" />
+		</marker>
+	</defs>
+	<use xlink:href="#g_axes" y="0" x="0" height="300" width="300" />
+	<line x2="210" y2="60" y1="150" x1="150" class="vector" />
+	<text y="115" x="190" class="text" >A</text>
+	<line x2="210" y2="240" y1="270" x1="270" class="vector" />
+	<text y="250" x="245" class="text" >B</text>
+	<line x2="105" y2="180" y1="30" x1="75" class="vector" />
+	<text y="105" x="95" class="text" >C</text>
+	<line x2="21" y2="201" y1="231" x1="81" class="vector" />
+	<text y="241" x="41" class="text" >D</text>
+</svg>
Add a comment to this file

Documents/Basics/VectorNegation.svg

Added
New image
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" height="300px" width="300px" >
+	<style type="text/css" ><![CDATA[.__grid1
+{
+	stroke: #CCC;
+	stroke-width: 1px;
+	fill: none;
+}
+
+.arrowhead
+{
+	fill: black;
+	stroke: black;
+}
+
+.__axis1
+{
+	stroke: black;
+	stroke-width: 2px;
+	fill: none;
+}
+
+.__axis_arrow_end1
+{
+	marker-end: url(#__axis_arrow1);
+}
+
+.arrowhead-sum
+{
+	fill: red;
+	stroke: red;
+}
+
+.text
+{
+	font-size: 25px;
+	font-family: monospace;
+	stroke: none;
+	font-weight: bold;
+	fill: black;
+}
+
+.vector
+{
+	marker-end: url(#arrow);
+	stroke: black;
+}
+
+.text-sum
+{
+	font-size: 25px;
+	font-weight: bold;
+	font-family: monospace;
+	stroke: none;
+	text-anchor: end;
+	fill: red;
+}
+
+.vector-sum
+{
+	marker-end: url(#arrow-sum);
+	stroke: red;
+}]]></style>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="__axis_arrow1" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="fill_black thin" />
+		</marker>
+		<g id="g_axes" >
+			<path d="M 0 300 V 0 M 30 300 V 0 M 60 300 V 0 M 90 300 V 0 M 120 300 V 0 M 150 300 V 0 M 180 300 V 0 M 210 300 V 0 M 240 300 V 0 M 270 300 V 0 M 300 300 V 0 M 0 300 H 300 M 0 270 H 300 M 0 240 H 300 M 0 210 H 300 M 0 180 H 300 M 0 150 H 300 M 0 120 H 300 M 0 90 H 300 M 0 60 H 300 M 0 30 H 300 M 0 0 H 300" class="__grid1" />
+			<line x2="150" y2="300" y1="210" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="150" y2="0" y1="210" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="300" y2="210" y1="210" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="0" y2="210" y1="210" x1="150" class="__axis1 __axis_arrow_end1" />
+		</g>
+	</defs>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="arrow" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="arrowhead" />
+		</marker>
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="arrow-sum" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="arrowhead-sum" />
+		</marker>
+	</defs>
+	<use xlink:href="#g_axes" y="0" x="0" height="300" width="300" />
+	<line x2="240" y2="90" y1="210" x1="150" class="vector" />
+	<text y="160" x="205" class="text" >A</text>
+	<line x2="60" y2="210" y1="90" x1="150" class="vector-sum" />
+	<text y="145" x="100" class="text-sum" >-A</text>
+</svg>
Add a comment to this file

Documents/Basics/VectorPosition.svg

Added
New image
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" height="300px" width="300px" >
+	<style type="text/css" ><![CDATA[.point
+{
+	fill: #AFAFFF;
+	stroke: #AFAFFF;
+}
+
+.__axis_arrow_end1
+{
+	marker-end: url(#__axis_arrow1);
+}
+
+.text
+{
+	font-family: monospace;
+	font-weight: bold;
+	stroke: none;
+	font-size: 25px;
+	fill: #AFAFFF;
+}
+
+.__grid1
+{
+	stroke: #CCC;
+	stroke-width: 1px;
+	fill: none;
+}
+
+.__axis1
+{
+	stroke: black;
+	stroke-width: 2px;
+	fill: none;
+}]]></style>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="__axis_arrow1" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="fill_black thin" />
+		</marker>
+		<g id="g_axes" >
+			<path d="M 0 300 V 0 M 30 300 V 0 M 60 300 V 0 M 90 300 V 0 M 120 300 V 0 M 150 300 V 0 M 180 300 V 0 M 210 300 V 0 M 240 300 V 0 M 270 300 V 0 M 300 300 V 0 M 0 300 H 300 M 0 270 H 300 M 0 240 H 300 M 0 210 H 300 M 0 180 H 300 M 0 150 H 300 M 0 120 H 300 M 0 90 H 300 M 0 60 H 300 M 0 30 H 300 M 0 0 H 300" class="__grid1" />
+			<line x2="150" y2="300" y1="150" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="150" y2="0" y1="150" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="300" y2="150" y1="150" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="0" y2="150" y1="150" x1="150" class="__axis1 __axis_arrow_end1" />
+		</g>
+	</defs>
+	<use xlink:href="#g_axes" y="0" x="0" height="300" width="300" />
+	<circle r="7.5" cy="60" cx="210" class="point" />
+	<text y="48" x="215" class="text" >A</text>
+	<circle r="7.5" cy="75" cx="60" class="point" />
+	<text y="63" x="65" class="text" >B</text>
+	<circle r="7.5" cy="240" cx="165" class="point" />
+	<text y="228" x="170" class="text" >C</text>
+</svg>
Add a comment to this file

Documents/Basics/VectorScalarMult.svg

Added
New image
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" height="300px" width="300px" >
+	<style type="text/css" ><![CDATA[.arrowhead
+{
+	fill: black;
+	stroke: black;
+}
+
+.text
+{
+	font-size: 25px;
+	font-family: monospace;
+	stroke: none;
+	font-weight: bold;
+	fill: black;
+}
+
+.__axis_arrow_end1
+{
+	marker-end: url(#__axis_arrow1);
+}
+
+.vector-sum
+{
+	marker-end: url(#arrow-sum);
+	stroke: red;
+}
+
+.vector
+{
+	marker-end: url(#arrow);
+	stroke: black;
+}
+
+.text-sum
+{
+	font-size: 25px;
+	font-family: monospace;
+	stroke: none;
+	font-weight: bold;
+	fill: red;
+}
+
+.__grid1
+{
+	stroke: #CCC;
+	stroke-width: 1px;
+	fill: none;
+}
+
+.arrowhead-sum
+{
+	fill: red;
+	stroke: red;
+}
+
+.__axis1
+{
+	stroke: black;
+	stroke-width: 2px;
+	fill: none;
+}]]></style>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="__axis_arrow1" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="fill_black thin" />
+		</marker>
+		<g id="g_axes" >
+			<path d="M 0 300 V 0 M 21.428571428571 300 V 0 M 42.857142857143 300 V 0 M 64.285714285714 300 V 0 M 85.714285714286 300 V 0 M 107.14285714286 300 V 0 M 128.57142857143 300 V 0 M 150 300 V 0 M 171.42857142857 300 V 0 M 192.85714285714 300 V 0 M 214.28571428571 300 V 0 M 235.71428571429 300 V 0 M 257.14285714286 300 V 0 M 278.57142857143 300 V 0 M 300 300 V 0 M 0 300 H 300 M 0 278.57142857143 H 300 M 0 257.14285714286 H 300 M 0 235.71428571429 H 300 M 0 214.28571428571 H 300 M 0 192.85714285714 H 300 M 0 171.42857142857 H 300 M 0 150 H 300 M 0 128.57142857143 H 300 M 0 107.14285714286 H 300 M 0 85.714285714286 H 300 M 0 64.285714285714 H 300 M 0 42.857142857143 H 300 M 0 21.428571428571 H 300 M 0 0 H 300" class="__grid1" />
+			<line x2="150" y2="300" y1="235.71428571429" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="150" y2="0" y1="235.71428571429" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="300" y2="235.71428571429" y1="235.71428571429" x1="150" class="__axis1 __axis_arrow_end1" />
+			<line x2="0" y2="235.71428571429" y1="235.71428571429" x1="150" class="__axis1 __axis_arrow_end1" />
+		</g>
+	</defs>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="arrow" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="arrowhead" />
+		</marker>
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="arrow-sum" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="arrowhead-sum" />
+		</marker>
+	</defs>
+	<use xlink:href="#g_axes" y="0" x="0" height="300" width="300" />
+	<line x2="192.85714285714" y2="171.42857142857" y1="235.71428571429" x1="150" class="vector" />
+	<text y="208.57142857143" x="151.42857142857" class="text" >A</text>
+	<line x2="192.85714285714" y2="42.857142857143" y1="235.71428571429" x1="64.285714285714" class="vector-sum" />
+	<text y="134.28571428571" x="78.571428571429" class="text-sum" >3*A</text>
+	<line x2="235.71428571429" y2="203.57142857143" y1="235.71428571429" x1="214.28571428571" class="vector-sum" />
+	<text y="199.64285714286" x="218" class="text-sum" >0.5*A</text>
+</svg>
Add a comment to this file

Documents/Basics/VectorSubtraction.svg

Added
New image
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" height="300px" width="300px" >
+	<style type="text/css" ><![CDATA[.arrowhead-sum
+{
+	fill: red;
+	stroke: red;
+}
+
+.text
+{
+	font-size: 25px;
+	font-family: monospace;
+	stroke: none;
+	font-weight: bold;
+	fill: black;
+}
+
+.__axis_arrow_end1
+{
+	marker-end: url(#__axis_arrow1);
+}
+
+.__axis1
+{
+	stroke: black;
+	stroke-width: 2px;
+	fill: none;
+}
+
+.vector-sum
+{
+	marker-end: url(#arrow-sum);
+	stroke: red;
+}
+
+.vector
+{
+	marker-end: url(#arrow);
+	stroke: black;
+}
+
+.arrowhead
+{
+	fill: black;
+	stroke: black;
+}
+
+.__grid1
+{
+	stroke: #CCC;
+	stroke-width: 1px;
+	fill: none;
+}
+
+.text-sum
+{
+	font-size: 25px;
+	font-family: monospace;
+	stroke: none;
+	font-weight: bold;
+	fill: red;
+}]]></style>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="__axis_arrow1" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="fill_black thin" />
+		</marker>
+		<g id="g_axes" >
+			<path d="M 0 300 V 0 M 30 300 V 0 M 60 300 V 0 M 90 300 V 0 M 120 300 V 0 M 150 300 V 0 M 180 300 V 0 M 210 300 V 0 M 240 300 V 0 M 270 300 V 0 M 300 300 V 0 M 0 300 H 300 M 0 270 H 300 M 0 240 H 300 M 0 210 H 300 M 0 180 H 300 M 0 150 H 300 M 0 120 H 300 M 0 90 H 300 M 0 60 H 300 M 0 30 H 300 M 0 0 H 300" class="__grid1" />
+			<line x2="90" y2="300" y1="240" x1="90" class="__axis1 __axis_arrow_end1" />
+			<line x2="90" y2="0" y1="240" x1="90" class="__axis1 __axis_arrow_end1" />
+			<line x2="300" y2="240" y1="240" x1="90" class="__axis1 __axis_arrow_end1" />
+			<line x2="0" y2="240" y1="240" x1="90" class="__axis1 __axis_arrow_end1" />
+		</g>
+	</defs>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="arrow" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="arrowhead" />
+		</marker>
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="arrow-sum" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="arrowhead-sum" />
+		</marker>
+	</defs>
+	<use xlink:href="#g_axes" y="0" x="0" height="300" width="300" />
+	<line x2="150" y2="120" y1="240" x1="90" class="vector" />
+	<text y="185" x="97" class="text" >A</text>
+	<line x2="60" y2="60" y1="120" x1="150" class="vector" />
+	<text y="85" x="110" class="text" >B</text>
+	<line x2="240" y2="180" y1="120" x1="150" class="vector-sum" />
+	<text y="145" x="200" class="text-sum" >-B</text>
+	<line x2="240" y2="180" y1="240" x1="90" class="vector-sum" />
+	<text y="230" x="175" class="text-sum" >A-B</text>
+</svg>

Documents/Tools/GridAxis.lua

+
+require "vmath"
+require "SvgWriter"
+
+module(..., package.seeall);
+
+local function AddMembers(classInst, members)
+	members = members or ClassMembers;
+	for funcName, func in pairs(members) do
+		classInst[funcName] = func;
+	end
+end
+
+local ClassMembers = {}
+local axisStyleName = "__axis";
+local axisArrowStyleName = "__axis_arrow_end";
+local axisArrowUriName = "__axis_arrow";
+local gridStyleName = "__grid";
+
+local axisIndex = 1;
+
+function ClassMembers:fix(name) return name .. self.axisIndex end
+
+function ClassMembers:AddDefinitions(writer, name)
+	writer:BeginDefinitions();
+		writer:BeginMarker({10, 8}, {10, 4}, "auto", true, nil, self:fix(axisArrowUriName));
+			writer:Path(self.arrowheadPath, {"fill_black", "thin"});
+		writer:EndMarker();
+	
+		writer:BeginGroup(nil, name);
+			if(self.bGrid) then
+				writer:Path(self.gridPath, {self:fix(gridStyleName)});
+			end
+
+			for i=1, #self.axes, 2 do
+				writer:Line(self.axes[i], self.axes[i+1],
+					{self:fix(axisStyleName), self:fix(axisArrowStyleName)});
+			end
+		writer:EndGroup();
+	writer:EndDefinitions();
+end
+
+function GridAxis2D(vp, axisStyle, styleLib, bGrid, gridStyle)
+	assert(styleLib);
+	assert(vp);
+	
+	axisStyle = axisStyle or SvgWriter.Style():stroke("black"):fill("none"):stroke_width("2px");
+	gridStyle = gridStyle or SvgWriter.Style():stroke("#CCC"):fill("none"):stroke_width("1px");
+	
+	local axisGridObj = {};
+	axisGridObj.axisIndex = axisIndex;
+	axisGridObj.bGrid = bGrid;
+	axisIndex = axisIndex + 1;
+	
+	styleLib:AddStyle(nil, axisStyleName .. axisGridObj.axisIndex, axisStyle);
+	styleLib:AddStyle(nil, axisArrowStyleName .. axisGridObj.axisIndex,
+		SvgWriter.Style():marker_end(
+			SvgWriter.uriLocalElement(axisArrowUriName .. axisGridObj.axisIndex)));
+
+	--Create the axis path.
+	local upperBound, lowerBound = vp:Extents();
+	local axes = {}
+
+	if(lowerBound[2] < 0) then
+		axes[#axes + 1] = vmath.vec2(0, 0);
+		axes[#axes + 1] = vmath.vec2(0, lowerBound[2]);
+	end
+	if(upperBound[2] > 0) then
+		axes[#axes + 1] = vmath.vec2(0, 0);
+		axes[#axes + 1] = vmath.vec2(0, upperBound[2]);
+	end
+	if(upperBound[1] > 0) then
+		axes[#axes + 1] = vmath.vec2(0, 0);
+		axes[#axes + 1] = vmath.vec2(upperBound[1], 0);
+	end
+	if(lowerBound[1] < 0) then
+		axes[#axes + 1] = vmath.vec2(0, 0);
+		axes[#axes + 1] = vmath.vec2(lowerBound[1], 0);
+	end
+
+	axes = vp:Transform(axes);
+	
+	axisGridObj.axes = axes;
+	
+	--Create arrowhead paths
+	local arrowheadPath = SvgWriter.Path();
+	arrowheadPath:M{10, 4}:L{0, 0}:L{0, 8}:Z();
+	axisGridObj.arrowheadPath = arrowheadPath;
+	
+	--Create grid path, if needed.
+	if(bGrid) then
+		styleLib:AddStyle(nil, gridStyleName .. axisGridObj.axisIndex, gridStyle);
+		
+		local gridPath = SvgWriter.Path();
+
+		--Vertical lines.
+		for i = lowerBound[1], upperBound[1] do
+			local points =
+			{
+				vmath.vec2(i, lowerBound[2]);
+				vmath.vec2(i, upperBound[2]);
+			};
+			
+			points = vp:Transform(points)
+			gridPath:M(points[1]):V(points[2][2]);
+		end
+
+		--Horizontal lines.
+		for i = lowerBound[2], upperBound[2] do
+			local points =
+			{
+				vmath.vec2(lowerBound[1], i);
+				vmath.vec2(upperBound[1], i);
+			};
+			
+			points = vp:Transform(points)
+			gridPath:M(points[1]):H(points[2][1]);
+		end
+		
+		axisGridObj.gridPath = gridPath;
+	end
+	
+	AddMembers(axisGridObj, ClassMembers);
+	return axisGridObj;
+end
+

Documents/Tools/_utils.lua

+
+
+function ConstructSVGName(scriptName, suffix)
+	local filename = scriptName:match("Gen(.*)%.lua");
+	if(suffix) then
+		return filename .. suffix .. ".svg";
+	end
+	return filename .. ".svg";
+end
+
+function StandardArrowheadPath()
+	local arrowheadPath = SvgWriter.Path();
+	arrowheadPath:M{10, 4}:L{0, 0}:L{0, 8}:Z();
+	return arrowheadPath;
+end
+
+function WriteStandardArrowhead(writer, name, styles)
+	writer:BeginMarker({10, 8}, {10, 4}, "auto", true, nil, name);
+		writer:Path(StandardArrowheadPath(), styles);
+	writer:EndMarker();
+end
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.