How can I determine if a point (X, Y) is within the colored areas within a 2d vector. That is, I want to know when that point is between the values of any of the areas of the vector marked by the colors, for example if the point is in (X = 0.2, Y = 0.8) the point would be in the red area but if the value of the point is in (X = 0.3, Y = 0.8) would be in the blue area. I cannot do this operation with the comparison operators (<, <=,>,> =) since the areas that I need to finish have this diagonal form and these operators only allow me to determine straight areas
Can you give an example, it’s not clear.
Do you mean is a vector in a shaded area? Part of the vector, or the whole vector? etc…
Hello!! I updated the description to explain myself better, I hope it is better understood, thank you, regards!
You can check the angle to the point. This is what I came up with:
This is only for the positive values of X and Y, so you’ll have to interpolate it to the other areas too.
I used X and Z, but it doesn’t really matter, just swap Z with Y. Plus as you can see, the angle is calculated from [0,0], that’s why you need to subtract 0.1X from the point you’re calculating for, and use [0.2. 1.0] in the second vector, not [0.3. 1.0] as you have in your graph.
Hope it’s clear what’s going on in there; if not, do tell, I’ll try and explain it in more details tomorrow.
Hello, thank you very much for your suggestion, but after testing your method I am only able to map the quadrant through a straight area, as I show below (Red area)
I am testing the values as follows, maybe it will help
However after modifying your answer I am now able to map the area a little closer than I need (red area)
the modification is functional for my purposes however I do not have all the control I would like over the sector in which I need to check the values. But we are very close, I do not know if you have any additional suggestions or if you know of any article that can help me. Anyway thank you very much greetings: D
Can you not just check which quadrant first, then use the angle to decide which side of the line?
Hi, I’m doing it, first I check the quadrant and then the sector. In the example images I do it with the upper left and upper right quadrant (I also have it for the lower ones) only that the resulting line of the sector is not perfectly diagonal.
the result I get is the following
Right, but I mean it’s a vector across the quadrant, and you can check the angle between that vector and the point. No?
I elaborated a bit what I had in mind. I spawned thousands of spheres, and if they fell into the right area, I turned them green:
338425-
To me it looks exactly what you’re after; correct me if I’m wrong. Here’s how I calculated it (adjusted for size, of course, my square is 1000 units instead of 1);