I've done similar work before, for rotation, there is rotate
function for polygons. In your case, add following line before adding feature to the layer:
var originPoint = new OpenLayers.Geometry.Point(xCent, yCent).transform(map.displayProjection, map.projection); //center point for rotation
polygonFeature.geometry.rotate(rot, originPoint);
You can find full documentation about rotate
function here
I'm not sure about your calculation for the ellipses(you might have used some mathematical transformations), but I would suggest to use the polar system to get those points coordinates.
Get the distance from the point on ellipse at direction θ to the origin using following formula:
The coordinates of the point are:
x = r(θ) * cos(θ)
y = r(θ) * sin(θ)
Best Answer
Answer
First, define a circle of radius 1.
Then define an ellipse along x and y axis.
Rotate the ellipse.
Finally, actually draw the ellipse.
Code
Shapely documentation:
https://shapely.readthedocs.io/en/stable/manual.html
That's it!
Result of
elrv
: