Notebook - Welcome to Notebook

Contact/Report Bugs
You can contact me at: bkenwright@xbdev.net












const len2 a return Math sqrt a x 2 a y 2 const len3 a return Math sqrt a x 2 a y 2 a z 2 const dot2 a b return a x b x a y b y const dot3 a b return a x b x a y b y a z b z const sub2 a b return x a x b x y a y b y const sub3 a b return x a x b x y a y b y z a z b z const scale2 a b return x a x b y a y b const sign a return a 0 0 1 0 1 0 const vec2 a b return x a y b const vec3 a b c return x a y b z c const vec2a aa return x aa x y aa y const abs2 a return x Math abs a x y Math abs a y const abs3 a return x Math abs a x y Math abs a y z Math abs a z const max2 a b return x Math max a x b x y Math max a y b y const max3 a b return x Math max a x b x y Math max a y b y z Math max a z b z const min2 a b return x Math min a x b x y Math min a y b y const mat2 a b c d return m0 a m1 b m2 c m3 d const mat2t m v return vec2 m m0 v x m m2 v y m m1 v x m m3 v y const mat3 a b c d e f g h i return m0 a m1 b m2 c m3 d m4 e m5 f m6 g m7 h m8 i const mat3t m v return vec3 m m0 v x m m3 v y m m6 v z m m1 v x m m4 v y m m7 v z m m2 v x m m5 v y m m8 v z function sphere2 p r return len2 p r function ellipse2 p r let k0 len2 x p x r x y p y r y let k1 len2 x p x r x r x y p y r y r y return k0 k0 1 0 k1 function sphere p r return len3 p r function ellipse p r let k0 len3 x p x r x y p y r y z p z r z let k1 len3 x p x r x r x y p y r y r y z p z r z r z return k0 k0 1 0 k1 function mix x y a return 1 a x y a function clamp x minVal maxVal return Math min Math max x minVal maxVal function blend d1 d2 k let h clamp 0 5 0 5 d2 d1 k 0 0 1 0 return mix d2 d1 h k h 1 0 h function roundCone p r1 r2 h let q vec2 len2 vec2 p x p z p y let b r1 r2 h let a Math sqrt 1 0 b b let k dot2 q vec2 b a if k 0 0 return len2 q r1 if k a h return len2 sub2 q vec2 0 0 h r2 return dot2 q vec2 a b r1 function pawnx p var p2 vec2 len2 vec2 p x p z p y var dt sphere2 sub2 vec2 0 1 p2 1 0 var dn ellipse2 sub2 vec2 0 0 15 p2 vec2 1 0 0 3 var dw0 ellipse2 sub2 vec2 0 0 p2 vec2 0 5 0 8 var dw1 ellipse2 sub2 vec2 0 2 3 p2 vec2 0 9 0 3 var dw2 ellipse2 sub2 vec2 0 2 1 p2 vec2 1 4 0 3 var db0 ellipse2 sub2 vec2 0 2 3 p2 vec2 1 2 0 6 var db1 ellipse2 sub2 vec2 0 3 3 p2 vec2 2 0 0 6 var db2 ellipse2 sub2 vec2 0 3 8 p2 vec2 2 1 0 5 var r blend dt dn 0 3 r Math min r blend dw0 dw1 3 0 r Math min r dw2 r Math min r blend blend db0 db1 1 2 db2 0 3 return r function box2 p r var d sub2 abs2 p r return Math min Math max d x d y 0 0 len2 max2 d vec2 0 0 0 0 function box3 p r var d sub3 abs3 p r return Math min Math max d x Math max d y d z 0 0 len3 max3 d vec3 0 0 0 function base p rad let p2 vec2 len2 vec2 p x p z p y let dn ellipse2 sub2 vec2 0 1 0 p2 vec2 1 3 rad 1 0 let db0 ellipse2 sub2 vec2 0 2 3 p2 vec2 1 6 rad 0 6 let db1 ellipse2 sub2 vec2 0 3 3 p2 vec2 2 5 rad 0 6 let db2 ellipse2 sub2 vec2 0 3 8 p2 vec2 2 6 rad 0 5 let dw ellipse2 sub2 vec2 0 2 1 p2 vec2 1 8 rad 0 3 let r blend blend db0 db1 1 0 db2 0 3 r Math min r dw return r function base1 p return base p 1 0 function rook p let base base1 p let p2 vec2 len2 vec2 p x p z p y let dn ellipse2 sub2 vec2 0 1 0 p2 vec2 1 2 1 3 let dc ellipse2 sub2 vec2 0 0 5 p2 vec2 1 7 0 2 let r blend base dn 1 0 r blend r dc 1 4 const xx box2 sub2 vec2 1 4 1 1 p2 vec2 0 2 0 6 r Math min r xx let b3 p const ang 3 141593 2 0 3 0 const rot mat2 Math cos ang Math sin ang Math sin ang Math cos ang for let i 0 i 3 i r Math max r box3 sub3 vec3 0 1 4 0 b3 vec3 2 0 0 6 0 2 let b3xz mat2t rot vec2 b3 x b3 z b3 vec3 b3xz x b3 y b3xz y return r function knight p let base base1 p p x Math abs p x let ds1 sphere sub3 vec3 0 0 2 0 0 0 p 4 0 let ds2 ellipse sub3 vec3 0 0 2 0 0 0 p vec3 2 0 5 0 1 8 let dn roundCone sub3 vec3 0 3 1 0 0 5 p 0 8 2 2 2 2 let dncut ellipse sub3 vec3 2 2 0 0 0 0 p vec3 1 5 2 5 5 0 const a 1 3 const rot mat3 1 0 0 0 Math cos a Math sin a 0 Math sin a Math cos a const gg sub3 vec3 0 0 2 5 0 5 p let dh roundCone mat3t rot gg 1 2 0 6 1 9 let de ellipse sub3 vec3 0 5 3 5 0 5 p vec3 0 4 0 5 0 35 let dhcut1 0 5 p x let dhcut2 sphere sub3 vec3 2 1 2 8 1 9 p 2 0 let dhs ellipse sub3 vec3 0 0 2 2 0 0 p vec3 2 0 1 3 2 3 let r2 Math max dn dncut let h dh h Math max h dhcut1 h Math max h dhcut2 h Math max h dhs h Math min h Math max de dhcut1 r2 blend r2 h 0 7 return Math min base Math max Math max r2 ds1 ds2 console log d rook x 1 y 2 z 0 Combined SDF function combinedSDF x y z let point x x y y z z let bb knight point return bb let pawn2 pawnx x x y y z z return pawn2 Test the combined SDF function function renderSDF let canvas document createElement canvas canvas width 600 canvas height 600 document body appendChild canvas let ctx canvas getContext 2d let z 0 Fixed z value for 2D cross section for let x 0 x canvas width x for let y 0 y canvas height y let sx x canvas width 10 5 let sy y canvas height 10 5 let d combinedSDF sx sy z let color Math max Math min 1 d 1 0 255 ctx fillStyle rgb color color color ctx fillRect x y 1 1 if d aa d aa 0 01 ctx fillStyle red ctx fillRect x y 1 1 var aa 0 2 renderSDF

