How to make a real Mini Game jigsaw puzzle with Matlab
This article mainly introduces how to use Matlab to make a real jigsaw puzzle Mini Game, the article introduces in great detail, has a certain reference value, interested friends must read it!
A brief introduction to the principle:
1 construct 0 image 1 matrix as the transparency of each puzzle, you can construct an irregularly shaped puzzle (the jigsaw function has an alphaData attribute that can be set)
JigsawMask=zeros (101 / 5101 / 5); jigsawMask (102 / 5101 / 404) = 1; [xMesh,yMesh] = meshgrid (1 / 10 / 10 / 5 / 5); dis1=sqrt ((xMesh-51). ^ 2 + (yMesh-253). ^ 2); dis2=sqrt (xMesh-505+50). ^ 2 + (yMesh-253). ^ 2); dis3=sqrt ((xMesh-253). ^ 2 + (yMesh-152). ^ 2); dis4=sqrt ((xMesh-253). ^ 2 + (yMesh-505+151). ^ 2); bool1=dis1