Before Points accepted only 1D grid of points. Similarly to numpy array, a Points object can now have any dimension.
The storage layout changed: before points were stored as 3 numpy array (one for x, one for y, one for z). Now the points are stored in one array: x, y and z coordinates are respectively Points.coords[..., 0], Points.coords[..., 1], Points.coords[..., 2].
Motivations
Geometrical transformations such as changes of basis and rotations, which are a fairly big part of the library, are naturally expressed as operations on matrices (matrix multiplications in general). Using one array of coordinates instead of three allows is in this case natural.
Heavily optimised BLAS libraries (for CPU and GPU) support matrix operations: we prepare the ground for potential future optimisations.
Memory-wise, accessing all coordinates (x, y, z) or only one specific (ex: x) are both efficient operations: no new buffer has to be allocated. With the previous layout, accessing one coordinate was fast but accessing all required to create a new buffer.
Changes of interface
Backward compatibility was broken. Sorry about that.
Points.__init__() accepts now one array
Points.from_xyz() creates a new point using three x, y and z arrays to emulate the previous behaviour. Ultimately it calls __init__ though.
Points.from_one() and Points.to_2d_array() are obsolete and were removed.
Selected features
Points can now be efficiently rotated using one rotation for all points or one rotation per point (i.e. vectorise rotation of points).
Vectorise also the conversion of points coordinates to/from the global coordinate system: either one basis for all points or one basis per point can be used. This will be especially useful for computing angles of rays going to/from a specific interface.
Last words
Tests were written. They pass.
Brief documentation was written and Sphinx compilation pass with no warning.
Before Points accepted only 1D grid of points. Similarly to numpy array, a Points object can now have any dimension.
The storage layout changed: before points were stored as 3 numpy array (one for x, one for y, one for z). Now the points are stored in one array: x, y and z coordinates are respectively
Points.coords[..., 0]
,Points.coords[..., 1]
,Points.coords[..., 2]
.Motivations
Changes of interface
Backward compatibility was broken. Sorry about that.
Points.__init__()
accepts now one arrayPoints.from_xyz()
creates a new point using three x, y and z arrays to emulate the previous behaviour. Ultimately it calls__init__
though.Points.from_one()
andPoints.to_2d_array()
are obsolete and were removed.Selected features
Last words
Tests were written. They pass.
Brief documentation was written and Sphinx compilation pass with no warning.