[ANSWERED] Converting Row/Column to Index for Data Array Accces
-
Hi,
I am looking for a way to effectively translate and converge two coordinate systems. One is x, y, data in the form -50/50 the other coordinates read in as lines by the Data Array from an external file. The two systems can be visualised as an overlay like this following image for a 100 line array:
The approach is to call a specific line from the external array based on an x and y position, for example the X,Y coordinate -2,4 would trigger line 14 and 4,-2 trigger line 69.
Any thoughts on how to make a dynamic conversion for these data sets?
Best Wishes
Russell
[EDIT: Changed your headline to make what you were asking a bit more specific -- Mark] -
Hello,
The formula
L = (X + 5) + (5-Y) *10
Will make the works, easy to make with calculators or JavaScript.
Have a nice day
-
Sorry, I just see there is no zero!
So you have to introduce a conditional line
if (x < 0) & (Y > 0):
L = (X + 6) + (5-Y) *10
elif (X < 0) & (Y < 0):
L = (X + 6) + (6-Y) * 10
elif (X > 0) & (Y > 0):
L = (X + 5) + (5-Y) *10
elif (X > 0) & (Y < 0):
L = (X + 5) + (6-Y) *10
-
@jhoepffner said:
Sorry, I just see there is no zero!
Another way to deal with the missing zero.
Use the Calculator actor to add 6 to the values from (-5,-4,-3,-2,-1,1,2,3,4,5) and you'll get a value from 0 to 9. Here's how to do the rest.
And the User Actor that does it.
Best Wishes,
Mark -
Thank you! great solution!
I did have some stray points being produced when the '0' in the middle of the Table actor was called (for example causing line 100 to be triggered where it wasn't wanted). For my purposes I was able to replace the middle 0 with a 5 and use another calculator to add 1 to the output. It appears to be working visually more cleanly for my purposes.
Best Wishes
Russell
-
@mark said:
And the User Actor that does it. Row-Col to Index.iua3
May I suggest putting this on the Plugins Page, Dear Leader?
-
@woland said:
May I suggest putting this on the Plugins Page, Dear Leader?
Because of the fact it doesn't respond to 0 in the middle, I would not consider this a general case. That will cause confusion which could generate support questions/tickets, etc.
Best Wishes,
Mark