--[[ MIT License Copyright (c) 2017 Gabriel de Quadros Ligneul Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -- Julia sets via interval cell-mapping (quadtree version) local function prequire(name) local success, result = pcall(require, name); return if success then result else nil end local bench = script and require(script.Parent.bench_support) or prequire("bench_support") or require("../../bench_support") function test() --require"julia" local f=f local io=io local root,exterior local cx,cy local Rxmin,Rxmax,Rymin,Rymax=-2.0,2.0,-2.0,2.0 local white=1.0 local black=0.0 local gray=0.5 local N=0 local nE=0 local E={} local write=print local function output(a1,a2,a3,a4,a5,a6) --[[write( a1 or ""," ", a2 or ""," ", a3 or ""," ", a4 or ""," ", a5 or ""," ", a6 or ""," \n")]] end local function imul(xmin,xmax,ymin,ymax) local mm=xmin*ymin local mM=xmin*ymax local Mm=xmax*ymin local MM=xmax*ymax local m,M=mm,mm if m>mM then m=mM elseif MMm then m=Mm elseif MMM then m=MM elseif M4.0 end local function inside(xmin,xmax,ymin,ymax) return xmin^2+ymin^2<=4.0 and xmin^2+ymax^2<=4.0 and xmax^2+ymin^2<=4.0 and xmax^2+ymax^2<=4.0 end local function newcell() return {nil,nil,nil,nil,color=gray} end local function addedge(a,b) nE=nE+1 E[nE]=b end local function refine(q) if q.color==gray then if q[1]==nil then q[1]=newcell() q[2]=newcell() q[3]=newcell() q[4]=newcell() else refine(q[1]) refine(q[2]) refine(q[3]) refine(q[4]) end end end local function clip(q,xmin,xmax,ymin,ymax,o,oxmin,oxmax,oymin,oymax) local ixmin,ixmax,iymin,iymax if xmin>oxmin then ixmin=xmin else ixmin=oxmin end if xmax=ixmax then return end if ymin>oymin then iymin=ymin else iymin=oymin end if ymax