pub fn scaled(points: Vec<Point<f32>>, scale: Vector<f32>) -> Vec<Point<f32>> ⓘExpand description
Returns the scaled version of a vector of points.
This function takes ownership of a vector of points and applies a non-uniform
scale factor to each component. Unlike transformed, this is a non-rigid
transformation that can stretch or compress points along different axes.
§Arguments
points- A vector of points to scale (ownership is taken)scale- The scale factor for each axis
§Returns
A new vector containing the scaled points
§Example
use parry3d::transformation::utils::scaled;
use parry3d::math::{Point, Vector};
let points = vec![
Point::new(1.0, 2.0, 3.0),
Point::new(4.0, 5.0, 6.0),
];
// Scale x by 2, y by 3, z by 0.5
let scale = Vector::new(2.0, 3.0, 0.5);
let result = scaled(points, scale);
assert_eq!(result[0], Point::new(2.0, 6.0, 1.5));
assert_eq!(result[1], Point::new(8.0, 15.0, 3.0));