09-25-2019 01:49 AM - edited 09-25-2019 01:56 AM
I have a rectangle that yellow and red lines create. I want to rotate this box in any direction, is that possible?
09-25-2019 02:10 AM
Check out if there is any option called transpose in your graph !!
09-25-2019 03:03 AM
Do you want to rotate the data enclosed in the box or do you want to rotate the lines, selecting a rectangle that is not aligned with the axes?
Cursors cannot have arbitrary angles, but you can use the plot images tools to draw any lines you want. (Start here)
09-25-2019 11:28 AM - edited 09-28-2019 11:32 AM
So, looking at this it seems you want to graph the data of an arbitrarily rotated rectangle on the top graph. Using the plot images overlay, you can draw a box and using mouse downe/move, etc. events (or external controls) you can manipulate its position and angle. You still have the problem that the pixels form a rectangular grid, so for rotations that are not quantized to right angles, you need to do e.g. a bilinear interpolations.
In the meantime, simplify your code. Do the cursors change during the run? If not, all the cursor math (except the subset) belong before the loop. Index array is resizeable., unbundle by name is resizeable, etc.
Here's a literal simplification of your code. Think about taking the cursor math before the loop, though.
Of course it is not efficient to read and process each file twice in a row, so here's what you could do instead:
09-25-2019 03:38 PM - edited 09-25-2019 03:39 PM
@altenbach wrote:
So, looking at this it seems you want to graph the data of an arbitrarily rotated rectangle on the top graph
here's a hacky, probably not very efficent, implementation for arbitrary rectangles:
09-25-2019 05:49 PM - edited 09-25-2019 06:39 PM
Here's a simplified version that shows the general idea of "plot images". (selection square is defined by one side (i.e. two cursors), interpolation is "nearest", graph is sized for 1:1 data/pixel avoiding scaling, etc.).
Of course in real code we would use an event structure and only do the calculations and updates when something changes. (Not shown).
It is easy to expand to arbitrary scaling and more complicated shapes (e.g. rectangle, circle, etc)
09-27-2019 02:54 PM - edited 09-27-2019 03:36 PM
Note that we can simplify the code if we invert the Y axis, placing 0,0 in the top left corner. (you still need to implement scaling if the pixesl and array elements are not 1:1, of course. Not shown).
10-21-2019 12:44 PM - edited 10-21-2019 12:44 PM
@altenbach wrote:
(you still need to implement scaling if the pixesl and array elements are not 1:1, of course. Not shown).
0# conveniently, this approach is independent from the origin of the Frontpanel.
so for the proper scaling:
1# I set the x-max to the number of rows, and the y-max to the number of columns
2# then multiply the 4 square points by the quotient of Plot Area size and 2d Array size (width;hight) / (rows/columns)
(oh, I realize I could do the multiplication outside of the for loop ... )