1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00
ZoKrates/zokrates_cli/examples/structs/add.zok
2022-06-01 00:04:40 +02:00

18 lines
310 B
Text

struct Point {
field x;
field y;
}
def main(Point p, Point q) -> Point {
field a = 42;
field d = 21;
field dpxpyqxqy = d * p.x * p.y * q.x * q.y;
return Point {
x: (p.x * q.y + q.x * p.y) / (1 + dpxpyqxqy),
y: (q.x * q.y - a * p.x * p.y) / (1 - dpxpyqxqy)
};
}