MCPcopy Create free account
hub / github.com/AccessKit/accesskit / transform_rect_bbox

Method transform_rect_bbox

common/src/geometry.rs:118–124  ·  view source on GitHub ↗

Compute the bounding box of a transformed rectangle. Returns the minimal `Rect` that encloses the given `Rect` after affine transformation. If the transform is axis-aligned, then this bounding box is "tight", in other words the returned `Rect` is the transformed rectangle. The returned rectangle always has non-negative width and height.

(self, rect: Rect)

Source from the content-addressed store, hash-verified

116 ///
117 /// The returned rectangle always has non-negative width and height.
118 pub fn transform_rect_bbox(self, rect: Rect) -> Rect {
119 let p00 = self * Point::new(rect.x0, rect.y0);
120 let p01 = self * Point::new(rect.x0, rect.y1);
121 let p10 = self * Point::new(rect.x1, rect.y0);
122 let p11 = self * Point::new(rect.x1, rect.y1);
123 Rect::from_points(p00, p01).union(Rect::from_points(p10, p11))
124 }
125
126 /// Is this map finite?
127 #[inline]

Callers 3

bounding_boxesMethod · 0.80
bounding_boxMethod · 0.80

Calls 1

unionMethod · 0.80

Tested by

no test coverage detected