Length of Horizontal or Vertical Line Segments
2015-01-17 14:12
This GeoGebra applet demonstrates how to calculate the length of horizontal or vertical line segments. By constructing segment AB and its midpoint M, it visually illustrates the geometric meaning and algebraic calculation of distances in a Cartesian coordinate system. It is ideal for beginners learning coordinate geometry.
In collections
Secondary 1 Coordinate Geometry
<?xml version="1.0" encoding="utf-8"?>
<geogebra format="5.0" version="5.0.341.0" id="6cf1d19c-a615-41cc-9097-804866eea1a0" xsi:noNamespaceSchemaLocation="http://www.geogebra.org/ggb.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<gui>
<window width="960" height="660" />
<perspectives>
<perspective id="tmp">
<panes>
<pane location="" divider="0.22727272727272727" orientation="0" />
</panes>
<views>
<view id="4" toolbar="0 59 || 2020 , 2021 , 2022 , 66 || 2001 , 2003 , 2002 , 2004 , 2005 || 2040 , 2041 , 2042 , 2044 , 2043" visible="false" inframe="false" stylebar="true" location="2,2" size="200" window="0,0,400,400" />
<view id="1" visible="true" inframe="false" stylebar="false" location="2" size="500" window="0,0,400,400" />
<view id="2" visible="false" inframe="false" stylebar="true" location="1" size="652" window="0,0,200,400" />
<view id="8" toolbar="1001 | 1002 | 1003 || 1005 | 1004 || 1006 | 1007 | 1010 || 1008 1009 || 66 68 || 6" visible="false" inframe="false" stylebar="false" location="1" size="150" window="50,50,500,500" />
<view id="16" visible="true" inframe="false" stylebar="false" location="0" size="150" window="50,50,500,500" />
<view id="32" visible="false" inframe="false" stylebar="true" location="1" size="150" window="50,50,500,500" />
<view id="64" toolbar="0" visible="false" inframe="true" stylebar="true" location="1" size="150" window="50,50,500,500" />
<view id="128" visible="false" inframe="true" stylebar="false" location="1" size="480" window="50,50,500,500" />
<view id="4097" visible="false" inframe="true" stylebar="true" location="1" size="150" window="50,63,1102,653" />
<view id="70" toolbar="0 || 2020 || 2021 || 2022" visible="false" inframe="true" stylebar="true" location="1" size="150" window="50,50,500,500" />
<view id="43" visible="false" inframe="false" stylebar="false" location="1" size="450" window="50,50,500,500" />
<view id="512" toolbar="0 | 1 501 5 19 , 67 | 2 15 45 18 , 7 37 | 514 3 9 , 13 44 , 47 | 16 | 551 550 11 , 22 , 23 , 55 56 57 , 12 | 69 | 510 511 , 512 513 | 533 531 , 534 532 , 522 523 , 537 536 , 535 | 521 520 | 36 , 38 49 560 | 571 30 29 570 31 33 | 17 | 540 40 41 42 , 27 28 35 , 6 , 502" visible="false" inframe="false" stylebar="false" location="1" size="300" window="50,50,500,500" />
</views>
<toolbar show="false" items="0 39 59 | 1 501 67 , 5 19 , 72 | 2 15 45 , 18 65 , 7 37 | 4 3 8 9 , 13 44 , 58 , 47 | 16 51 64 , 70 | 10 34 53 11 , 24 20 22 , 21 23 | 55 56 57 , 12 | 36 46 , 38 49 50 , 71 | 30 29 54 32 31 33 | 17 26 62 73 , 14 66 68 | 25 52 60 61 | 40 41 42 , 27 28 35 , 6" position="7" help="false" />
<input show="false" cmd="true" top="false" />
<dockBar show="false" east="false" />
</perspective>
</perspectives>
<labelingStyle val="2"/>
<font size="24"/>
</gui>
<euclidianView>
<viewNumber viewNo="1"/>
<size width="958" height="500"/>
<coordSystem xZero="536.5" yZero="218.5" scale="38.76176519377516" yscale="38.76176519377516"/>
<evSettings axes="true" grid="true" gridIsBold="true" pointCapturing="2" rightAngleStyle="1" checkboxSize="26" gridType="0"/>
<bgColor r="255" g="255" b="255"/>
<axesColor r="0" g="153" b="204"/>
<gridColor r="192" g="192" b="192"/>
<lineStyle axes="3" grid="0"/>
<axis id="0" show="true" label="x" unitLabel="" tickStyle="1" showNumbers="true" tickDistance="1" tickExpression=""/>
<axis id="1" show="true" label="y" unitLabel="" tickStyle="1" showNumbers="true" tickDistance="1" tickExpression=""/>
<grid distX="1" distY="1" distTheta="0.5235987755982988"/>
</euclidianView>
<euclidianView>
<viewNumber viewNo="2"/>
<size width="958" height="150"/>
<coordSystem xZero="215" yZero="314.9999999999974" scale="49.99999999999999" yscale="49.99999999999954"/>
<evSettings axes="false" grid="false" gridIsBold="false" pointCapturing="3" rightAngleStyle="1" checkboxSize="26" gridType="0"/>
<bgColor r="255" g="255" b="153"/>
<axesColor r="0" g="0" b="0"/>
<gridColor r="192" g="192" b="192"/>
<lineStyle axes="1" grid="10"/>
<axis id="0" show="false" label="" unitLabel="" tickStyle="1" showNumbers="true"/>
<axis id="1" show="false" label="" unitLabel="" tickStyle="1" showNumbers="true"/>
</euclidianView>
<kernel>
<continuous val="false"/>
<usePathAndRegionParameters val="true"/>
<decimals val="2"/>
<angleUnit val="degree"/>
<algebraStyle val="0" spreadsheet="0"/>
<coordStyle val="0"/>
</kernel>
<scripting blocked="false" disabled="false"/>
<construction title="" author="CMF" date="">
<element type="point" label="A">
<show object="true" label="true" ev="4"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelOffset x="13" y="8"/>
<labelMode val="2"/>
<animation step="0.1" speed="1" type="0" playing="false"/>
<isShape val="false"/>
<coords x="-6" y="-2" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<element type="point" label="B">
<show object="true" label="true" ev="4"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelOffset x="10" y="9"/>
<labelMode val="2"/>
<animation step="0.1" speed="1" type="0" playing="false"/>
<isShape val="false"/>
<coords x="-6" y="5" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<command name="Segment">
<input a0="A" a1="B"/>
<output a0="AB"/>
</command>
<element type="segment" label="AB">
<show object="true" label="false" ev="4"/>
<condition showObject="(x(A) ≟ x(B) ∨ y(A) ≟ y(B)) ∧ (A ≠ B)"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelOffset x="-1" y="5"/>
<labelMode val="2"/>
<selectionAllowed val="false"/>
<isShape val="false"/>
<coords x="-7" y="0" z="-42"/>
<lineStyle thickness="9" type="0" typeHidden="1"/>
<eqnStyle style="implicit"/>
<outlyingIntersections val="false"/>
<keepTypeOnTransform val="true"/>
</element>
<command name="Midpoint">
<input a0="AB"/>
<output a0="M"/>
</command>
<element type="point" label="M">
<show object="false" label="false"/>
<objColor r="64" g="64" b="64" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<isShape val="false"/>
<coords x="-6" y="1.5" z="1"/>
<pointSize val="3"/>
<pointStyle val="0"/>
</element>
<command name="Segment">
<input a0="A" a1="B"/>
<output a0="a"/>
</command>
<element type="segment" label="a">
<show object="true" label="true"/>
<condition showObject="(x(A) ≠ x(B)) ∧ (y(A) ≠ y(B))"/>
<objColor r="0" g="0" b="255" alpha="0"/>
<layer val="0"/>
<labelMode val="3"/>
<selectionAllowed val="false"/>
<isShape val="false"/>
<coords x="-7" y="0" z="-42"/>
<lineStyle thickness="1" type="0" typeHidden="1"/>
<eqnStyle style="implicit"/>
<outlyingIntersections val="false"/>
<keepTypeOnTransform val="true"/>
<caption val="?"/>
</element>
<element type="boolean" label="showLen">
<value val="false"/>
<show object="true" label="false" ev="3"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelOffset x="13" y="21"/>
<labelMode val="0"/>
<checkbox fixed="true"/>
</element>
<element type="boolean" label="showGrid">
<value val="true"/>
<show object="true" label="true" ev="3"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelOffset x="761" y="19"/>
<labelMode val="3"/>
<checkbox fixed="true"/>
<ggbscript onUpdate="ShowGrid[1,showGrid]"/>
<caption val="Show grids"/>
</element>
<expression label="text2" exp=""(" + (LaTeX[x(A)]) + ") - (" + (LaTeX[x(B)]) + ") = " + (LaTeX[x(A) - x(B)]) + """ />
<element type="text" label="text2">
<show object="true" label="true"/>
<condition showObject="(x(A) > x(B)) ∧ y(A) ≟ y(B) ∧ showLen"/>
<objColor r="0" g="0" b="255" alpha="0"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<layer val="0"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1.4" size="10" style="0"/>
<startPoint exp="M"/>
<labelOffset x="-76" y="25"/>
</element>
<expression label="text4" exp=""(" + (LaTeX[y(B)]) + ") - (" + (LaTeX[y(A)]) + ") = " + (LaTeX[y(B) - y(A)]) + """ />
<element type="text" label="text4">
<show object="true" label="true" ev="4"/>
<condition showObject="(y(B) > y(A)) ∧ x(A) ≟ x(B) ∧ showLen"/>
<objColor r="0" g="0" b="255" alpha="0"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<layer val="0"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1.4" size="10" style="0"/>
<startPoint exp="M"/>
<labelOffset x="13" y="-30"/>
</element>
<element type="numeric" label="lang">
<value val="2"/>
<symbolic val="true" />
<show object="false" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.10000000149011612"/>
<layer val="3"/>
<labelMode val="2"/>
<animation step="1" speed="1" type="0" playing="false"/>
</element>
<element type="button" label="button0">
<show object="true" label="true" ev="3"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="3"/>
<labelOffset x="767" y="92"/>
<labelMode val="3"/>
<fixed val="true"/>
<isShape val="false"/>
<auxiliary val="true"/>
<ggbscript val="SetValue[lang,If[lang==1,2,1]] RunClickScript[buttonLang] "/>
<font serif="false" sizeM="1.4" size="10" style="0"/>
<caption val="中文"/>
</element>
<element type="button" label="buttonLang">
<show object="false" label="true" ev="3"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="3"/>
<labelOffset x="823" y="70"/>
<labelMode val="0"/>
<fixed val="true"/>
<isShape val="false"/>
<auxiliary val="true"/>
<ggbscript val="SetCaption[button0,If[lang==1,"ENG","中文"]] SetCaption[showGrid,If[lang==1,"顯示格線","Show grids"]]"/>
<font serif="false" sizeM="1.4" size="10" style="0"/>
</element>
<expression label="text3" exp=""(" + (LaTeX[y(A)]) + ") - (" + (LaTeX[y(B)]) + ") = \bold{" + (LaTeX[y(A) - y(B)]) + "}"" />
<element type="text" label="text3">
<show object="true" label="true" ev="4"/>
<condition showObject="(y(A) > y(B)) ∧ x(A) ≟ x(B) ∧ showLen"/>
<objColor r="0" g="0" b="255" alpha="0"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<layer val="0"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1.4" size="10" style="0"/>
<startPoint exp="M"/>
<labelOffset x="15" y="-49"/>
</element>
<expression label="text1" exp=""(" + (LaTeX[x(B)]) + ") - (" + (LaTeX[x(A)]) + ") = \bold{" + (LaTeX[x(B) - x(A)]) + "}"" />
<element type="text" label="text1">
<show object="true" label="true" ev="4"/>
<condition showObject="(x(B) > x(A)) ∧ y(A) ≟ y(B) ∧ showLen"/>
<objColor r="0" g="0" b="255" alpha="0"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<layer val="0"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1.4" size="10" style="0"/>
<startPoint exp="M"/>
<labelOffset x="-79" y="11"/>
</element>
<expression label="textLength" exp=""\text{兩點之間的距離(" + (LaTeX[If[y(A) ≟ y(B), "\blue{水平}", If[x(A) ≟ x(B), "\blue{鉛垂}", ""]]]) + "線段的長度)}\\ \vspace{30}=\blue{ " + (LaTeX[If[showLen, If[y(A) ≟ y(B) ∨ x(A) ≟ x(B), Text[AB], "?"], ""]]) + "}"" />
<element type="text" label="textLength">
<show object="false" label="false" ev="11"/>
<condition showObject="(A ≠ B) ∧ lang ≟ 1"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1.4" size="10" style="0"/>
<absoluteScreenLocation x="53" y="16"/>
</element>
<expression label="textENG" exp=""\text{Distance between the two points\\ (Length of the " + (LaTeX[If[y(A) ≟ y(B), "\blue{horizontal\;}", If[x(A) ≟ x(B), "\blue{vertical\;}", ""]]]) + "line segment) }\\ \vspace{30}= \blue{" + (LaTeX[If[showLen, If[y(A) ≟ y(B) ∨ x(A) ≟ x(B), Text[AB], "?"], ""]]) + "}"" />
<element type="text" label="textENG">
<show object="true" label="false" ev="11"/>
<condition showObject="(A ≠ B) ∧ (lang ≠ 1)"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1.2" size="5" style="0"/>
<absoluteScreenLocation x="57" y="16"/>
</element>
</construction>
</geogebra>