Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include "../../node_modules/circomlib/circuits/comparators.circom"
- template CheckPerlin() {
- signal input addr;
- signal input c;
- signal input k;
- signal private input x;
- signal private input y;
- signal private input x0;
- signal private input y0;
- signal private input x1;
- signal private input y1;
- addr === Hash(x, y);
- x1 - x0 === 1;
- y1 - y0 === 1;
- component cxltex = LessThan(32);
- component cyltey = LessThan(32);
- cxltex.in[0] <== x;
- cxltex.in[1] <== c*x0;
- cxltex.out === 0;
- cyltey.in[0] <== y;
- cyltey.in[1] <== c*y0;
- cyltey.out === 0;
- component xltcx = LessThan(32);
- component yltcy = LessThan(32);
- xltcx.in[0] <== x;
- xltcx.in[1] <== c*x1;
- xltcx.out === 1;
- yltcy.in[0] <== y;
- yltcy.in[1] <== c*y1;
- yltcy.out === 1;
- signal dx00 <== x - c*x0;
- signal dy00 <== y - c*y0;
- signal x00 <== Hash(001, x0, y0);
- signal y00 <== Hash(002, x0, y0);
- signal dotproduct00 <== dx00*x00 + dy00*y00;
- signal weight00 <== dx00 * dy00;
- signal final00 <== weight00 * dotproduct00;
- signal final <== final00;
- component withinperlin = LessThan(32);
- withinperlin.in[0] <== final;
- withinperlin.in[1] <== k*addr;
- withperlin === 1;
- }
- component perlin = CheckPerlin();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement