Recent

Author Topic: Circle Fractal: Many Cool Additions Added by Josh  (Read 4926 times)

Josh

  • Hero Member
  • *****
  • Posts: 1344
Re: Circle Fractal: Beginnings, with more to add.
« Reply #15 on: February 27, 2024, 04:23:58 pm »
forgot
add fixed color change,  right click panel for menu.

« Last Edit: February 27, 2024, 05:01:53 pm by Josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: Circle Fractal: Beginnings, with more to add.
« Reply #16 on: February 28, 2024, 08:57:54 am »
Josh, thanks for the updates. Apologies for disappearing yesterday, as I was feeling a bit off (badly sore ear).

I looked at your two circle fractal updates and experimented. Tried changing the divisor slightly from R /4.2 to R/3.8. Some nice patterns happening. I also did a shape insertion in the middle of the circle fractal with a paint program, just to see the effect.

Looking good. I especially like the color scheme generated circle fractal with R/3.8, with the bright smaller upper level petals.

Your random colour mode with opacity now has a "jeweled like effect".

Need to understand how you did that opacity with bgrabmp so will need to go over that:
   if FillBackGround then bmp.EllipseAntialias(X, Y,R+RAdjust, R+RAdjust,ColorToBGRA(PenColor,tb_Opacity.Position),PenWidth,ColorToBGRA(BrushColor,tb_Opacity.Position))
   else bmp.EllipseAntialias(X, Y,R+RAdjust, R+RAdjust,ColorToBGRA(PenColor,tb_Opacity.Position),PenWidth);

Dzandaa used  PictOrig := TBGRABitmap.Create(w, h, BGRAPixelTransparent);  and   PictOrig.FillPoly(Pt, Col, dmDrawWithTransparency, True); to do the fills. Wondering what the difference is?


