POV-Ray : Newsgroups : povray.binaries.images : Automated creation of jigsaw puzzle pieces : Automated creation of jigsaw puzzle pieces Server Time
15 May 2024 06:26:59 EDT (-0400)
  Automated creation of jigsaw puzzle pieces  
From: Bald Eagle
Date: 11 Feb 2016 17:45:00
Message: <web.56bd0e473537b7735e7df57c0@news.povray.org>
I'm attempting to create a jigsaw puzzle -
because apparently I can't find any sort of software that will just create the
cut paths for any size / number of pieces, with good variation of piece shape.

I've worked out the simple grid of pieces, using splines to generate the
interlocking tab shape, and am going to add some variation to that - moving the
tab position and possibly varying the size and shape by randomly shifting and
scaling the spline coordinates within certain constraints.

I think I can work that out, but the part that I'm struggling to grasp is how I
get the interesting "offset", or what I call a sort of "double-corner" since 4
pieces don't line up at a single corner - there are now two, either in the X or
the Y direction.  (See image in next post)

I was wondering if anyone had any suggestions about how to achieve this effect
programmatically, or could describe a solution clearly enough or in pseudo-code
so that I could begin to effectively implement it.

Thanks!
===================================================================
cylinder{z,z*1.1,.65 pigment{cylindrical rotate x*90 color_map{[0 rgb<1,.2,0>]
[1 rgb xy]}}}#macro C(D,S,F,M)sin(radians(D+(F*90)+(i*S)))*A+M#end#local L=.9;
#local A=0.3125;#local i=0;#local T=.014;#macro
R(X,Y,D,S,M,N)cylinder{<X,Y,L>,<C(D,S,1,M),C(D,S,0,N),L>T}#end#macro
V(X,Y,Z,P,J,K,Q,U)cone{<X,Y,Z>P<J,K,Z>Q pigment{rgb U}}#end#while(i<8)#local
F=R(-0.243,.113,170,20,-.415,.069) #local
W=difference{R(-.172+(i/80),.328,250,5,-0.18,0.18)sphere {<-.14,.22,L>A/2.4}}
union{object{F}object{F scale-x*1}object{W}object{W scale-x*1}
cylinder{<.004,.095,L>,<-.007,-.18,L>,.1}pigment{Brown}}
cylinder{<-.008,-0.03,L>,<C(240,10,1,-.028),C(240,10,0,-.09),L>.014 pigment{rgb
1}}V(-.01,.095,L,.08,.003,.28,.021,1)V(-.001,.2,.85,0,.01,.26,.028,0)
V(.019,.23,.83,0,.026,.25,.01,xy)sphere{<.005,.25,.82>.002 pigment{rgb
1}}#declare i=i+1;#end
===================================================================


Post a reply to this message


Attachments:
Download 'jigsawpuzzle.png' (101 KB)

Preview of image 'jigsawpuzzle.png'
jigsawpuzzle.png


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.