Author Topic: Easter Egg Decorating  (Read 19895 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Easter Egg Decorating
« Reply #16 on: March 31, 2022, 07:39:27 am »
Here's a more detailed description of the parameters:  https://nyaspubs.onlinelibrary.wiley.com/doi/10.1111/nyas.14771

The chicken eggs are not pointy but eggs of other bird species are, ie the "pyriform" shape https://bioone.org/journals/the-auk/volume-135/issue-4/AUK-18-38.1/The-pyriform-egg-of-the-Common-Murre-Uria-aalge-is/10.1642/AUK-18-38.1.full

That curve equation is supposed to be universal to all eggs.  From what I gather, you can set p(x) = x for a "good enough" approximation but there are several more complicated variants of p(x) that take into account more species of birds, ie that "pyriform" one

Ah that helps,   ... a bit.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Easter Egg Decorating
« Reply #17 on: March 31, 2022, 07:41:12 am »
WTH? https://www.google.com/search?q=Eggs+image&tbm=isch&chips=q:eggs+image,g_1:white:oGocWXeA-oc%3D&client=opera&hs=ZAc&hl=en&sa=X&ved=2ahUKEwjkz4H6nvD2AhWVj2oFHb00A-oQ4lYoAnoECAEQIQ&biw=1165&bih=606

White eggs do appear slightly more pointed than brown. But I am talking about chicken eggs, not whatever egg Steve found LOL!

That's a pic of a quail egg, I think.

Truth is, most "natural" chicken eggs come in all sorts of shapes and sizes from my experience.  Some are extra long (usually with double yokes inside), while some are almost golf ball round.  When we raised chickens, we raised Bantam chickens, and we got everything from red to white to blue to green eggs -- and all from the same crazy ass chicken!

I'd say, "If it's close, it's close enough -- pointed or not!"  All the eggs you buy in the store are "Grade A" eggs, which is why they all look so uniform.  Look at the pictures of lower grade eggs some time.  I wouldn't be too surprised to find a dang pyramid or cube in some of them!  😂

I'll just stick to my simple little SIN stretching... Or elsejust use an actual picture of an egg and then colorit!  LOL!

See these: https://www.purinamills.com/2.purinamills.com/media/Images/Articles/PF_Quality-Eggs-Tile-Image.jpg?ext=.jpg
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Easter Egg Decorating
« Reply #18 on: March 31, 2022, 08:03:41 am »
I am getting ideas for decorating from this:
 
image_2022-03-31_080335.png


Right up Pete's alley!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Easter Egg Decorating
« Reply #19 on: March 31, 2022, 08:48:12 am »
As Aurel would say, "Steve's got a right" some more on egg curves:
http://www.mathematische-basteleien.de/eggcurves.htm

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Easter Egg Decorating
« Reply #20 on: March 31, 2022, 04:04:30 pm »
I would say, if you know how to make a 3D ball using vectors, you might be able to figure out how to use the mouse to elongate one side of the ball to make it look just like an egg. Then you can copy the picture and save it. Or copy the variables and save them for an egg app. Wouldn't that be awesome! Don't look at me though, 3D vectors are a ways past my learning curve right now.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Easter Egg Decorating
« Reply #21 on: March 31, 2022, 05:01:25 pm »
Here is my Easter Egg. Of course it's not as real looking as the ones you guys are doing. But at least it's something, maybe for our less-mathematically oriented people. :)

Code: QB64: [Select]
  1. Screen _NewImage(800, 600, 32)
  2. y = 300
  3. cl = 100
  4. cl2 = 20
  5. egg = 1.25
  6. sz = 100
  7. For x = 400 To 410 Step .002
  8.     sz = sz - .01
  9.     egg = egg + .01
  10.     cl = cl + .001
  11.     cl2 = cl2 + 1
  12.     If cl > 150 Then cl = 150
  13.     Circle (x, y), sz, _RGB32(cl2, 255, cl), , , egg
  14.  
  15.  
  16.  
