Carl
Why not use an ellipse that just fits _inside_ the rectangle?
Then a^2/xrad^2 = 1; so xrad = a
and b^2/yrad^2 = 1; so yrad = b
The values of x-extent and y-extent of the grob are also given
immediately.
Trevor, puzzled ||%-/
----- Original Message -----
From: "Carl D. Sorensen" <[EMAIL PROTECTED]>
To: "Reinhold Kainhofer" <[EMAIL PROTECTED]>; "Valentin Villenave"
<[EMAIL PROTECTED]>
Cc: <lilypond-devel@gnu.org>
Sent: Friday, August 29, 2008 4:17 AM
Subject: Re: [PATCHES] Re: Harp Pedals?
I want the equation of an ellipse that circumscribes a box 2a by 2b.
x^2/xrad^2 + y^2/yrad^2 = 1 (ellipse)
needs to pass through the points (a,b), (-a,b), (a,-b), (-a,-b).
Because of the squared terms, all four points have the same equation.
a^2/xrad^2 + b^2/yrad^2 = 1 (1)
There is an infinite number of ellipses that circumscribe the ellipse.
I want one with the aspect ratio being the same as the box. So my second
equation is
q/b = xrad/yrad
Solve for a.
a = b* xrad/yrad
substitute into equation (1)
b^2*xrad^2/(yrad^2*xrad^2) + b^2/yrad^2 = 1
2b^2/yrad^2 = 1
yrad^2 = 2b^2
yrad = sqrt(2) b.
By symmetry, xrad = sqrt(2) a.
Your counterexample didn't apply because of the 0 in the denominator.
HTH,
Carl
On 8/28/08 3:42 PM, "Reinhold Kainhofer" <[EMAIL PROTECTED]> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am Donnerstag, 28. August 2008 schrieb Valentin Villenave:
2008/8/19 Carl D. Sorensen <[EMAIL PROTECTED]>:
I've been looking at ellipse code. Once I can get rhythms.itely off my
plate (which is waiting on the beatGrouping patch, one way or the other)
I'll add an ellipse in place of the circle.
I've been looking at a way to draw ellipses, but I've just seen you
have pushed a much better-looking implementation than mine; I hope the
docs will be recompiled soon so we can appreciate your nice ellipse in
the documentation!
Yes, I saw that, too. I even generalized it to allow different paddings in
X-
and Y-direction. However, what I don't understand about the ellipse code
in
ellipse-stencil is the factor 0.707 (supposedly from sqrt(2)/2) for
x-radius
and y-radius. If that factor comes from scaling the ellipse so that it
surrounds the stencil, then it only works for square stencils, for all
other
stencils it will be too large. As an extreme case consider a line stencil
("box" from (0 . -1) to (0 . 1) ). The ellipse will have half-axes of
length
1.414 and 0 (without padding), so in X-direction it will overshoot by far.
For a square, of course, the ellipse will degenerate to a circle, touching
all
corners, but for stencils with other rectangular extents, the ellipse will
not touch the corners of the bounding box any more.
Cheers,
Reinhold
- --
- ------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: [EMAIL PROTECTED], http://reinhold.kainhofer.com/
* Financial and Actuarial Mathematics, TU Wien,
http://www.fam.tuwien.ac.at/
* K Desktop Environment, http://www.kde.org, KOrganizer maintainer
* Chorvereinigung "Jung-Wien", http://www.jung-wien.at/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFItxvJTqjEwhXvPN0RAp3YAKDPLWkKDtIwL9kXJ2ewllV145hAiQCfcgtJ
9HT0TA/6i916CtT0vlnWZUk=
=UbNn
-----END PGP SIGNATURE-----
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel