LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rotating coordinates by 270 degree

Hello 🙂 I'm trying to use mouse coordinates to draw on XY graph 270 degrees. Meaning if i move my mouse to the left, the graph will draw upwards, if i move my mouse to the right, it will draw downwards

 

I found this online : https://decibel.ni.com/content/docs/DOC-11437

 

and implemented on my VI, but i can't seems to get it working. (Originally, it can draw fine, but after adding the rotation, it doesn't draw anymore) Attached is my original VI and also the edited VI. Can someone helped me to troubleshoot?

 

 

 

Download All
0 Kudos
Message 1 of 4
(2,694 Views)

It is drawing.  It is just not within the scale of your graph.  Here are some tweaks I made.

  1. Expand the scale of the graph to have the positive and negative.
  2. Read the initial location of the mouse.  You then subtract this location with each read.  This will make your first data point the at the origin (0,0).
  3. No need for the shift cartesian.  Remove those.
  4. Multiply the elements by your scale before adding them to the arrays.  This will save you many many multiplies versus multiplying over the whole array.
  5. 270 degrees is -pi/2.  Your default theta was set to pi/2.

I also did some general cleaning up.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(2,678 Views)

Thanks for that, but is it possible to not have negative scale but achieving the similar results?

 

By The way, Thanks for helping me to clean up, my Technical Officer has been complaining about my programming which is extremely messy!

0 Kudos
Message 3 of 4
(2,658 Views)

And regarding your point number 2, i don't get how the looping reads minus the initial reads will get me a starting point of (0,0)

0 Kudos
Message 4 of 4
(2,650 Views)