# How to make one dimension line with Position and vector?

Math123 shared this question 2 years ago

How to make one dimension line in which i can define position x1 = (2) [Not (2,1) etc..] and vector also v = <2> [not <2,0> etc].

I think with study of this sample you can make other applications with one dimensional vectors and with variable captions.

1

Pls see attached.

1

This solution works with

1. caption and modification this caption with script.
2. A point-List depending on Corner(1) and Corner(2) for the Positions of the Vector-Point (A and B)

Problem to point 1. (I think it's a GGB-Bug):

The script command "UpdateConstruction()" works not in PrefixLabel onUpdate: the scripts in A and B are not updated.

Workaround: instead of UpdateConstruction() the script in the Objects with modified Labels in captions are run in a Execute. For this exist the list Labels

.

Problem to point 2. (I think this are one or 2 (old) bugs)

In the Initial-Time the list with the points is created after the points A and B are set to the list.

and after the function ggbOnInit() in global JS

Workaround for both problems:

In the function ggbOnInit() in global JS a slider is set to 0 and then he is animated (once). If the animation is at the end then the Position of A and B is set with GGB-Script.

Note:

• it's possible to modify the steps of point-list l1
• it's possible to modify the permitted range of points in l1 for B
• to change the constants for labels see script in the object
• to add or delete dynamic label: add/delete script in the object and change the list "Labels"

Now I see there is a bug when moving xAxis: I will send a new version

1

Version 02

1

Much improved version 03

• no problems with initial
• significantly less and more clear scripts

.

.PS: best regards to mathmagic by using DynamicCoordinates() instead of scripts

1

Many thanks to rami and mathmagic. It is really a good work. Dear both i want this backward too. x_2 - x_1 = -ve

2

I think with study of this sample you can make other applications with one dimensional vectors and with variable captions.

1

All the very best rami.