Apollonian Gasket: Now uses equations lazarus / 39-Graphics ---------------------------------------------------------------------- Boleeman · 2024-06-08 05:53 An Apollonian Gasket made by using IFS and another that uses equations. Made a new one using BgraBmp, quadratic formula and ellipse (3rd reply below) A bit sluggish. Need to fill it with colours, Would love to work out how to make a nested version. On https://codegolf.stackexchange.com/questions/38450/draw-an- apollonian-gasket  it can be implemented as a javascript function to draw an SVG of it. I wonder if this could be converted and used with BgraBmp to draw that Nested Apollonian Gasket. http://jsfiddle.net/8L8kwa1p/2/ Here is the Javascript function: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  function A(s){P='';Q=[];s=eval(s);S=-400*s[0][0];function d(c){P+=''}for(c=4;c-- ;d(s[0]),s.push(s.shift()))Q.push(s.slice());for(;s=Q.shift();d(c)){c= [];for(i=4;i--;)c[i]=2*(s[0][i]+s[1][i]+s[2][i])- s[3][i];for(i=6;c[0] ---------------------------------------------------------------------- Josh · 2024-06-08 13:00 hi just looked at code in v2. can you replace and see if it works. added some checks Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TForm1.QuadraticSolutions(a, b, c: Double): TDoubleValueList;const  tiny = 0.01;var  discriminant: Double;  results: TDoubleValueList;begin  // Prevent division by a very small number  if Abs(a) < tiny then Exit;  SetLength(results, 0);  discriminant := b * b - 4 * a * c;  if discriminant < 0 then Exit;  if Abs(discriminant) < tiny then  begin    // 1 root    SetLength(results, 1);    results[0].Value := -b / (2 * a);    Result := results;    Exit;  end;  // 2 roots  SetLength(results, 2);  results[0].Value := (-b + Sqrt(discriminant)) / (2 * a);  results[1].Value := (-b - Sqrt(discriminant)) / (2 * a);  Result := results;end; ---------------------------------------------------------------------- AlexTP · 2024-06-08 14:57 1. 'results' var is not needed, since you can use Result var. 2. func result is not inited if 1st or 2nd Exit runs! Add line   Result:= nil; at the start. ---------------------------------------------------------------------- Boleeman · 2024-06-09 11:05 Thanks for the fixes. For some reason I did not get divide by zero error on Win 10 OS. Might be good to make threaded to speed up the rendering.