How to draw ellipses in Scilab with orientation?

Viewed 78

The existing functions xarc draw an ellipse, but the semi-major axes are aligned with the plot axes. Is there a way to 'rotate' the ellipse so it has an orientation that is not with the plot axes?

1 Answers

If the arc is the only element drawn in the axes, then you can actually use xarc() to generate it, and then rotate the whole axes:

clf
xarc(0, 1, 3, 1, 0, 310*64)
isoview
gca().rotation_angles(2) = 70;

But, its likely not the case. Then the arc must be generated as a polyline object, and then rotate() can be used to rotate it:

clf
alpha = 0:1:310;
[a, b, xc, yc] = (3, 1, 2, 2);
x = xc + a*cosd(alpha);
y = yc + b*sind(alpha);
r = 20;   // rotation angle in °
xyR = rotate([x;y], r/180*%pi, [xc ; yc])';
plot(xyR(:,1), xyR(:,2))

enter image description here

Related