Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Vince's Corner Takeout
#3
Tessellating fish

Code: (Select All)
defdbl a-z

dim shared pi, a1, a2, a, b, w1, w2, h

pi = 4*atn(1)

a1 = 14
a2 = 4

w = 30*7
w1 = w*5/7
w2 = w - w1
h = w*2/7

a = -h/a2/sin(pi*w/w1)
a = exp(log(a)/w)
b = a1*pi/w1/w2

sw = w*4 + w2
sh = h*8 + 114

screen _newimage(sw, sh, 32)

line (0,0)-(sw, sh),_rgb(255,255,255),bf

for i=-1 to 4
for j=-1 to 4
        fish w2 + i*w, 50 + h*j*2, w, i and 1
        fish sw - w2 - i*w, 50 + h*j*2 + h, -w, i and 1
next
next

sleep
system

function f(x, aa)
        f = aa*(a^x)*sin(pi*x/w1)
end function

function g(x, v)
        g = b*x*(x - v)
end function

sub fish(x0, y0, ww, u)
        dim c1 as _unsigned long
        dim c2 as _unsigned long

        c1 = _rgb(200,200,200)
        c2 = _rgb(255,255,255)
        if u then swap c1, c2

        w = abs(ww)
        s = sgn(ww)

        'background
        color c1
        for x=w to w1 step -1
                line (x0 + s*(x - w), y0 - f(x, a2))-(x0 + s*(x - w), y0 - g(x - w, -w2))
        next
        for x=0 to w1
                line (x0 + s*x, y0 - f(x, a2))-(x0 + s*x, y0 + h - f(w1 - x, a1))
        next
        for x=0 to w2
                line (x0 + s*(w - x), y0 + h - g(-x, -w2))-(x0 + s*(w - x), y0 - f(w - x, a2))
        next
        for xx=0 to w1/3/7
                if xx>0 and xx<w1/3/7 then
                        x = xx*3*7 + 3
                        ox = x0 + s*x
                        oy = y0 - f(x, a1)
                        oy2 = y0 + h - f(w1 - x, a2)
                        for zz=0 to 3*7 + 2
                                z = xx*3*7 + zz
                                line (ox, oy)-(x0 + s*z, y0 - f(z, a2))
                                line (ox, oy2)-(x0 + s*z, y0 + h - f(w1 - z, a1))
                        next
                end if
        next

        color _rgb(0,0,0)
        'closed shape
        pset (x0, y0)
        for x=0 to w
                line -(x0 + s*x, y0 - f(x, a2))
        next
        for x=0 to w2
                line -(x0 + s*(w - x), y0 + h - g(-x, -w2))
        next
        for x=0 to w1
                line -(x0 + s*(w1 - x), y0 + h - f(x, a1))
        next
        for x=w to w1 step -1
                line -(x0 + s*(x - w), y0 - f(x, a2))
        next
        for x=0 to w2
                line -(x0 - s*(w2 - x), y0 - g(x, w2))
        next
        for x=0 to w1
                line -(x0 + s*x, y0 - f(x, a1))
        next


        'flourish
        circle (x0 + s*w1, y0 + 21), 3, c2
        paint  (x0 + s*w1, y0 + 21), c2
        circle (x0 + s*w1, y0 + 21), 3

        for xx=0 to w1/3/7
                if xx=1 then
                        x = xx*3*7 + 3
                        pset (x0 + s*x, y0 - f(x, a1))
                elseif xx>1 and xx<w1/3/7 - 1 then
                        x = xx*3*7
                        line -(x0 + s*x, y0 - f(x, a2))
                        x = x + 3
                        line -(x0 + s*x, y0 - f(x, a1))
                end if
        next

        for xx=0 to w1/3/7
                if xx=0 then
                        x = (xx + 1)*3*7 + 3
                        pset (x0 + s*x, y0 + h - f(w1 - x, a2))
                elseif xx>0 and xx<w1/3/7 then
                        x = xx*3*7
                        line -(x0 + s*x, y0 + h - f(w1 - x, a1))
                        x = x + 3
                        line -(x0 + s*x, y0 + h - f(w1 - x, a2))
                end if
        next

        for xx=1 to w2/8 - 1
                x = w - xx*8
                x2 = w - xx*6.5 - 7
                line (x0 + s*(x - w), y0 - f(x, a2))-(x0 + s*(x2 + 2*7-w), y0 - f(x2, a2))
        next
end sub
Reply