y 0 0 len2 max2 d vec2 0 0 0 0 function box3 p r var d sub3 abs3 p r return Math min Math max d x Math max d y d z 0 0 len3 max3 d vec3 0 0 0 function base p rad let p2 vec2 len2 vec2 p x p z p y let dn ellipse2 sub2 vec2 0 1 0 p2 vec2 1 3 rad 1 0 let db0 ellipse2 sub2 vec2 0 2 3 p2 vec2 1 6 rad 0 6 let db1 ellipse2 sub2 vec2 0 3 3 p2 vec2 2 5 rad 0 6 let db2 ellipse2 sub2 vec2 0 3 8 p2 vec2 2 6 rad 0 5 let dw ellipse2 sub2 vec2 0 2 1 p2 vec2 1 8 rad 0 3 let r blend blend db0 db1 1 0 db2 0 3 r Math min r dw return r function base1 p return base p 1 0 function rook p let base base1 p let p2 vec2 len2 vec2 p x p z p y let dn ellipse2 sub2 vec2 0 1 0 p2 vec2 1 2 1 3 let dc ellipse2 sub2 vec2 0 0 5 p2 vec2 1 7 0 2 let r blend base dn 1 0 r blend r dc 1 4 const xx box2 sub2 vec2 1 4 1 1 p2 vec2 0 2 0 6 r Math min r xx let b3 p const ang 3 141593 2 0 3 0 const rot mat2 Math cos ang Math sin ang Math sin ang Math cos ang for let i 0 i 3 i r Math max r box3 sub3 vec3 0 1 4 0 b3 vec3 2 0 0 6 0 2 let b3xz mat2t rot vec2 b3 x b3 z b3 vec3 b3xz x b3 y b3xz y return r function knight p let base base1 p p x Math abs p x let ds1 sphere sub3 vec3 0 0 2 0 0 0 p 4 0 let ds2 ellipse sub3 vec3 0 0 2 0 0 0 p vec3 2 0 5 0 1 8 let dn roundCone sub3 vec3 0 3 1 0 0 5 p 0 8 2 2 2 2 let dncut ellipse sub3 vec3 2 2 0 0 0 0 p vec3 1 5 2 5 5 0 const a 1 3 const rot mat3 1 0 0 0 Math cos a Math sin a 0 Math sin a Math cos a const gg sub3 vec3 0 0 2 5 0 5 p let dh roundCone mat3t rot gg 1 2 0 6 1 9 let de ellipse sub3 vec3 0 5 3 5 0 5 p vec3 0 4 0 5 0 35 let dhcut1 0 5 p x let dhcut2 sphere sub3 vec3 2 1 2 8 1 9 p 2 0 let dhs ellipse sub3 vec3 0 0 2 2 0 0 p vec3 2 0 1 3 2 3 let r2 Math max dn dncut let h dh h Math max h dhcut1 h Math max h dhcut2 h Math max h dhs h Math min h Math max de dhcut1 r2 blend r2 h 0 7 return Math min base Math max Math max r2 ds1 ds2 console log d rook x 1 y 2 z 0 Combined SDF function combinedSDF x y z let point x x y y z z let bb knight point return bb let pawn2 pawnx x x y y z z return pawn2 Test the combined SDF function function renderSDF let canvas document createElement canvas canvas width 600 canvas height 600 document body appendChild canvas let ctx canvas getContext 2d let z 0 Fixed z value for 2D cross section for let x 0 x canvas width x for let y 0 y canvas height y let sx x canvas width 10 5 let sy y canvas height 10 5 let d combinedSDF sx sy z let color Math max Math min 1 d 1 0 255 ctx fillStyle rgb color color color ctx fillRect x y 1 1 if d aa d aa 0 01 ctx fillStyle red ctx fillRect x y 1 1 var aa 0 2 renderSDF

