pub fn transformed(points: Vec<Point<f32>>, m: Isometry<f32>) -> Vec<Point<f32>> ⓘExpand description
Returns the transformed version of a vector of points.
This function takes ownership of a vector of points, applies the given isometry transformation, and returns the transformed vector.
§Arguments
- points- A vector of points to transform (ownership is taken)
- m- The isometry (rigid transformation) to apply
§Returns
A new vector containing the transformed points
§Example
use parry2d::transformation::utils::transformed;
use parry2d::math::{Point, Isometry};
use parry2d::na::{Translation2, UnitComplex};
use std::f32::consts::PI;
let points = vec![
    Point::new(1.0, 0.0),
    Point::new(0.0, 1.0),
];
// Rotate 90 degrees counter-clockwise around origin
let rotation = UnitComplex::new(PI / 2.0);
let transform = Isometry::from_parts(Translation2::identity().into(), rotation);
let result = transformed(points, transform);
// Points are now rotated
assert!((result[0].x - 0.0).abs() < 1e-6);
assert!((result[0].y - 1.0).abs() < 1e-6);