How to get coordinates in 2D with the given points

307 Views Asked by At

I have the following coordinates:
$[-20, -20]$, $[-20, 20]$, $[-40, 0]$, $[-40, 20]$, $[-40, 40]$,
$[-20, 80]$, $[20, 80]$, $[40, 40]$, $[80, 20]$, $[80, -20]$.

My task is to get coordinates starting point from [0, 0].I can get the angles and the length from the above given coordinates. The angles should be between 0 to 360 positive.

Suppose I don't have the original coordinates now. I need to calculate the coordinates starting from 0,0 with angles and length.I need the current coordinate, previous and next coordinates.

Ex: if the current coordinates segment has a length of 5 then coordinates are (0,0) (0,5).The end point of the Predecessor is (0,0)and the start point of the Successor is (0,5).

What could be the formula, I need to calculate keeping in mind the quadrants??

To find the next and previous coordinates I use the formula as in quadrant 1,postive x-axis.

x1=x+l * cos(angle), y1=y+l * sin(angle).

Do the above formulas change in my case w.r.t quadrants as below or they stand the same.

x1=x-lcos(angle), y1=y-lsin(angle) etc (change w.r.t quadrants). Help me find out.

1

There are 1 best solutions below

0
On

Let take the first two points - [−20,−20], [−20,20]. The length of the vector is $\sqrt{(-20-(-20))^2+ (20-(-20))^2)}$ And tag the polar direction is $(20-(-20))/(-20-(-20))$ which goes to infinity - 90 degrees angle.

And so you go from point to point.