I start with a perfect circle, and then I need to rotate and scale it free without loose the ellipse characteristics:
I would like to know if there is a way to describe a ellipse distorted like that based only in cosines and sines.
I have this code:
float centerX = 100;
float centerY = 100;
float radiusX = 100;
float radiusY = 100;
float rotation = PI;
float res = 30;
for (int i = 0; i < res; i++) {
//find the point in space for the circle resolution
float angle = (float)i/res * TWO_PI;
float x = radiusX * cos(angle);
float y = -radiusY * sin(angle);
//rotate the point
float s = sin(rotation);
float c = cos(rotation);
// translate point to origin:
p->x -= centerX;
p->y -= centerY;
float xnew = p->x * c - p->y * s;
float ynew = p->x * s + p->y * c;
// translate point back
x = xnew + centerX;
y = ynew + centerY;
//apply X Y
}
This code can only represent the same ellipse ignoring the relation between the rotation and scale: