Logo

Programming-Idioms

History of Idiom 179 > diff from v3 to v4

Edit summary for version 4 by 1.7.4:
New JS implementation by user [1.7.4]

Version 3

2019-01-11, 16:53:43

Version 4

2019-01-24, 13:21:03

Idiom #179 Get center of a rectangle

Return the center c of the rectangle with coördinates(x1,y1,x2,y2)

Idiom #179 Get center of a rectangle

Return the center c of the rectangle with coördinates(x1,y1,x2,y2)

Code
const center = ({x1, y1, x2, y2}) => ({x: (x1 + x2) / 2, y: (y1 + y2) / 2})