Skip to content

Commit

Permalink
Allow an AffineTransform to be constructed from a slice
Browse files Browse the repository at this point in the history
  • Loading branch information
urschrei committed Nov 3, 2023
1 parent 055087d commit 5eb4ae0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions geo/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* <https://github.com/georust/geo/pull/1091>
* Add `wkt!` macro to define geometries at compile time.
<https://github.com/georust/geo/pull/1063>
* Allow affine transforms to be constructed from slices.
<https://github.com/georust/geo/pull/1105>

## 0.26.0

Expand Down
6 changes: 6 additions & 0 deletions geo/src/algorithm/affine_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ impl<T: CoordNum> From<[T; 6]> for AffineTransform<T> {
}
}

impl<T: CoordNum> From<&[T; 6]> for AffineTransform<T> {
fn from(arr: &[T; 6]) -> Self {
Self::new(arr[0], arr[1], arr[2], arr[3], arr[4], arr[5])
}
}

impl<T: CoordNum> From<(T, T, T, T, T, T)> for AffineTransform<T> {
fn from(tup: (T, T, T, T, T, T)) -> Self {
Self::new(tup.0, tup.1, tup.2, tup.3, tup.4, tup.5)
Expand Down

0 comments on commit 5eb4ae0

Please sign in to comment.