2dracecargame
3dplot
a4print
about
acejs
acejs2
acejs3
aessecurity
angularjs
animbackgroundimage
aseformat
assert
asteroidsjs
backgrounds01
backgrounds02
backgrounds03
barnsleyfern
base26
base64
bib
binary
bodypix
bouncy
box2dweb
breakoutjs
browserversion
buslanes
busybutton
bvhreader
calendar
candycrush
candycrush2
canvas
canvas2
canvas3
canvasmandelbrot
canvasmandelbrot2
canvasnumbers
canvaszoom
capsule
changingimages
chaosgame
chaosrandom
chaosrandomhisto
chaosrandomhisto2
chatgptusingopenai
chatgptusingopenai2
chatgptusingopenai3
checkboxtoggle
chinesetiles
classes
classfeatures
clipboardbutton
clonenode
codedropdown
codemirror
codemirror2
collada
colorpick
columnresizer
contextmenu
convnet
cookiebanner
countdown
countdown2
countdown3
crop
css3dbarchart
css3dbarchart2
css3dbook
css3dscene
csscube
csscube2
csscube3
csscubevideos
cssfilelist
csshas
csspulse
cssresizeaspect
cssspin
csszooming
csvtoarray
curleffect
customcheckbox
d3datamap
d3js
d3js10
d3js11
d3js2
d3js3
d3js4
d3js5
d3js6
d3js7
d3js8
d3js9
d3jsanimatedgrid
d3jsarctransition
d3jsarctransition2
d3jsaxis
d3jsaxischanging
d3jsbars
d3jsbrushing
d3jsbuslanes
d3jsbuslanes2
d3jscalendar
d3jscheat
d3jsclock
d3jscloudmap
d3jscogs
d3jscolors
d3jscovid
d3jscovid2
d3jscovid3
d3jsdashboard
d3jsdashboard2
d3jsdashboard3
d3jsdatakeyfunction
d3jsdensity
d3jsdragresizing
d3jsdragresizing2
d3jseach
d3jsease
d3jsevents
d3jsflower
d3jsforcegroups
d3jsforces
d3jsforces2
d3jsfractaltree
d3jsgeo
d3jsgroupbars
d3jsgroups
d3jsheatmap
d3jshex
d3jshierarchies
d3jshierarchies2
d3jshistogram
d3jshistogram2
d3jshistogram3
d3jshistogram4
d3jsinterpolate
d3jsjoin
d3jskmean
d3jskmean2
d3jsline
d3jsline2
d3jsline3
d3jsline4
d3jslinetransition
d3jslinetransition0
d3jslinetransition2
d3jsmaplocations
d3jsmaps
d3jsmaps2
d3jsmaps3
d3jsmisc
d3jsmisc2
d3jsmodule
d3jsmodulecolor
d3jsmultistyles
d3jsnobel
d3jsoverlappinggraphs
d3jspanel
d3jspie
d3jspieinterpolate
d3jssankey
d3jssankey2
d3jsscatter
d3jsshapes
d3jsslider
d3jsspending
d3jsspending2
d3jsspiralplot
d3jsspirograph
d3jssquare
d3jsstack
d3jsstackedbar
d3jsstackedbar2
d3jssunburst
d3jssunmoon
d3jssvglines
d3jssymbols
d3jstimelines
d3jsuk
d3jsvoronoi
d3scatterplot
d3timeline
d3timeline2
datalist
datamuse
date
dblclickhighlight
deviceorientation
dictionaryapi
dockermenu
doodlepad
downloadgif
dragdroplistitems
dragrotateresizediv
dragrotateresizediv2
dragrotateresizediv3
dragrotateresizediv4
dragrotateresizefontsize
dragselectbrush
drawlinesdiv
dropdown
dualquaternionimages
dynamicgrid
easefunctions
easeinterpolate3dplots
echart
echart2
echart3
encapsulation
epubviewer
errorstack
excalidraw
excalidraw2
excalidraw3
excalidraw5
expandable
faker
fetchplus
fileupload
fixedtopbar
fluiddynamics
fluiddynamics2
fluiddynamics3
fluidsmokedynamics
fluidsmokedynamics2
fonts
fonts2
footerbar
fractalmaze
fractalmaze2
fractalnoiseimage
fractals
fractals2
fractaltree
freesvg
fresnel
froggerjs
gantt
gifgiphyapi
gifhex
gltffromscratch
gradients
griditems
griditems2
griditems3
griditems4
gridworms
heat
hexview
hexview2
highlight
icons
icons2
iframes
ik
imagetracertosvg
imgur
inputfile
invadersjs
ipynb
ipynb2
ipynb3
ipynb4
isbn13
isbn2
jpghex
jquery
jquery2
jqueryui
jqueryui2
jsdraganddrop
jsfire
jslint
jsobfuscate
jsraytracer
jstree
jstree2
jszip
jszipimages
jszipread
keyframes
l2dwidget
lda
leftmenu
less
less2
lineargradientimage
linenumbers
loadimagefromfile
makepdf
maps
markdown
markdown2
markdownalerts
markdownalerts2
markdownbookmarks
markovimage
markovpixelblocks
mathjax
matrices
matsandvects
mazegamejs
md2tex
metrotiles
metrowindows
milestones
minkowski2dboxes
misc
misc2
modules
myipdetails
mymodplotly
neataptic
networkstructures
networkstructures2
neural_network_drawshape
neural_network_plot_in_vs_out
neuralnetworkarrays
neuralnetworkblocks
neuralnetworksinewave
neuralnetworksnolibs
neuralnetworkvisualization
number
obj
objtojson
openaiimages
opencv
opencv2
opencv3
opencv4
opencv5
outline
p2
p5fractalleaf
p5fractalshape
p5js
p5js2
p5js3
p5jsanimatedcover
p5mengercube
p5snowflakes
palindrome
panel
parallax
paste
paste2
pasteimgfromurl
pdfjs
pdfjs2
pdfkit
pdfkit2
pdfkit3
pdfkit4
pdfkit5
pdfkit6
pdfmake
pdfmake2
pdfmake3
pdfmake4
pdfmake5
pdfmake6
perlin
perlin2
perlin3
perspective
pexels
pixelgridpattern
playground
plotly
plotlynoise
plotlyranddist
plyloader
plyloader2
pngtxtencoder
pongjs
pptxgenjs
prettycode
prism
prn
problems
progress
pseudorandom
px2svg
python
quotes
racergame
random
randomcalcpie
randomgenerator
randomprofilepatterns
randomsinhistogram
randomstring
rating
rayambient
raymonte
raymonteprogressive
raymonteprogressive2
raymontewarmstart
reexpcross
reexpcross2
regex
regexbib
regexpfixbib
regexpmultiline
repeatwordsregexp
resizabletable
resizabletable2
revealjs
revealjs2
revealjsmulti
ritalanguage
ritalanguage2
ritalanguage3
rotateimg
rough
rsapublicprivatekeys
rss
rss2
sankey
scrappingsvg
scrolltext
scrolltext2
scrollwidth
sdf2dcanvas
sdfboxinboxtwist
sdfchessbishop
sdfchessking
sdfchessknight
sdfchesspawn
sdfchessqueen
sdfchessrook
sdfhollowbox
setintervalexception
shareurl
shuffle
sidecomment
similarity
simplehighlighter
simpleplatformgamejs
sinecanvas
sliderpopout
slides
smileys
snowfall
snowman
sound
soundsignal
sphererayintersection
springs
sqljs
steganography
stereogram
stringmatching
sudoku
sudoku2
sudoku3
svg
svgchaos
svgdragresize
svgdragresize2
svgdragresize3
svgdragrotate
svgdrawing
svglines
svglines2
svglines3
svglines4
svglines5
svglinesmandelbrot
svgpathsdragrotate
svgpathsdragrotateresize
svgpie
svgpie2
svgpie3
svgpiepath
svgpiepath2
svgrandomfaces
symbols
synaptic
synaptic2
synonyms
tablerotatecells
tablerotatecells2
tablerotatecells3
tablerotatecells3b
tablerotatecells4
tables
tablezebra
tabularjs
tabularjs2
tabulatordownload
tagcanvas
tensorflowgan
tensorflowjs
tensorflowjsbasic
tensorflowjscnn
tensorflowjssinewave
tensorflowjssound
tensorflowmobilenet
tetrahedronfractal
tetrahedronfractalfolding
tetris
textarea
textareaauto
textareadiv
textareadiv2
textmaskimage
theirorthere
thesaurus
threejs
threejs2
threejs3
threejs4
threejsgltf
threejstokyo
tiles
toaster
tooltip
transition
transitionexpandabledropdown
treeview
treeview2
tricks
tshirt
tshirt2
tshirt3
turningpages
unsplash
urlblob
urlblob2
userdefinepoints
vector
videos
videos2
visualsort
vue
w2ui
w2uientertextdialog
webcam
webgl
webgl2
webgl3
webgl4
webgl5
webglbasic1
webglbasic2
webglcube
webglfov
webglfrustum
webgljson
webglleaves
webgllighting
webglorthographic
webglpoints1
webglpoints2
webglpoints3
webglsquare
webgltexture1
webgltexture2
webgltexture3
webgltransforms
webgltriangle
webgpu
webgpu10
webgpu11
webgpu12
webgpu13
webgpu14
webgpu15
webgpu16
webgpu17
webgpu2
webgpu3
webgpu4
webgpu5
webgpu6
webgpu7
webgpu8
webgpu9
webgpubars
webgpubuffers
webgpubuffers2
webgpucellnoise
webgpuclouds
webgpuclydescope
webgpucompute
webgpucubemap
webgpucubemap2
webgpudeferred
webgpudepth
webgpudof
webgpudrops
webgpuetha
webgpufire
webgpufractalcubes
webgpuglassrain
webgpugltf
webgpugltf2
webgpugrass
webgpugrid
webgpukernel
webgpukleinian
webgpulabupdates
webgpulighting
webgpumandelbrot
webgpumeta3d
webgpumetaballs
webgpumouse
webgpunoise
webgpunormalmapping
webgpuobj
webgpuparallax
webgpuparallax2
webgpuparallax3
webgpuparallaxshadow
webgpuparallaxshadow2
webgpupixel
webgpuquad
webgpuray1
webgpuraytracing
webgpuraytracing2
webgpushadowmaps
webgpushadowmaps2
webgpusierpinski2d
webgpusierpinski3d
webgpusinusoid
webgpussao
webgpustadiumobj
webgpuswirl
webgputestpipe3
webgputoon
webgputopology
webgputt
webgpuvolcloud
webgpuwater
webgpuwireframe
webgpuwireframe2
webpcanvas
webworkers
webxr
webxr2
wiggly
wikipedia