# Difference between revisions of "DynamicCoordinates Command"

From GeoGebra Manual

(command syntax: changed [ ] into ( )) |
|||

(23 intermediate revisions by 7 users not shown) | |||

Line 1: | Line 1: | ||

− | <noinclude>{{Manual Page|version= | + | <noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|geogebra}} |

− | {{command|geogebra}} | + | ;DynamicCoordinates( <Point>, <x-Coordinate>, <y-Coordinate> ) |

− | ;DynamicCoordinates | + | :Creates a new point with given coordinates: this point is dependent, but can be moved. Whenever you try to move the new point to coordinates (x, y), the given point is moved there and coordinates for the new point are calculated. Works best if the given point is not [[Object Properties#Visibility|visible]] and dragging is done with the mouse. At least one of the given coordinates should depend on the given point. |

− | : | ||

− | {{ | + | {{Examples|1=<div> |

− | * B=DynamicCoordinates | + | *Let ''A'' be a point and <code>B = DynamicCoordinates(A, round(x(A)), round(y(A)))</code>. When you try to move ''B'' to (1.3, 2.1) using the [[File:Mode move.svg|link=|20px]][[Move Tool]], point ''A'' becomes (1.3, 2.1) and ''B'' appears at (1,2). |

+ | *<code>B = DynamicCoordinates(A, x(A), min(y(A), sin(x(A))))</code> creates a point under sin(x). | ||

+ | :{{note|1=<code>PointIn(y < sin(x))</code> is the easier solution in this case.}} | ||

+ | |||

+ | |||

+ | The following examples show other ways to restrain the positions of a point ''C'': | ||

+ | *Let <code>A = Point(xAxis)</code> and <code>B = Point(xAxis)</code>. | ||

+ | :Now type in the [[Input Bar]]: | ||

+ | :<code>DynamicCoordinates(B, Min(x(B), x(A)), 0)</code> and press {{KeyCode|Enter}} | ||

+ | :<code>SetVisibleInView(B, 1, false)</code> and press {{KeyCode|Enter}} | ||

+ | :<code>SetLayer(C, 1)</code> and press {{KeyCode|Enter}} | ||

+ | :Now, ''C'' cannot be moved to the right of ''A''. | ||

+ | *Define <code>A=(1, 2)</code>. | ||

+ | :Now, type in the [[Input Bar]]: | ||

+ | :<code>SetVisibleInView(A, 1, false)</code> and press {{KeyCode|Enter}} | ||

+ | :<code>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)))))</code> and press {{KeyCode|Enter}} | ||

+ | *This example makes ''A'' a sticky point when a point ''C'' is dragged near it. Define <code>A = (1, 2)</code> and <code>B = (2, 3)</code>. | ||

+ | :Now, type in the [[Input Bar]]: | ||

+ | :<code>SetVisibleInView(B, 1, false)</code> and press {{KeyCode|Enter}} | ||

+ | :<code>C = DynamicCoordinates(B, If(Distance(A, B) < 1, x(A), x(B)), If(Distance(A, B) < 1, y(A), y(B)))</code>.</div>}} | ||

+ | |||

+ | ;DynamicCoordinates( <Point>, <x-Coordinate>, <y-Coordinate>, <z-Coordinate> ) | ||

+ | :Creates a new 3D point with given coordinates: this point is dependent, but can be moved. Whenever you try to move the new point to coordinates (x, y, z), the given point is moved there and coordinates for the new point are calculated. Works best if the given point is not [[Object Properties#Visibility|visible]] and dragging is done with the mouse. At least one of the given coordinates should depend on the given point. |

## Latest revision as of 18:13, 30 September 2017

- DynamicCoordinates( <Point>, <x-Coordinate>, <y-Coordinate> )
- Creates a new point with given coordinates: this point is dependent, but can be moved. Whenever you try to move the new point to coordinates (x, y), the given point is moved there and coordinates for the new point are calculated. Works best if the given point is not visible and dragging is done with the mouse. At least one of the given coordinates should depend on the given point.

**Examples:**

- Let
*A*be a point and`B = DynamicCoordinates(A, round(x(A)), round(y(A)))`

. When you try to move*B*to (1.3, 2.1) using the Move Tool, point*A*becomes (1.3, 2.1) and*B*appears at (1,2). `B = DynamicCoordinates(A, x(A), min(y(A), sin(x(A))))`

creates a point under sin(x).

**Note:**`PointIn(y < sin(x))`

is the easier solution in this case.

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 Enter`SetVisibleInView(B, 1, false)`

and press Enter`SetLayer(C, 1)`

and press Enter- 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 Enter`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 Enter

- 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 Enter`C = DynamicCoordinates(B, If(Distance(A, B) < 1, x(A), x(B)), If(Distance(A, B) < 1, y(A), y(B)))`

.

- DynamicCoordinates( <Point>, <x-Coordinate>, <y-Coordinate>, <z-Coordinate> )
- Creates a new 3D point with given coordinates: this point is dependent, but can be moved. Whenever you try to move the new point to coordinates (x, y, z), the given point is moved there and coordinates for the new point are calculated. Works best if the given point is not visible and dragging is done with the mouse. At least one of the given coordinates should depend on the given point.