How to rotate an ellipse

Hi,

I’m trying to create a rotations of a drawings created by List of Vectors. The Drawing that I’m trying to make is an Elipse and I wanted for it to rotate like this / to this |.

For now I’m using this code

//r => radius
for(int i = 0; i < segments; i++)
{
    var heading = (step * i) * OnlineMapsUtils.Deg2Rad;
    var px = (r * Math.Cos(heading)) + tx1;
    var py = (r / 2 * Math.Sin(heading)) + ty1;

    var ang = angle * OnlineMapsUtils.Deg2Rad;
    var cos = Math.Cos(ang);
    var sin = Math.Sin(ang);

    px = (px * cos) - (py * sin);
    py = (px * sin) + (py * cos);
    
    map.projection.TileToCoordinates(px, py, 20, out lng, out lat);
    points.Add(new Vector2((float)lng, (float)lat));
}

This code uses an Asset called OnlineMaps in which you can just mind the map.projection part as it is only a code to make the coordinates from the tileset into real life one

But, using this code, I don’t know why but the coordinates doesn’t rotate. It does however make the position out of bounds.

how to rotate an ellipse

using static UnityEngine.Mathf;
  
[SerializeField] Vector2 r = new Vector2( 0.5f , 1 );
[SerializeField] float rotDegrees = 0;
[SerializeField][Min(3)] int numSegments = 30;
void OnDrawGizmos()
{
  float step = PI*2f / numSegments;
  Vector3[] points = new Vector3[numSegments+1];
  for( int i=0 ; i<=numSegments ; i++ )
  {
      float f = i * step;
      Vector2 p = r * new Vector2( Cos(f), Sin(f) );
  
      float rot = -rotDegrees * Deg2Rad;
      float rotSin = Sin(rot);
      float rotCos = Cos(rot);
      Vector2 a = new Vector2( rotCos, rotSin );
      Vector2 b = new Vector2( -rotSin, rotCos );
      points = (a * p.x) + (b * p.y);
  }
  UnityEditor.Handles.DrawAAPolyLine( points );
 }

How to rotate a vector: