Hi,
I’m trying to create a script to autonumbering the beams. For the moment, I managed to do it from left to right (from the smallest value of the x to the largest).
However, I would like to change the angle of the X axis. I would like that the reading order of the points was taken in oder angle. (sorry for my english).
In your screenshot, you are sorting your points by using the Point.X node. You should change that node so you can sort them by a linear combination of Point.X and Point.Y.
By changing that node by the right linear combination, you should get the sorting you want.
You want to sort a list of points that are aligned on the first bisectrix.
Get the first bisectrix equation ( obvisouly, y=x )
Invert the sign of the coefficient of either ‘y’ or ‘x’ ( y=x –> 1 y = -1 x)
Invert the coefficients ( 1 y = - 1 x –> - 1 y = 1 x )
Get the two variables to the same side of the equation ( 1 x + 1 y = 0 )
What you get at the left of the final equation is the linear combination you need (i.e. you want to replace pt.X by 1 pt.X + 1 pt.Y).
If you wanted to sort a list of points aligned on a line whose equation is : a x = b y , you’ll need to compute --> b pt.X + a pt.Y
Example 2 :
The equation of the X axis is : y = 0, i.e. 1 y = 0 x. Thus, the combination you should use : 1 pt.X + 0 pt.Y. This combination is strictly the same as : pt.X (linear combination that you are currently using).