Ken's Easter Egg.jpg
* Ken's Easter Egg.jpg (Filesize: 28.65 KB, Dimensions: 800x625, Views: 247)

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Easter Egg Decorating
« Reply #22 on: March 31, 2022, 05:51:04 pm »
Code: QB64: [Select]
  1. WorkScreen = _NewImage(800, 800, 32)
  2. DisplayScreen = _NewImage(800, 800, 32)
  3. egg = _LoadImage("egg.png", 32)
  4. Screen DisplayScreen
  5.  
  6. _Dest WorkScreen
  7. Stepp = 25 'change this for bigger or smaller bands of colors
  8. For i = 0 To 800 Step Stepp
  9.     Line (0, i)-Step(800, Stepp), &H88000000 + Rnd * &HFFFFFF, BF
  10. _Dest DisplayScreen
  11.  
  12.  
  13. For y = 0 To _Height(egg) - 1
  14.     For x = 0 To _Width(egg) - 1
  15.         _Source egg
  16.         p&& = _Alpha(Point(x, y))
  17.         If p&& > 200 Then
  18.             _Source WorkScreen
  19.             p&& = Point(x, y)
  20.             PSet (x, y), p&&
  21.         End If
  22.     Next
  23.  

 
Steve Egg.png


(The base egg.png is included below for usage. )
egg.png
* egg.png (Filesize: 275.2 KB, Dimensions: 776x799, Views: 311)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Easter Egg Decorating
« Reply #23 on: March 31, 2022, 05:57:28 pm »
One quirk of doing things the way I have above, is that it allows us to basically take two distinct images and then merge them together into the final result.  I start with the image of an egg, and an image of a rainbow screen.  I then basically take the rainbow colors from it's screen, wherever the egg would appear on its screen, and then copy those onto the display screen...

Using this method, I could also, conceivably, take egg-shaped portions of screens from a movie and then put them onto the display, only showing the "egg portion" out of the movie screen.  Or I could take egg-shaped images from moving flames or raindrops falling, and then display them to the screen, as I'm not so much coloring an egg, as just taking the egg-shape color information from a different image.

Movie Easter Eggs -- how great is that concept?!!
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Easter Egg Decorating
« Reply #24 on: March 31, 2022, 07:52:04 pm »
That's awesome Steve! I got all kinds of ideas flowing.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Easter Egg Decorating
« Reply #25 on: March 31, 2022, 08:27:27 pm »
Here is a mod from Steve's Easter Egg. It randomly makes an egg every second with different thickness of colors and it's either horizontal stripes or vertical stripes. Took me a little bit to figure that out. :) Press any key to stop it.

Code: QB64: [Select]
  1. 'Steve's Easter Egg  - mod by SierraKen 3-31-2022
  2. WorkScreen = _NewImage(800, 800, 32)
  3. DisplayScreen = _NewImage(800, 800, 32)
  4. egg = _LoadImage("egg.png", 32)
  5. Screen DisplayScreen
  6. _Title "Steve's Easter Egg mod by SierraKen"
  7.     _Limit 30
  8.     _Dest WorkScreen
  9.  
  10.     r = Int(Rnd * 2) + 1
  11.     If r = 1 Then GoTo one:
  12.     If r = 2 Then GoTo two:
  13.  
  14.     one:
  15.     Stepp = Int(Rnd * 50) + 10 'change this for bigger or smaller bands of colors
  16.     For i = 0 To 800 Step Stepp
  17.         Line (i, 0)-Step(Stepp, 800), &H88000000 + Rnd * &HFFFFFF, BF
  18.     Next
  19.     _Dest DisplayScreen
  20.     _Blend
  21.     For y = 0 To _Height(egg) - 1
  22.         For x = 0 To _Width(egg) - 1
  23.             _Source egg
  24.             p&& = _Alpha(Point(x, y))
  25.             If p&& > 200 Then
  26.                 _Source WorkScreen
  27.                 p&& = Point(x, y)
  28.                 PSet (x, y), p&&
  29.             End If
  30.         Next x
  31.     Next y
  32.     GoTo done:
  33.     two:
  34.     Stepp = Int(Rnd * 50) + 10 'change this for bigger or smaller bands of colors
  35.     For i = 0 To 800 Step Stepp
  36.         Line (0, i)-Step(800, Stepp), &H88000000 + Rnd * &HFFFFFF, BF
  37.     Next
  38.     _Dest DisplayScreen
  39.     _Blend
  40.     For x = 0 To _Width(egg) - 1
  41.         For y = 0 To _Height(egg) - 1
  42.             _Source egg
  43.             p&& = _Alpha(Point(x, y))
  44.             If p&& > 200 Then
  45.                 _Source WorkScreen
  46.                 p&& = Point(x, y)
  47.                 PSet (x, y), p&&
  48.             End If
  49.         Next y
  50.     Next x
  51.     done:
  52.     p&& = 0
  53.     _Delay 1
  54.     a$ = InKey$
  55.     Cls
  56. Loop Until a$ <> ""
  57.  

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Easter Egg Decorating
« Reply #26 on: April 01, 2022, 05:02:15 am »
I typed out the egg-case for that theory of everything egguation:

