PROBLEM SOLVED!!!
An hour or two after my last post, I went back to Wikipedia, and found the missing element. I went to reply, but the forum was closed.
While it says that you CAN cycle an angle (from 0 to 2PI radians) and then apply the formulas I was using to create an ellipse:
ellipseBorderPixel_X = Xradius * cos(angle)
ellipseBorderPixel_Y = Yradius * sin(angle)
it says that angle IS NOT the angle that the pixel lies on!
It then goes on to give equations that relate the two different angles...
To get to the essence, we must factor in the height/width ratio, or more specifically the, the Xradius/Yradius ratio.
So we change the test program to:
$beta=atan(($y/80)*(2/3));
And all the red lines line up with the yellow!
So in the main program we add a new variable to the mix (before the loop, so the calculation is only done once):
$hwFactor=$Xradius/$Yradius;
Then in the loop we change the angle calculation to:
$angle=atan( (abs($center['y']-$row) / abs($center['x']-$column)) * $hwFactor );
And we get ellipses! Yeeeoooooooo!
I've been working on the overall code, fixing bugs in the HTML input form's JavaScript (seems bug free now, I'll try to post it soon), and testing and re-writing the background image handler code (works now) and adding foreground image capability (very soon).
From there I'll be writing a routine/formula that makes a star pattern by:
calculating the real angle (0 to 2PI, not just the one transcribed into the (+,+) quadrant as I do now) (if it's stretched, I'll use the ellipse angle formula)
dividing the angle value by the number of points.
subtracting a linear percentage value from the radius of the circle/ellipse that encloses the star based on the angle.
Seems like it will work...
In the mean time, with the tinkering around I did playing with the ellipse formula, I found I could create many shapes, many odd, many quite interesting....
By creating two new user-defined variables:
$swell
$leaf
we can modify the formulas:
$hwFactor=($Xradius/$Yradius) * $swell;
$angle=$leaf * atan( (abs($center['y']-$row) / abs($center['x']-$column)) * $hwFactor );
If we set $swell to equal $Yradius/$Xradius (the inverse of $hwFactor) then we get the two intersecting circles we had before. By adjusting it, we can control the "swell factor".
If we set $leaf to 2, the "swollen" ends are split in two, and we get a four leaf clover!
And other patterns are possible, too! Here's one for which I forgot the formula, but it's similar to what I've been doing.
And one with a background, and transparent gradients...
From here, who knows what my imagination will lead to. And kids, yours is just as powerful! Do your homework, and see that math can be fun, even in real life applications! And don't forget to brush your teeth!
Again, Peace, ya'll!