1
0
Fork 0
mirror of synced 2025-09-24 04:40:05 +00:00
ZoKrates/zokrates_cli/examples/structs/add.code
2019-09-30 13:49:54 +02:00

16 lines
278 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)
}