Code: QB64: [Select]
  1. 'scale
  2. s = 80
  3.  
  4. L = 5.4
  5. B = 4.1
  6. w = 0.4
  7. D = 3.2
  8.  
  9.  
  10. sw = 800
  11. sh = 600
  12. screen _newimage(sw, sh, 32)
  13.  
  14.  
  15. for xx=-0.5*L*s to 0.5*L*s
  16.         x = xx/s       
  17.         a = (L*L - 4*x*x)/(L*L + 8*w*x + 4*w*w)
  18.         y = 0.5*B*sqr(a)
  19.         'you can stop here for p(x) = x
  20.  
  21.         a = sqr(5.5*L*L + 11*L*w + 4*w*w)
  22.         a = a*(sqr(3)*B*L - 2*D*sqr(L*L + 2*w*L + 4*w*w))
  23.         a = a/(sqr(3)*B*L*(sqr(5.5*L*L + 11*L*w + 4*w*w) - 2*sqr(L*L + 2*w*L + 4*w*w)))
  24.  
  25.         aa = L*(L*L + 8*w*x + 4*w*w)
  26.         aa = aa/(2*(L - 2*w)*x*x + (L*L + 8*L*w - 4*w*w)*x + 2*L*w*w + L*L*w + L*L*L)
  27.         aa = 1 - aa
  28.  
  29.         y = y*(1 - a*aa)
  30.  
  31.         line (sw/2 + xx, sh/2 - s*y)-(sw/2 + xx, sh/2 + s*y)
  32.  
  33.  
  34.  

Note: I also got the coefficients by measuring a real egg with a ruler in centimeters, had to eyeball quite a bit.  You'd want some kind of scanner or at least calipers as the formula is pretty sensitive to certain parameters like w and D_{L/4}
« Last Edit: April 01, 2022, 06:51:18 am by _vince »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Easter Egg Decorating
« Reply #27 on: April 01, 2022, 09:22:06 am »
Matrix Rain Easter Egg!

Code: QB64: [Select]
  1. WorkScreen = _NewImage(800, 800, 32)
  2. DisplayScreen = _NewImage(800, 800, 32)
  3. egg = _LoadImage("egg.png", 32)
  4. Screen DisplayScreen
  5. Cls , -1
  6.  
  7.  
  8. For i = 1 To UBound(m)
  9.     m(i) = -Int(Rnd * _Height)
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.     _Dest WorkScreen
  17.     Line (0, 0)-(_Width, _Height), _RGBA32(0, 0, 0, 20), BF
  18.  
  19.     For i = 1 To UBound(m)
  20.         Color _RGB32(0, 255, 0), 0
  21.         m(i) = m(i) + _FontHeight
  22.         If m(i) > 0 Then
  23.             If m(i) > _Height Then m(i) = -Int(Rnd * _Height)
  24.             _PrintString (i * _FontWidth - _FontWidth, m(i)), Chr$(_Ceil(Rnd * 254))
  25.         End If
  26.     Next
  27.  
  28.     For y = 0 To _Height(egg) - 1
  29.         For x = 0 To _Width(egg) - 1
  30.             _Source egg
  31.  
  32.             p&& = _Alpha(Point(x, y))
  33.  
  34.             _Source WorkScreen
  35.             If p&& > 200 Then
  36.                 p&& = Point(x, y)
  37.                 _Dest DisplayScreen
  38.                 PSet (x, y), p&&
  39.             End If
  40.         Next
  41.     Next
  42.     _Display
  43.  

Make certain to grab and use the egg.png from the previous post, if you need it in your QB64 folder.

This is basically just an example of what I was talking of above, about being able to place a flame, movie, or rain upon my egg.  I thought Ken might like it, and it might give him a few ideas for more neat little mods he can do with it.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline dbox

  • Newbie
  • Posts: 80
    • View Profile
Re: Easter Egg Decorating
« Reply #28 on: April 01, 2022, 09:30:10 am »
When in Rome...

Here is a QBJS mod based on @vince's creation - Egg Designer 2000.

View on QBJS

