Hi,
if you want to draw an ellipse with origin at cx,cy, the radii rx,ry
and a rotation of dg degrees you can do following:
1) draw ellipse (two elliptical arcs) and rotate it via tranform:
points A(ax,ay), B(bx,by)
path of ellipse: "M ax ay A rx ry 0 0 1 bx by rx ry 0 0 1 ax ay z"
with
ax = cx - rx
ay = cy
bx = cx + rx
by = cy
(using absolute coordinates)
adding the transformation you will get:
<path transform="rotate(dg,cx,cy)" d="M ax ay A rx ry 0 0 1 bx by rx
ry 0 0 1 ax ay z" ... />
If you use the x-axis-rotation parameter - first pararmeter of 0 0 1 -
to rotate the ellipse and keep all the other parameters the same, you
will NOT get an ellipse that is congruent to the original ellipse, but
rather an ellipse that is rotated but still goes through points A and
B. So it is either bigger or smaller (and thus not being an ellipse
anymore).
But you can still use the x-axis-rotation parameter to achieve the
desired result:
2) draw ellipse using x-axis-rotation parameter, calculating start and
end points:
if you rotate the ellipse via x-axis-rotation parameter you have to
calculate the coordinates of A and B - which you know have to be on a
circle having the radius rx.
A point D(dx,dy) on a circle with origin (0,0) and radius r at dg
degrees you can calculate as follows (javascript):
dx = r*Math.cos(dg*Math.PI/180);
dy = r*Math.sin(dg*Math.PI/180);
so you get:
path of ellipse: "M ax ay A rx ry dg 0 1 bx by rx ry dg 0 1 ax ay z"
with
ax = cx - dx;
ay = cy - dy;
bx = cx + dx;
by = cy + dy;
There is a sample at:
http://www.zuccaralloo.de/devgroup/samples/rotateEllipse.svg
showing four ellipses:
blue: 'original' ellipse (not rotated)
gray fill: original rotated using transformation
green: setting x-axis-rotation parameter using same start and end
points as original
red: setting x-axis-rotation parameter plus calculating start and end
points
Regards-
-Heiko
--- In [email protected], raghu raman <[EMAIL PROTECTED]>
wrote:
> Hello
>
> I am new to this group. I have primary axis, secondary axis , origin
and Rotation Angle.Using this i need to draw an ellipse without using
the standard function of ellipse. It would be vey helpful, if I draw
an ellipse using Lines using some algorithm.
>
> Please kindly let me know your suggestions.
>
> Thanks & Regards
> Senthil
>
>
> Yahoo! India Matrimony: Find your life partneronline.
>
> [Non-text portions of this message have been removed]
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/