0
\$\begingroup\$

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

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

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)
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.