Hi everyone!

I intend to propose a new G'MIC filter "Rendering / Equation Plot [Implicit]".
With default parameters, it would give:
Attachment:
equationPlot.png [ 15.03 KiB | Viewed 8175 times ]
Here is its code:
#@gui ____<b>Rendering</b>
#------------------
#@gui Equation Plot [Implicit] (prerelease): cl_implicitEqua_prerelease, cl_implicitEqua_prerelease(1)
#@gui : note = note["Plot the equation: f(x,y)=0"]
#@gui : sep = separator()
#@gui : f(x,y) = text{"( x^2 + y^2 - 25 ) * ( (x-2)^2 + (y-2)^2 - 1 ) * ( (x+2)^2 + (y-2)^2 - 1 ) * ( abs(x) + abs(y) - 1 ) * ( x^2 + (4*y+12-x^2)^2 - 9 )"}
#@gui : Width (pixels) = int(500, 10, 2000)
#@gui : Height (pixels) = int(500, 10, 2000)
#@gui : Min x = float[-6, -10000, 10000]
#@gui : Max x = float[6, -10000, 10000]
#@gui : Min y = float[-6, -10000, 10000]
#@gui : Max y = float[6, -10000, 10000]
#@gui : Axes = bool(0)
#@gui : Grid = bool(0)
#@gui : Grid Cell Size = int(1,1,5)
#@gui : sep = separator()
#@gui : note = note("<small>Author: <i>Claude Lion</i>. Latest Update: <i>2024/10/17</i>.</small>")
cl_implicitEqua_prerelease:
equ,w,h,minx,maxx,miny,maxy,axes,grid,gridSize=$"*"
xlong={$maxx-$minx}
ylong={$maxy-$miny}
xscale={$w/$xlong}
yscale={$h/$ylong}
foreach {
$w,$h,1,1,"x=x/$xscale+$minx;y=-y/$yscale-$miny;$1"
+gradient_norm.
fill. "255* cut( abs(i#-2), 0, i ) / i"
rm..
if $axes==1
$w,$h,1,1,"X=x/$xscale+$minx;Y=-y/$yscale-$miny;X*Y"
+gradient_norm.
fill. "255* cut( abs(i#-2), 0, i ) / i"
rm..
else
$w,$h,1,1,"255"
fi
if $grid==1
$w,$h,1,1,"X=x/$xscale+$minx;Y=-y/$yscale-$miny;sin(pi*X/$gridSize)*sin(pi*Y/$gridSize)"
+gradient_norm.
fill. "255* cut( abs(i#-2), 0, i ) / i"
rm..
else
$w,$h,1,1,"255"
fi
move[-1] -3
append. [-2],c append. [-3],c
rm.. rm.. move[-1] 0
}
Installation:
- Copy and paste the above code into the file "~/.gmic" on Linux or the file "%USERPROFILE%\user.gmic" on Windows.
- The new filter appears in "Filters -> G'MIC -> Rendering -> Equation Plot [Implicit] (prerelease)".
EDIT: APPDATA has been replaced by USERPROFILE
Have fun!
