[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] puzzle piece problem.



Hmm. I may not be the most versed in this, but my impression is that
it would be hard to represent a jigsaw piece with a continuous
function, such as a sinusoidal. I think you might want to do it
piecewise; straight lines and part of a circle.

On Nov 7, 2007 9:31 AM, Joseph king <king.a.joe@xxxxxxxxx> wrote:
> hey it is me again on the same issue..... thanks for the help but now
> i am on to something a little easier if you program a lot.
> My issue now if you saw the code that i had which i will repost on
> this...... creating a "cookie cutter" to cut out the puzzle piece
> shape of where the user wants and size/shape the user wants......
> but i seem to be having an issue with this line of code
>
>
> Def curvature_func(pos, eb_size, xmod, ymod):
>       #A general curve to the piece kinda like a wavy line.
>       state1 = float(pos) / float(xmod) * twopi
>       state2 = float(pos) / float(ymod) * twopi
>       state3 = float(pos) / float(xmod+ymod) * twopi
>       state4 = float(pos) * (2.0/3.0) / float(xmod) * twopi
>       state5 = float(pos) * (-12.0/5.0) / float(ymod) *twopi
>
>       bgen = math.sin(state1) + math.cos (state2) + math.sin(state3)
>       bgen = bgen - mat.cos(states4) + math.cos(state5)
>
>       scale = (eb_size / 5.0
>       bgen = (bgen * (scale*0.9))
>       return int(bgen)
>
>
> seems that it only creates a very slight wave on the edge of the
> image.  but no matter what i change it does not really give me a
> jigsaw like shape.
>
> does any one have any suggestions on a better way to make it more jigsaw like.
>