“DynamicCoordinates 指令”的版本间的差异

来自GeoGebra Manual
跳转至: 导航搜索
第8行: 第8行:
  
 
{{Example|1=只會在「格子點」上跳動的動點:<br />
 
{{Example|1=只會在「格子點」上跳動的動點:<br />
指令 <code>B = DynamicCoordinates[A, round(x(A)), round(y(A))]</code> <br />
+
: <code>B = DynamicCoordinates[A, round(x(A)), round(y(A))]</code> <br />
 
 可以讓 B 點只在「格子點」上跳動。當你「拖曳 ''B'' 點」時(事實上,你拖曳的是 A 點),而且我們假設你將 A 點拖曳到 (1.3, 2.1),這時 B 點會出現在 (1, 2)。
 
 可以讓 B 點只在「格子點」上跳動。當你「拖曳 ''B'' 點」時(事實上,你拖曳的是 A 點),而且我們假設你將 A 點拖曳到 (1.3, 2.1),這時 B 點會出現在 (1, 2)。
 
}}
 
}}
第14行: 第14行:
  
 
{{Example|1=只會在 sin(x) 函數下方的點:<br />
 
{{Example|1=只會在 sin(x) 函數下方的點:<br />
<code>B = DynamicCoordinates[A, x(A), min(y(A),sin(x(A)))]</code>
+
: <code>B = DynamicCoordinates[A, x(A), min(y(A),sin(x(A)))]</code>
 
}}
 
}}
{{Hint|這個範例也可以用指令 PointIn[ y<sin(x) ] 來達成。}}
+
{{Hint|這個範例也可以用指令 {{CmdLink|PointIn}}[ y<sin(x) ] 來達成。}}
  
 
{{Example|1=<div>
 
{{Example|1=<div>

2012年6月23日 (六) 19:18的版本

Accessories dictionary.png
本页为官方文件,一般使用者无法修改,若有任何误谬,请与官方联络。如欲编辑,请至本页的开放版


UnderConstruction.png
目前本页中文说明尚未翻译完成,请先连至英文说明。如果您有权限,请帮忙翻译本页的官方手册
DynamicCoordinates[ 点 A, x 座标, y 座标 ]
这个指令会产生一个与 A 点有关的新点,其座标为 (x, y)。这种新点的怪异之处在于:“当我们以为用鼠标在拖曳此点时,事实上背后被拖曳的点是 A 点!”。为何么要这么做呢?因为这样做时,我们可以利用背后被拖曳的 A 点座标来计算这种点的 (x, y) 座标,因此虽然这种点并非自由点,但却造成可以任意拖曳它的假象,这样的特性,非常适用在某些特殊场合。
Note 提示: 当利用这种点时,最好把 A 点隐藏起来。另外,这种点的 x, y 座标中,至少要有一个是由 A 点算出来的。


范例: 只会在“格子点”上跳动的动点:
B = DynamicCoordinates[A, round(x(A)), round(y(A))]
可以让 B 点只在“格子点”上跳动。当你“拖曳 B 点”时(事实上,你拖曳的是 A 点),而且我们假设你将 A 点拖曳到 (1.3, 2.1),这时 B 点会出现在 (1, 2)。


范例: 只会在 sin(x) 函数下方的点:
B = DynamicCoordinates[A, x(A), min(y(A),sin(x(A)))]
Note 提示: 这个范例也可以用指令 PointIn[ y<sin(x) ] 来达成。


范例:
  • The following examples show other ways to restrain the positions of a point C: let A=Point[xAxis] and B=Point[xAxis]. Now type in the Input bar: DynamicCoordinates[B, Min[x(B),x(A)],0] , and press the Enter key, SetVisibleInView[B, 1, false], and press the Enter key, SetLayer[C, 1], and press the Enter key. Now, C cannot be moved to the right of A.
  • Define A=(1,2). Now, type in the Input bar: SetVisibleInView[A, 1, false] and press the Enter key, B=DynamicCoordinates[A, If[x(A) > 3, 3, If[x(A) < -(3), -3, If[x(A)< 0, round(x(A)), x(A)]]], If[x(A) < 0, 0.5, If[y(A) > 2, 2, If[y(A) <0, 0, y(A)]]]], and press the Enter key.
  • This example makes A a sticky point when a point C is dragged near it. Define A=(1,2) and B=(2,3). Now, type in the Input bar: SetVisibleInView[B, 1, false] and press the Enter key, C=DynamicCoordinates[B, If[Distance[A, B] < 1, x(A), x(B)], If[Distance[A, B] < 1, y(A), y(B)]].


© 2024 International GeoGebra Institute