update page now

Voting

: min(four, nine)?
(Example: nine)

The Note You're Voting On

logang at deltatee dot com
22 years ago
Heres a function to make a curve between two points... This will be a downward curve but it wouldn't be hard to make a similar function to make an upward curve. The first point has to be to the left of the second point ($x1 < $x2), and height is actually backwards. The larger height is the less of a crest the curve has. I imagine with a few modifications this functions could make upward curves as well.

function ImageCurveDown ($image, $x1, $y1, $x2, $y2, $height, $color) {
    $presicion = 1;

    for ($left = ($x1-$x2); $left < 0; $left++){
        if ($y1 < $y2) {
            $cy = $y2 + $height;
            $cx = $x1 - $left;
        } else {
            $cy = $y1 + $height;
            $cx = $x2 + $left;
        }
        $nx1 = abs($x1 - $cx);
        $ny1 = abs($y1 - $cy);
        $nx2 = abs($x2 - $cx);
        $ny2 = abs($y2 - $cy);

        if ($y1 < $y2) {
            if ($nx2 == 0 || $ny1 == 0) continue;
            $angle1 = atan($height/$nx2);
            $A1 = $nx2/cos ($angle1);
            $B1 = $ny2/sin ($angle1);
            $angle2 = pi()/2 +atan($left/$ny1);
            $A2 = $nx1/cos ($angle2);
            $B2 = $ny1/sin ($angle2);
        } else {
            if ($ny2 == 0 || $nx1 == 0) continue;
            $angle1 = atan($ny2/$nx2);
            $A1 = abs($nx2/cos ($angle1));
            $B1 = abs($ny2/sin ($angle1));
            $angle2 = atan($height/$nx1);
            $A2 = abs ($nx1/cos ($angle2));
            $B2 = abs($ny1/sin ($angle2));
        }

        if (abs($A1 - $A2) < $presicion && abs ($B1 - $B2) < $presicion) {
            ImageArc($image, $cx, $cy, $A1*2, $B1*2, 180+rad2deg($angle2), 360-rad2deg($angle1), $color);
        }
    }
}

<< Back to user notes page

To Top