Jigsaw Puzzle, cutting pieces from image

风格不统一 提交于 2019-12-10 20:41:07

问题


I'm trying to make an application that cuts image into jigsaw puzzles. My problem is that I don't know how to do this (any kind of algorithm). I do want to have male and female endings of puzzles, but not in the same place all the time (like in the middle of puzzle border) so this: https://stackoverflow.com/questions/2755389/how-to-create-jigsaw-image-puzzle-using-c solution doesn't fit me.

Is there any kind of "smart" algorithm to make this happens. I was thinking about using bezier curves, but I don't know how to do this right.


回答1:


You could use a random offset. You store for each side the kind of interaction (ie male or female), the anchor type (you could use a set of different looking "anchors" (don't know the name), and the offset.

This make for easy check : you must have same anchor, same offset and different kind for the two piece to be able to link.

regards
Guillaume




回答2:


There is a sketch of how I'd approach it here: How to create jigsaw puzzle from an image using javascript




回答3:


Randomization is your savior! Won't randomizing the position of the curve help?



来源:https://stackoverflow.com/questions/4583776/jigsaw-puzzle-cutting-pieces-from-image

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!