OK, so here is my problem. I am trying to create an image using PHP and code to create it. The idea is it is going to be able to take variables and create the image. Here's the prblem I keep running into:
PHP Code:
$cx = Center of image width
$cy = Center of image height
$r = Calculation for the radius of curvature in mm
$sag = Calculations for the sag of the curve
$diam = Diameter of the lens
$ang = rad2deg(atan((diam/2)/$r))
$sy = $cy + $r -$sag
ImageArc($id, $cx, $sy, $r, $r, (270-$ang), (270+$ang), $black);
This should make a circle at the point (x,y) = [$cx, $sy], my problem is that the $sy point will often go outside of the size of the image for instance if the height of the image was 500px, the $sx could at times equal 600 or more which would go outside of the image. It seems that when i go outside fo the image bounds the arc won't display in my image. This has been bugging me for a while now. Here was a workaround I thought of, use overlapping div's on the page to block out the area of the image I don't want viewable, and increaseing the bounds of my image, but then I will have more codeing to do to get the center points to be on the visible center of the image which will then further the complications in the arc's (x,y) start point.
Any PHP guru's here that could help?
Bookmarks