Skip to main content

extract_scales

Function extract_scales 

Source
pub fn extract_scales(transform: &Affine) -> (f32, f32)
Expand description

Extract scale factors from an affine transform using singular value decomposition.

Returns a tuple of (scale_x, scale_y) representing the scale along each axis. This uses the same algorithm as kurbo’s internal svd() method.

§Arguments

  • transform - The affine transformation to extract scales from.

§Returns

A tuple (scale_x, scale_y) with minimum values clamped to 1e-6 to avoid division by zero.

§Note

TODO: Consider making Affine::svd() public in kurbo to avoid duplicating this code. This implementation mirrors kurbo’s internal SVD calculation for extracting scale factors from arbitrary affine transformations.