Code: QB64: [Select]
  1. _Title "Egg Designer 2000"
  2. Dim Shared s, L, B, w, D, sw, sh, xx, x, a, y, aa
  3. Dim Shared ctlS, ctlL, ctlB, ctlW, ctlD
  4.  
  5. sw = 800
  6. sh = 600
  7. Screen _NewImage(sw, sh, 32)
  8.  
  9. InitControls
  10. DrawEgg
  11.  
  12. Sub DrawEgg
  13.     Cls
  14.     s = ctlS.value
  15.     L = ctlL.value / 10
  16.     B = ctlB.value / 10
  17.     w = ctlW.value / 10
  18.     D = ctlD.value / 10
  19.    
  20.     For xx = -0.5 * L * s To 0.5 * L * s
  21.         x = xx / s
  22.         a = (L * L - 4 * x * x) / (L * L + 8 * w * x + 4 * w * w)
  23.         y = 0.5 * B * Sqr(a)
  24.         'you can stop here for p(x) = x
  25.  
  26.         a = Sqr(5.5 * L * L + 11 * L * w + 4 * w * w)
  27.         a = a * (Sqr(3) * B * L - 2 * D * Sqr(L * L + 2 * w * L + 4 * w * w))
  28.         a = a / (Sqr(3) * B * L * (Sqr(5.5 * L * L + 11 * L * w + 4 * w * w) - 2 * Sqr(L * L + 2 * w * L + 4 * w * w)))
  29.  
  30.         aa = L * (L * L + 8 * w * x + 4 * w * w)
  31.         aa = aa / (2 * (L - 2 * w) * x * x + (L * L + 8 * L * w - 4 * w * w) * x + 2 * L * w * w + L * L * w + L * L * L)
  32.         aa = 1 - aa
  33.  
  34.         y = y * (1 - a * aa)
  35.  
  36.         Line (sw / 2 + xx, sh / 2 - s * y)-(sw / 2 + xx, sh / 2 + s * y)
  37.     Next
  38.  
  39. Sub InitControls
  40.     Dim c: c = DomCreate("div")
  41.     c.style.padding = "20px"
  42.    
  43.     DomCreate "span", c, "s: "
  44.     Dim e: e = DomCreate("input", c)
  45.     e.type = "range"
  46.     e.style.width = "125px"
  47.     e.style.verticalAlign = "middle"
  48.     e.min = 1
  49.     e.max = 100
  50.     e.step = 1
  51.     e.value = 80
  52.     ctlS = e
  53.        
  54.     e = DomCreate("span", c, "L: ")
  55.     e.style.marginLeft = "20px"
  56.     e = DomCreate("input", c)
  57.     e.type = "range"
  58.     e.style.verticalAlign = "middle"
  59.     e.style.width = "125px"  
  60.     e.min = 1
  61.     e.max = 100
  62.     e.value = 54
  63.     ctlL = e
  64.  
  65.     e = DomCreate("span", c, "B: ")
  66.     e.style.marginLeft = "20px"
  67.     e = DomCreate("input", c)
  68.     e.type = "range"
  69.     e.style.verticalAlign = "middle"
  70.     e.style.width = "125px"  
  71.     e.min = 1
  72.     e.max = 100
  73.     e.value = 41
  74.     ctlB = e
  75.            
  76.     e = DomCreate("span", c, "w: ")
  77.     e.style.marginLeft = "20px"
  78.     e = DomCreate("input", c)
  79.     e.type = "range"
  80.     e.style.verticalAlign = "middle"
  81.     e.style.width = "125px"  
  82.     e.min = 1
  83.     e.max = 20
  84.     e.value = 4
  85.     ctlW = e
  86.  
  87.     e = DomCreate("span", c, "D: ")
  88.     e.style.marginLeft = "20px"
  89.     e = DomCreate("input", c)
  90.     e.type = "range"
  91.     e.style.verticalAlign = "middle"
  92.     e.style.width = "125px"  
  93.     e.min = 1
  94.     e.max = 100
  95.     e.value = 32
  96.     ctlD = e
  97.                        
  98.     DomEvent ctlS, "input", sub_DrawEgg
  99.     DomEvent ctlL, "input", sub_DrawEgg
  100.     DomEvent ctlB, "input", sub_DrawEgg
  101.     DomEvent ctlW, "input", sub_DrawEgg
  102.     DomEvent ctlD, "input", sub_DrawEgg
  103.  

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Easter Egg Decorating
« Reply #29 on: April 01, 2022, 09:54:52 am »
Holy crap, vince and dbox win. Bro, lemme make that link bigger:

THIS THIS THIS
You're not done when it works, you're done when it's right.