Also with the Pythagoras Tree here (https://forum.lazarus.freepascal.org/index.php/topic,66256.0.html) I used Luminance to filter out some of the colours (to make either dark or light random colours)

Code: Pascal  [Select][+][-]
  1. function GetLuminance(color: TColor): Double;
  2. var
  3.   r, g, b: Byte;
  4. begin
  5.   r := Red(color);
  6.   g := Green(color);
  7.   b := Blue(color);
  8.   Result := 0.2126 * r / 255 + 0.7152 * g / 255 + 0.0722 * b / 255;
  9. end;
  10.  
  11. procedure TForm1.GenerateRandomColors;
  12. var
  13.   i: Integer;
  14. begin
  15.   SetLength(Colors, 20);
  16.   for i := 0 to High(Colors) do
  17.   begin
  18.     repeat
  19.       Colors[i] := RGBToColor(Random(256), Random(256), Random(256));
  20.     until GetLuminance(Colors[i]) > LumLimit;
  21.   end;
  22. end;  


and also transitioning from one colour to another:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.GenerateColorsBrowntoGreen;
  2. var
  3.   i: Integer;
  4.   BrownR, BrownG, BrownB: Byte;
  5.   GreenR, GreenG, GreenB: Byte;
  6.   BlendFactorFill, BlendFactorLine: Double;
  7.   MaxLevel: Integer;
  8. begin
  9.   BrownR := 101;
  10.   BrownG := 67;
  11.   BrownB := 33;
  12.  
  13.   GreenR := 0;
  14.   GreenG := 128;
  15.   GreenB := 0;
  16.  
  17.   MaxLevel := seRecursionLevel.Value;
  18.  
  19.   SetLength(Colors, MaxLevel);
  20.   for i := 0 to MaxLevel - 1 do
  21.   begin
  22.     BlendFactorFill := i / (MaxLevel - 1);
  23.     Colors[i] := RGBToColor(
  24.       Round((1 - BlendFactorFill) * BrownR + BlendFactorFill * GreenR),
  25.       Round((1 - BlendFactorFill) * BrownG + BlendFactorFill * GreenG),
  26.       Round((1 - BlendFactorFill) * BrownB + BlendFactorFill * GreenB)
  27.     );
  28.  
  29.     BlendFactorLine := i / (MaxLevel - 1);
  30.     Colors[i] := RGBToColor(
  31.       Round((1 - BlendFactorLine) * BrownR + BlendFactorLine * GreenR),
  32.       Round((1 - BlendFactorLine) * BrownG + BlendFactorLine * GreenG),
  33.       Round((1 - BlendFactorLine) * BrownB + BlendFactorLine * GreenB)
  34.     );
  35.   end;
  36. end;    


Josh, Thanks for helping to add those great features and demonstrating how to use bgrabmp.
I am still learning bgrabmp so your samples are really good for learning purposes.

I always like looking at your work and how you do things (don't always fully understand it but progressively getting better), as well as Dzandaa's nice samples.

« Last Edit: February 28, 2024, 09:18:07 am by Boleeman »

Josh

  • Hero Member
  • *****
  • Posts: 1344
Re: Circle Fractal: Beginnings, with more to add.
« Reply #17 on: February 28, 2024, 10:56:51 am »
moded to allow radius ratio adustment.

The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: Circle Fractal: Beginnings, with more to add.
« Reply #18 on: February 28, 2024, 09:03:13 pm »
Creating some brilliant Circle Fractals. with that addition of "a radial slider".

The outer rings seem to join up well.


Just thought of another feature with a radial gradient fill, so that the circles look a bit spherical (similar to Dzandaa's beaded Sunflower).

« Last Edit: February 28, 2024, 09:11:01 pm by Boleeman »

Josh

  • Hero Member
  • *****
  • Posts: 1344
Re: Circle Fractal: Beginnings, with more to add.
« Reply #19 on: February 29, 2024, 02:04:32 am »
added phong lighting option

if you bring up the popup menu to adust colors, you have a extra option set light source.its set to wher you brought up the menu.

« Last Edit: February 29, 2024, 02:25:32 am by Josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: Circle Fractal: Many Cool Additions Added by Josh
« Reply #20 on: February 29, 2024, 07:04:50 am »
"Phonging Fantastic" is all I can say.

Now the Flower Fractals have almost a gilded-like leather appearance.

Good idea with the extra option to set the light source.
 


Brilliant Josh.

Josh

  • Hero Member
  • *****
  • Posts: 1344
Re: Circle Fractal: Many Cool Additions Added by Josh
« Reply #21 on: February 29, 2024, 08:58:14 am »
Overlapping effect
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: Circle Fractal: Many Cool Additions Added by Josh
« Reply #22 on: February 29, 2024, 09:24:20 am »
Hey Josh, I worked out how to put an extra outer curve in the center in the Dzandaa version.
Also, I used a different way for the radial shift, but I think your way for radial shift achieves better results.

Code: Pascal  [Select][+][-]
  1. procedure TForm1.DrawCircle(X, Y, R: Integer; n: Integer; k: Single; isCenter: Boolean);
  2. var
  3.   int1: Integer;
  4. begin
  5.   if n < 1 then
  6.   begin
  7.     DrawPanel.Canvas.Pen.Color := clBlack;
  8.     DrawPanel.Canvas.Brush.Color := TColor($FF1493);
  9.     DrawPanel.Canvas.Pen.Width := 2;
  10.     DrawPanel.Canvas.Ellipse(X - R, Y - R, X + R, Y + R);
  11.   end
  12.   else
  13.   begin
  14.     DrawPanel.Canvas.Pen.Width := 3;
  15.     DrawPanel.Canvas.Pen.Color := cbBorderpencolor.ButtonColor;
  16.     DrawPanel.Canvas.Brush.Color := cbFillcolor.ButtonColor;
  17.     DrawPanel.Canvas.Ellipse(X - R, Y - R, X + R, Y + R);
  18.     for int1 := 1 to se_NumCircles.Value do
  19.       DrawCircle(
  20.         Round(X + (TrackBar1.Position / 100) * R * Cos((int1 - 1) * Pi / (0.5 * se_NumCircles.Value))),
  21.         Round(Y + (TrackBar1.Position / 100) * R * Sin((int1 - 1) * Pi / (0.5 * se_NumCircles.Value))),
  22.         Round(R / 3.8), n - 1, k, False);
  23.  
  24.     // Check if an extra center circle should be drawn
  25.     if isCenter then
  26.       DrawCircle(X, Y, Round(R / 3.8), n - 1, k, False);
  27.   end;
  28. end;    

That overlap version of yours looks good. Sort of marbles effect.
« Last Edit: February 29, 2024, 09:30:25 am by Boleeman »

Josh

  • Hero Member
  • *****
  • Posts: 1344
Re: Circle Fractal: Many Cool Additions Added by Josh
« Reply #23 on: February 29, 2024, 11:22:55 am »
ok

The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: Circle Fractal: Many Cool Additions Added by Josh
« Reply #24 on: February 29, 2024, 02:52:10 pm »
With my trackbar1 change I sort of got some extra play with the movement of the outer circles, along with the other radial change that you did (by changing that 4/2 divisor with a trackbar). Attached is an image to explain.

        Round(X + (TrackBar1.Position / 100) * R * Cos((int1 - 1) * Pi / (0.5 * se_NumCircles.Value))),
        Round(Y + (TrackBar1.Position / 100) * R * Sin((int1 - 1) * Pi / (0.5 * se_NumCircles.Value))),


With your latest update, I got some nice results, but the checkboxes were a bit out of sync with the image when selecting and unselecting. The image was not updating properly. After a while the problems sort of fixed themselves up (don't know why?)

After a while I got these (especially like the red one):
« Last Edit: February 29, 2024, 03:04:38 pm by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: Circle Fractal: Many Cool Additions Added by Josh
« Reply #25 on: March 01, 2024, 09:20:25 am »
Just a little animation of some sample Circle Fractals.

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: Circle Fractal: Many Cool Additions Added by Josh
« Reply #26 on: March 01, 2024, 09:56:52 am »
Just a version of the Circle Fractal (to share) that I made with bgrabmp based on Dzandaa's resizable Tpanel version. I added save to png (transparent and opaque background). Also has a radial sizing and radial displacement.

Joshes' version has the Phong shading, with all the bells and whistles.
« Last Edit: March 01, 2024, 11:23:47 am by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: Circle Fractal: Many Cool Additions Added by Josh
« Reply #27 on: March 01, 2024, 12:43:52 pm »
One more effect that would be nice to implement would be changing the HUE.
I did these in Paint.Net using the same png file.

Would anyone know how to do this with Lazarus and a TSlider?

Josh

  • Hero Member
  • *****
  • Posts: 1344
Re: Circle Fractal: Many Cool Additions Added by Josh
« Reply #28 on: March 01, 2024, 04:41:02 pm »
added save png/save png transparent in popup menu

last pic, cange pen color while drawing
« Last Edit: March 01, 2024, 05:21:55 pm by Josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Josh

  • Hero Member
  • *****
  • Posts: 1344
Re: Circle Fractal: Many Cool Additions Added by Josh
« Reply #29 on: March 01, 2024, 05:57:57 pm »
and some melting chocolate
« Last Edit: March 01, 2024, 06:04:40 pm by Josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

 

TinyPortal © 2005-2018