# libgdx calculate vector to find new points

I am working with vector2 in libgdx. I have (x1,y1) and magnitude 'M' with an angle 'D'. How could I calculate (x2,y2) using vector2.

Thank You

• So what exactly should (x2, y2) be...?
– Eric
Oct 16 '16 at 4:41
• new vector2 object (containing (x2,y2)) would be great:) Oct 16 '16 at 4:47
• It's unclear what you're asking. What exactly do you need to calculate? What does (x2,y2) represent? That's just another point.
– Eric
Oct 16 '16 at 4:50
• I have a vector2 object say (200f,100f), Magnitude as 5, Angle as "45 degree". Now I want to create a box like structure. Oct 16 '16 at 4:52
• Bascially, I want to create a bounds that can be used for input processor operation. Oct 16 '16 at 4:54

If you want to create a box structure from a point, just take that point and add the width and height to the corresponding values to find the other points.

You'll need 4 points so:

top-left: (x1, y1)
top-right: (x1 + boxWidth, y1)
bottom-left: (x1, y1 + boxHeight)
bottom-right: (x1 + boxWidth, y1 + boxHeight)