Difference between revisions of "Distance Command"
From GeoGebra Manual
(command syntax: changed [ ] into ( )) |
|||
Line 1: | Line 1: | ||
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|geometry}} | <noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|geometry}} | ||
;Distance( <Point>, <Object> ): Yields the shortest distance between a point and an object. | ;Distance( <Point>, <Object> ): Yields the shortest distance between a point and an object. | ||
− | :{{ | + | :{{examples|1=<div> |
− | : {{Note| 1=The command works for points, segments, lines, conics, functions and implicit curves. For functions it uses a numerical algorithm which works better for polynomials. | + | :*<code><nowiki> Distance((2, 1), x^2 + (y - 1)^2 = 1)</nowiki></code> yields ''1'' |
− | ::{{example|Let ''f'' be a function and ''A'' be a point. <code><nowiki>Distance(A, f)</nowiki></code> yields the distance between ''A'' and ''(x(A), f(x(A)))''.}} | + | :*<code><nowiki>Distance((2, 1, 2), (1, 3, 0))</nowiki> </code> yields ''3''</div>}} |
+ | : {{Note| 1=The command works for points, segments, lines, conics, functions, and implicit curves. For functions, it uses a numerical algorithm which works better for polynomials. | ||
+ | ::{{example|Let ''f'' be a function and ''A'' be a point. <code><nowiki>Distance(A, f)</nowiki></code> yields the distance between ''A'' and <div> ''(x(A), f(x(A)))''.}} | ||
}} | }} | ||
<br> | <br> | ||
+ | |||
;Distance( <Line>, <Line> ): Yields the distance between two lines. | ;Distance( <Line>, <Line> ): Yields the distance between two lines. | ||
:{{examples|1=<div> | :{{examples|1=<div> | ||
:*<code><nowiki>Distance(y = x + 3, y = x + 1)</nowiki></code> yields ''1.41'' | :*<code><nowiki>Distance(y = x + 3, y = x + 1)</nowiki></code> yields ''1.41'' | ||
− | :*<code><nowiki>Distance(y = 3x + 1, y = x + 1)</nowiki></code> yields ''0''</div>}} | + | :*<code><nowiki>Distance(y = 3x + 1, y = x + 1)</nowiki></code> yields ''0'' |
+ | :* Let ''a: X = (-4, 0, 0) + λ*(4, 3, 0)'' and ''b: X = (0, 0, 0) + λ*(0.8, 0.6, 0)''. <code><nowiki>Distance(a, b)</nowiki></code> yields ''2.4''</div>}} | ||
: {{Note| 1=The distance between intersecting lines is ''0''. Thus, this command is only interesting for parallel lines.}} | : {{Note| 1=The distance between intersecting lines is ''0''. Thus, this command is only interesting for parallel lines.}} | ||
Line 15: | Line 19: | ||
− | + | ;Distance( <Plane>, <Plane> ) | |
− | ;Distance( < | + | : Yields the distance between the two planes. |
− | : Yields the distance between the two | + | :{{example|1=Let ''eq1: x + y 2x = 1'' and ''eq2: 2x + 2y +4z = -2''. <code><nowiki>Distance(eq1, eq2)</nowiki></code> yields ''0.82''}} |
− | + | : {{Note| 1=The distance between intersecting planes is 0. Thus, this command is only meaningful for parallel planes.}} | |
− | |||
− | |||
− | :{{example|1=Let '' |
Revision as of 11:05, 16 December 2022
- Distance( <Point>, <Object> )
- Yields the shortest distance between a point and an object.
- Examples:
Distance((2, 1), x^2 + (y - 1)^2 = 1)
yields 1Distance((2, 1, 2), (1, 3, 0))
yields 3
- Note: The command works for points, segments, lines, conics, functions, and implicit curves. For functions, it uses a numerical algorithm which works better for polynomials.
- Example: Let f be a function and A be a point.
Distance(A, f)
yields the distance between A and(x(A), f(x(A))).
- Distance( <Line>, <Line> )
- Yields the distance between two lines.
- Examples:
Distance(y = x + 3, y = x + 1)
yields 1.41Distance(y = 3x + 1, y = x + 1)
yields 0- Let a: X = (-4, 0, 0) + λ*(4, 3, 0) and b: X = (0, 0, 0) + λ*(0.8, 0.6, 0).
Distance(a, b)
yields 2.4
- Note: The distance between intersecting lines is 0. Thus, this command is only interesting for parallel lines.
Note: See also Distance or Length tool .
- Distance( <Plane>, <Plane> )
- Yields the distance between the two planes.
- Example: Let eq1: x + y 2x = 1 and eq2: 2x + 2y +4z = -2.
Distance(eq1, eq2)
yields 0.82
- Note: The distance between intersecting planes is 0. Thus, this command is only meaningful for parallel planes.