Rotation over a point on a 2D pivot in Java [closed]

-3

I'm trying to figure out how to rotate a vector over a point (another vector) as a PIVOR tried on some sites that gave me the following code:

public Vector2 rotate_point(float cx,float cy,float angle,Vector2 p)
{
  float s = (float) Math.sin(angle);
  float c = (float) Math.cos(angle);

  // translate point back to origin:
  p.x-= cx;
  p.y -= cy;

  // rotate point
  float xnew = p.x * c - p.y * s;
  float ynew = p.x * s + p.y * c;


  return p;
}

But I do not understand what this float angle variable would be.

    
asked by anonymous 19.05.2017 / 23:58

1 answer

-1

This angle is how many degrees you want to rotate one point relative to the other. Take a look at this answer here too, it teaches a way to do: link

    
20.05.2017 / 00:08