Logo

Programming-Idioms

History of Idiom 179 > diff from v4 to v5

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

Version 4

2019-01-24, 13:21:03

Version 5

2019-01-24, 13:21:04

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})