-3
0
Challenge:
To take two points on the plane and figure out the position of the point that's a) on the line that connects them, and b) equally distant from each of the original points.
Example:
(0,0), (3,3) -> (1.5,1.5)
(-1,-1), (1,1) -> (0,0)
(-7,3), (2,-2) -> (-2.5,0.5)
(3, 1), (-5,9) -> (-1,5)
Rules:
- The input and output can be a tuple, array, list, or any other type of sequence.
- There must be two inputs, each representing a point.
- The output has to support floating point numbers.
Shortest solution in bytes wins.
6Some more test cases would probably be a good idea. Maybe
((-2,3), (5,4))
,((-7,-5),(-7,-5))
would be a good start. – Jonathan Allan – 2017-04-20T21:52:55.3802May input be two complex numbers? May output be a complex number? – Jonathan Allan – 2017-04-20T22:25:12.893
Is there any relevance of the "on a plane" part? Any two arbitrary points share infinitely many planes, and the desired point is shared by all of them. – Julian Wolf – 2017-04-20T22:29:55.843
2@JulianWolf I take "point on a plane" to signify a 2d coordinate system. – Sparr – 2017-04-20T23:32:00.150
@Sparr: that makes sense, thanks. I guess my mind treats "on a plane" as being distinct from "on the plane". (This is probably due to me not talking to enough actual mathematicians.) – Julian Wolf – 2017-04-20T23:34:45.187
contrast to "point on a line" or "point in a volume/space" – Sparr – 2017-04-20T23:37:53.900
Can we take input as a list containing both pairs? – Rɪᴋᴇʀ – 2017-04-21T02:55:40.273
@Riker. No, there must be two input values, each representing a single point. – Caleb Kleveter – 2017-04-21T12:29:04.610