I have the area like in the below. I am generating random coordinates between this coordinate map. When the randomly generated number comes (0.3,-0.3) I did easily program that it recognizes this coordinate belongs to Area F but how can I determine the bounds of A / B / D / E to recognize if the randomly generated coordinate belongs to these areas? What are the bounds of Area E for writing an if statement to recognize if randomly generated coordinate inside of it?
CodePudding user response:
AREA D & E
- The line between the areas
DandEis made of all the coordinates such thatx == yand bothxandyare negative, i.ex,y < 0. In other words the equation of the line isf(x)=x - From the above information we can deduce that all the coordinates such that
x < yand bothxandyare negative will belong to the areaD. - Similarly, all the coordinates such that
x > yand bothxandyare negative will belong to the areaE.
AREA A & B
- Equation of this line is
f(x)=1-xand bothxandyare positive, i.ex,y > 0(which you can easily deduce yourself if you take few coordinates that belongs to this line and try to figure out how you will get theycoordinate from thex) - From the above information we can deduce that all the coordinates such that
y < 1-xand bothxandyare positive belongs to areaA. - And finally, all the coordinates such that
y > 1-xand bothxandyare positive belongs to areaB.

