LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I move one co-ordinate to the other on X-Y Graph?

Hello Everyone,

 

 

Let's say first co-ordinate is (5, 5), I want to move this pixel on this X-Y graph to (10, 5); how can I do it?

 

I know that I need to increase it slowly by step of one towards the right on x-axis, but how can I do it with it showing every step and ending up at (10, 5)?

 

For example:

 

First Step

o   <----- pixel

 

Second Step

  o

 

Third Step

      o

 

etc..... till final step at (10, 5).

 


Thanks in advance for helping!

0 Kudos
Message 1 of 16
(3,570 Views)

Hi jqlee,

 

you just have to add 5 to its X coordinate, then plot again...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 16
(3,562 Views)

If you want to show the pixel moving, not just the start/end points.  you will have to utilize a loop where you add one each time (or a fraction for a smoother movement) and a wait timer to ensure enough time elapses for the user to view the change.

Message 3 of 16
(3,547 Views)

x=xstart+frac*(xend-xstart)

y=ystart+frac*(yend-ystart)

 

frac=fraction of the way between start point and end point, 0->1.

 

frac=(current time-start stime)/(end time-start time)

 

loop over time in small increments.

 

Message 4 of 16
(3,544 Views)

Thanks everyone for helping!

 

I am able to reach the end point of my second co-ordinate, however now I wish it to move down the Y-axis after it reaches the end of second co-ordinate.

 

I used a case structure however it is giving me a hard time (also because I am unfamiliar with it).

 

Is there any simpler methods other than case structure? If not, how do I use it to continue the flow down the Y-axis please?

0 Kudos
Message 5 of 16
(3,509 Views)

Hi jqlee,

 

either use a (more general) state machine approach or some modulo math involving Quotient&Remainder...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 16
(3,504 Views)

Thanks for your reply, GerdW!

 

Let's say if I want to just allow the user to choose the four corners of a rectangle, and then for the pixel to show one at a time and end back at the initial point; should I use Enum, Boolean or Numerical case?

0 Kudos
Message 7 of 16
(3,499 Views)

Hi jqlee,

 

you don't need any case structure at all. You need an array of points and a FOR loop to iterate over the array...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 16
(3,492 Views)

REALLY?! If that is true, I will be so so happy!!!

I will building all four directions now and I will try your solution!

 

Thanks for your post!

0 Kudos
Message 9 of 16
(3,490 Views)

Let's say for my .vi as shown below, what can I do for the "N" at the top left corner for the pixel to complete a round; repeating the cycle again and again if possible?

 

Capture.JPG

 

Thanks!

0 Kudos
Message 10 of 16
(3,485 Views)