Merge: geometry: implement 3D `dist` and improve API
authorJean Privat <jean@pryen.org>
Mon, 29 May 2017 15:07:16 +0000 (11:07 -0400)
committerJean Privat <jean@pryen.org>
Mon, 29 May 2017 15:07:16 +0000 (11:07 -0400)
commitb6782c7e70f1a8c99cead6ca79471d77f7e29367
tree510ff412b0ae6f315a294bd0807fec7478a3ee53
parent4cfa1369207bbc2bfce5724e83652f5b7dbac23a
parent165e5cd7f111f67c31598c40a03e7fff11f933c8
Merge: geometry: implement 3D `dist` and improve API

The main change in this PR is the reimplementation of `Point::dist` and `dist2` to support 3D points, including comparing 2D and 3D points. The double dispatch logic is a bit complex but it works with any receiver.

This PR also tweaks existing services to improve the API and doc:
* Make all attributes of `Point` optional for gradual creation/space allocation. In practice, points are often created with a default value, as a kind of buffer, or with the Z axis at 0.
* Rework `BoxedArray` as a subclass of `Array` to inherit its services (incl. `remove`) while using less code.
* Move the custom `to_s` from the concrete boxes to the interfaces as it is very useful when debugging.

Pull-Request: #2462