Messages In This Thread
Vince's Corner Takeout - by bplus - 04-29-2022, 02:12 PM
RE: Vince's Corner Takeout - by vince - 04-29-2022, 09:34 PM
RE: Vince's Corner Takeout - by vince - 05-02-2022, 03:10 AM
RE: Vince's Corner Takeout - by bplus - 05-02-2022, 04:25 AM
RE: Vince's Corner Takeout - by vince - 05-02-2022, 11:16 PM
RE: Vince's Corner Takeout - by vince - 05-03-2022, 01:10 AM
RE: Vince's Corner Takeout - by bplus - 05-03-2022, 01:15 AM
RE: Vince's Corner Takeout - by vince - 05-03-2022, 04:26 AM
RE: Vince's Corner Takeout - by bplus - 05-03-2022, 03:32 PM
RE: Vince's Corner Takeout - by vince - 05-10-2022, 03:41 AM
RE: Vince's Corner Takeout - by vince - 05-10-2022, 03:57 AM
RE: Vince's Corner Takeout - by dcromley - 05-10-2022, 02:57 PM
RE: Vince's Corner Takeout - by vince - 05-10-2022, 08:14 PM
RE: Vince's Corner Takeout - by SMcNeill - 05-10-2022, 02:59 PM
RE: Vince's Corner Takeout - by vince - 05-11-2022, 01:13 AM
RE: Vince's Corner Takeout - by dcromley - 05-11-2022, 01:58 AM
RE: Vince's Corner Takeout - by vince - 06-01-2022, 09:05 AM
RE: Vince's Corner Takeout - by vince - 08-11-2022, 02:51 AM
RE: Vince's Corner Takeout - by bplus - 06-03-2022, 02:47 PM
RE: Vince's Corner Takeout - by triggered - 06-04-2022, 02:00 AM
RE: Vince's Corner Takeout - by vince - 06-07-2022, 02:02 AM
RE: Vince's Corner Takeout - by bplus - 06-07-2022, 02:15 AM
RE: Vince's Corner Takeout - by vince - 07-13-2022, 05:23 AM
RE: Vince's Corner Takeout - by BSpinoza - 07-14-2022, 04:54 AM
RE: Vince's Corner Takeout - by bplus - 07-14-2022, 04:35 PM
RE: Vince's Corner Takeout - by aurel - 08-11-2022, 01:02 PM
RE: Vince's Corner Takeout - by bplus - 08-11-2022, 04:22 PM
RE: Vince's Corner Takeout - by aurel - 08-11-2022, 05:33 PM
RE: Vince's Corner Takeout - by BSpinoza - 08-12-2022, 03:44 AM
RE: Vince's Corner Takeout - by vince - 08-11-2022, 08:42 PM
RE: Vince's Corner Takeout - by vince - 08-19-2022, 05:00 AM
RE: Vince's Corner Takeout - by bplus - 08-19-2022, 06:33 PM
RE: Vince's Corner Takeout - by vince - 08-23-2022, 10:04 PM
RE: Vince's Corner Takeout - by vince - 11-04-2022, 01:48 AM
RE: Vince's Corner Takeout - by vince - 03-31-2023, 11:07 PM
RE: Vince's Corner Takeout - by vince - 09-18-2023, 11:45 PM
RE: Vince's Corner Takeout - by Dav - 09-19-2023, 12:54 AM
RE: Vince's Corner Takeout - by bplus - 09-19-2023, 01:37 AM
RE: Vince's Corner Takeout - by GareBear - 09-19-2023, 03:56 PM
RE: Vince's Corner Takeout - by bplus - 09-19-2023, 04:47 PM
RE: Vince's Corner Takeout - by vince - 09-19-2023, 06:54 PM
RE: Vince's Corner Takeout - by bplus - 09-19-2023, 09:02 PM
RE: Vince's Corner Takeout - by vince - 01-13-2024, 07:15 PM
RE: Vince's Corner Takeout - by bplus - 01-13-2024, 07:59 PM
RE: Vince's Corner Takeout - by GareBear - 01-13-2024, 10:54 PM
RE: Vince's Corner Takeout - by vince - 02-16-2024, 04:01 AM
RE: Vince's Corner Takeout - by bplus - 02-16-2024, 02:27 PM
RE: Vince's Corner Takeout - by vince - 02-16-2024, 07:16 PM
RE: Vince's Corner Takeout - by Sprezzo - 02-17-2024, 03:04 AM
RE: Vince's Corner Takeout - by bplus - 02-17-2024, 02:44 PM
RE: Vince's Corner Takeout - by vince - 10-07-2024, 08:11 AM
RE: Vince's Corner Takeout - by bplus - 10-07-2024, 01:32 PM
RE: Vince's Corner Takeout - by vince - 10-11-2024, 12:05 AM
RE: Vince's Corner Takeout - by vince - 10-11-2024, 12:16 AM
RE: Vince's Corner Takeout - by PhilOfPerth - 10-11-2024, 03:51 AM
RE: Vince's Corner Takeout - by vince - 10-11-2024, 07:55 PM
RE: Vince's Corner Takeout - by PhilOfPerth - 10-11-2024, 11:30 PM
RE: Vince's Corner Takeout - by vince - 10-15-2024, 10:54 AM
RE: Vince's Corner Takeout - by bplus - 10-15-2024, 01:40 PM



Users browsing this thread: 8 Guest(s)