MCPcopy Create free account
hub / github.com/Notgnoshi/generative / scale_coord_range

Function scale_coord_range

tools/transform.rs:245–265  ·  view source on GitHub ↗
(
    bounds: &Rect,
    x_dst: Option<&[f64; 2]>,
    y_dst: Option<&[f64; 2]>,
    coord: Coord,
)

Source from the content-addressed store, hash-verified

243}
244
245fn scale_coord_range(
246 bounds: &Rect,
247 x_dst: Option<&[f64; 2]>,
248 y_dst: Option<&[f64; 2]>,
249 coord: Coord,
250) -> Coord {
251 let min = bounds.min();
252 let max = bounds.max();
253 let mut x = coord.x;
254 let mut y = coord.y;
255
256 if let Some(dst) = x_dst {
257 let src = [min.x, max.x];
258 x = scale_range(&src, dst, coord.x);
259 }
260 if let Some(dst) = y_dst {
261 let src = [min.y, max.y];
262 y = scale_range(&src, dst, coord.y);
263 }
264 coord! {x: x, y: y}
265}
266
267fn geoms_coordwise(
268 geometries: impl Iterator<Item = Geometry>,

Callers 1

mainFunction · 0.85

Calls 1

scale_rangeFunction · 0.85

Tested by

no test coverage detected