Add a Point::from_slice

This commit is contained in:
sebcrozet 2018-10-13 10:45:42 +02:00 committed by Sébastien Crozet
parent a68937990b
commit 9e2541f949
2 changed files with 11 additions and 2 deletions

View File

@ -14,8 +14,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Add `.slerp` and `.try_slerp` to unit vectors.
* Add `.to_projective` and `.as_projective` to `Perspective3` and `Orthographic3` in order to
use them as `Projective3` structures.
* Add impl for `From/Into` to allow the conversion of any transformation type to a matrix.
* Add `From/Into` impls to allow the conversion of any transformation type to a matrix.
* Add `Into` impls to convert a matrix slice into an owned matrix.
* Add `Point*::from_slice` to create a point from a slice.
* Add `.map_with_location` to matrices to apply a map which passes the component indices to the user-defined closure alongide
the component itself.
## [0.16.0]
All dependencies have been updated to their latest versions.

View File

@ -31,6 +31,12 @@ where
Self::from_coordinates(VectorN::from_element(N::zero()))
}
/// Creates a new point from a slice.
#[inline]
pub fn from_slice(components: &[N]) -> Self {
Self::from_coordinates(VectorN::from_row_slice(components))
}
/// Creates a new point from its homogeneous vector representation.
///
/// In practice, this builds a D-dimensional points with the same first D component as `v`