| 1 | // pathfinder/geometry/src/basic/rect.rs |
| 2 | // |
| 3 | // Copyright © 2019 The Pathfinder Project Developers. |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 8 | // option. This file may not be copied, modified, or distributed |
| 9 | // except according to those terms. |
| 10 | |
| 11 | //! 2D axis-aligned rectangles, optimized with SIMD. |
| 12 | |
| 13 | use craterust-analyzer cargo pathfinder_geometry 0.5.1 crate/::vectorrust-analyzer cargo pathfinder_geometry 0.5.1 vector/::{IntoVector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/IntoVector2F#, Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#, Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#}; |
| 14 | use pathfinder_simdrust-analyzer cargo pathfinder_simd 0.5.6 crate/::defaultrust-analyzer cargo pathfinder_simd 0.5.6 x86/::{F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#, I32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/I32x4#}; |
| 15 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#, Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#, Subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#}; |
| 16 | |
| 17 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 18 | pub struct RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#(pub F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#); |
| 19 | |
| 20 | impl RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 21 | #[inline] |
| 22 | pub fn newrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]new().(origin: Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#, size: Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 23 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#(origin.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#0..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x2]concat_xy_xy().(origin.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#0. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x2][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x2][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x2][`Add<Self>`]add().size.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#0.)) |
| 24 | } |
| 25 | |
| 26 | #[inline] |
| 27 | pub fn from_pointsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]from_points().(origin: Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#, lower_right: Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 28 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#(origin.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#0..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x2]concat_xy_xy().(lower_right.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#0.)) |
| 29 | } |
| 30 | |
| 31 | // Accessors |
| 32 | |
| 33 | #[inline] |
| 34 | pub fn originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().(self) -> Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F# { |
| 35 | Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]xy().()) |
| 36 | } |
| 37 | |
| 38 | #[inline] |
| 39 | pub fn sizerust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]size().(self) -> Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F# { |
| 40 | Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..zwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]zw().() rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x2][`Sub<Self>`]sub().-rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x2][`Sub<Self>`]sub(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x2][`Sub<Self>`]sub().self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]xy().()) |
| 41 | } |
| 42 | |
| 43 | #[inline] |
| 44 | pub fn origin_xrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin_x().(self) -> f32 { |
| 45 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..xrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]x().() |
| 46 | } |
| 47 | |
| 48 | #[inline] |
| 49 | pub fn origin_yrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin_y().(self) -> f32 { |
| 50 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..yrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]y().() |
| 51 | } |
| 52 | |
| 53 | #[inline] |
| 54 | pub fn widthrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]width().(self) -> f32 { |
| 55 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..zrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]z().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..xrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]x().() |
| 56 | } |
| 57 | |
| 58 | #[inline] |
| 59 | pub fn heightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]height().(self) -> f32 { |
| 60 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..wrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]w().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`Sub<Self>`]sub().self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..yrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]y().() |
| 61 | } |
| 62 | |
| 63 | #[inline] |
| 64 | pub fn upper_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]upper_right().(self) -> Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F# { |
| 65 | Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..zyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]zy().()) |
| 66 | } |
| 67 | |
| 68 | #[inline] |
| 69 | pub fn lower_leftrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]lower_left().(self) -> Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F# { |
| 70 | Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..xwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]xw().()) |
| 71 | } |
| 72 | |
| 73 | #[inline] |
| 74 | pub fn lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]lower_right().(self) -> Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F# { |
| 75 | Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..zwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]zw().()) |
| 76 | } |
| 77 | |
| 78 | // Mutators |
| 79 | |
| 80 | #[inline] |
| 81 | pub fn set_origin_xrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]set_origin_x().(&mut self, x: f32) { |
| 82 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..set_xrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]set_x().(x) |
| 83 | } |
| 84 | |
| 85 | #[inline] |
| 86 | pub fn set_origin_yrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]set_origin_y().(&mut self, y: f32) { |
| 87 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..set_yrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[F32x4]set_y().(y) |
| 88 | } |
| 89 | |
| 90 | #[inline] |
| 91 | pub fn contains_pointrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]contains_point().(self, point: Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#) -> bool { |
| 92 | // self.origin <= point && point <= self.lower_right |
| 93 | let point = point.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#0..to_f32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x2]to_f32x4().(); |
| 94 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_xy_xy().(point).packed_lerust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]packed_le().(point.concat_xy_zwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_xy_zw().(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0.)).all_truerust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[U32x4]all_true().() |
| 95 | } |
| 96 | |
| 97 | #[inline] |
| 98 | pub fn contains_rectrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]contains_rect().(self, other: RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#) -> bool { |
| 99 | // self.origin <= other.origin && other.lower_right <= self.lower_right |
| 100 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..concat_xy_zwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_xy_zw().(other.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0.).packed_lerust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]packed_le().(other.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..concat_xy_zwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_xy_zw().(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0.)).all_truerust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[U32x4]all_true().() |
| 101 | } |
| 102 | |
| 103 | #[inline] |
| 104 | pub fn is_emptyrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]is_empty().(self) -> bool { |
| 105 | self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`PartialEq<Self>`]eq().==rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`PartialEq<Self>`]eq(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`PartialEq<Self>`]eq().self.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]lower_right().() |
| 106 | } |
| 107 | |
| 108 | #[inline] |
| 109 | pub fn union_pointrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]union_point().(self, point: Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 110 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#::from_pointsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]from_points().(self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().().minrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]min().(point), self.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]lower_right().().maxrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]max().(point)) |
| 111 | } |
| 112 | |
| 113 | #[inline] |
| 114 | pub fn union_rectrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]union_rect().(self, other: RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 115 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#::from_pointsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]from_points().( |
| 116 | self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().().minrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]min().(other.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().()), |
| 117 | self.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]lower_right().().maxrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]max().(other.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]lower_right().()), |
| 118 | ) |
| 119 | } |
| 120 | |
| 121 | #[inline] |
| 122 | pub fn intersectsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]intersects().(self, other: RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#) -> bool { |
| 123 | // self.origin < other.lower_right && other.origin < self.lower_right |
| 124 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_xy_xy().(other.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0.).packed_ltrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]packed_lt().(other.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..concat_zw_zwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]concat_zw_zw().(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0.)).all_truerust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[U32x4]all_true().() |
| 125 | } |
| 126 | |
| 127 | #[inline] |
| 128 | pub fn intersectionrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]intersection().(self, other: RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#> { |
| 129 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.intersectsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]intersects().(other) { |
| 130 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 131 | } else { |
| 132 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#::from_pointsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]from_points().( |
| 133 | self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().().maxrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]max().(other.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().()), |
| 134 | self.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]lower_right().().minrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]min().(other.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]lower_right().()), |
| 135 | )) |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | #[inline] |
| 140 | pub fn min_xrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]min_x().(self) -> f32 { |
| 141 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0.[rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Index<usize>`]index().0]rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Index<usize>`]index(). |
| 142 | } |
| 143 | |
| 144 | #[inline] |
| 145 | pub fn min_yrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]min_y().(self) -> f32 { |
| 146 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0.[rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Index<usize>`]index().1]rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Index<usize>`]index(). |
| 147 | } |
| 148 | |
| 149 | #[inline] |
| 150 | pub fn max_xrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]max_x().(self) -> f32 { |
| 151 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0.[rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Index<usize>`]index().2]rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Index<usize>`]index(). |
| 152 | } |
| 153 | |
| 154 | #[inline] |
| 155 | pub fn max_yrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]max_y().(self) -> f32 { |
| 156 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0.[rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Index<usize>`]index().3]rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Index<usize>`]index(). |
| 157 | } |
| 158 | |
| 159 | #[inline] |
| 160 | pub fn centerrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]center().(self) -> Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F# { |
| 161 | self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<Self>`]add().+rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<Self>`]add(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<Self>`]add().self.sizerust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]size().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Mul<f32>`]mul().*rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Mul<f32>`]mul(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Mul<f32>`]mul().0.5 |
| 162 | } |
| 163 | |
| 164 | /// Rounds all points to the nearest integer. |
| 165 | #[inline] |
| 166 | pub fn roundrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]round().(self) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 167 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..to_i32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]to_i32x4().().to_f32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4]to_f32x4().()) |
| 168 | } |
| 169 | |
| 170 | #[inline] |
| 171 | pub fn round_outrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]round_out().(self) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 172 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#::from_pointsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]from_points().(self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().().floorrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]floor().(), self.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]lower_right().().ceilrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F]ceil().()) |
| 173 | } |
| 174 | |
| 175 | #[inline] |
| 176 | pub fn dilaterust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]dilate().<A>(self, amount: A) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# where A: IntoVector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/IntoVector2F# { |
| 177 | let amount = amount.into_vector_2frust-analyzer cargo pathfinder_geometry 0.5.1 vector/IntoVector2F#into_vector_2f().(); |
| 178 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#::from_pointsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]from_points().(self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Sub<Self>`]sub().-rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Sub<Self>`]sub(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Sub<Self>`]sub().amount, self.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]lower_right().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<Self>`]add().+rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<Self>`]add(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<Self>`]add().amount) |
| 179 | } |
| 180 | |
| 181 | #[inline] |
| 182 | pub fn contractrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]contract().<A>(self, amount: A) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# where A: IntoVector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/IntoVector2F# { |
| 183 | let amount = amount.into_vector_2frust-analyzer cargo pathfinder_geometry 0.5.1 vector/IntoVector2F#into_vector_2f().(); |
| 184 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#::from_pointsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]from_points().(self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<Self>`]add().+rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<Self>`]add(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<Self>`]add().amount, self.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]lower_right().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Sub<Self>`]sub().-rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Sub<Self>`]sub(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Sub<Self>`]sub().amount) |
| 185 | } |
| 186 | |
| 187 | #[inline] |
| 188 | pub fn to_i32rust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]to_i32().(&self) -> RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI# { |
| 189 | RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0..to_i32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]to_i32x4().()) |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | impl Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#<Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#> for RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 194 | type Outputrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF][`Add<Vector2F>`]Output# = RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#; |
| 195 | #[inline] |
| 196 | fn addrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF][`Add<Vector2F>`]add().(self, other: Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 197 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#::newrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]new().(self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<Self>`]add().+rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<Self>`]add(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<Self>`]add().other, self.sizerust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]size().()) |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | impl Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#<f32> for RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 202 | type Outputrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF][`Add<f32>`]Output# = RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#; |
| 203 | #[inline] |
| 204 | fn addrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF][`Add<f32>`]add().(self, other: f32) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 205 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#::newrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]new().(self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<f32>`]add().+rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<f32>`]add(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Add<f32>`]add().other, self.sizerust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]size().()) |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#> for RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 210 | type Outputrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF][`Mul<Vector2F>`]Output# = RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#; |
| 211 | #[inline] |
| 212 | fn mulrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF][`Mul<Vector2F>`]mul().(self, factors: Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 213 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().factors.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#0..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x2]concat_xy_xy().(factors.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#0.)) |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | impl Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<f32> for RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 218 | type Outputrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF][`Mul<f32>`]Output# = RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#; |
| 219 | #[inline] |
| 220 | fn mulrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF][`Mul<f32>`]mul().(self, factor: f32) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 221 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#0. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4][`Mul<Self>`]mul().F32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/F32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[F32x4]splat().(factor)) |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | impl Subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#<Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#> for RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 226 | type Outputrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF][`Sub<Vector2F>`]Output# = RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#; |
| 227 | #[inline] |
| 228 | fn subrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF][`Sub<Vector2F>`]sub().(self, other: Vector2Frust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2F#) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 229 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#::newrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]new().(self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Sub<Self>`]sub().-rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Sub<Self>`]sub(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Sub<Self>`]sub().other, self.sizerust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]size().()) |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | impl Subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#<f32> for RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 234 | type Outputrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF][`Sub<f32>`]Output# = RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#; |
| 235 | #[inline] |
| 236 | fn subrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF][`Sub<f32>`]sub().(self, other: f32) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 237 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#::newrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]new().(self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]origin().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Sub<f32>`]sub().-rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Sub<f32>`]sub(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2F][`Sub<f32>`]sub().other, self.sizerust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectF]size().()) |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | /// NB: The origin is inclusive, while the lower right point is exclusive. |
| 242 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 243 | pub struct RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#(pub I32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/I32x4#); |
| 244 | |
| 245 | impl RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI# { |
| 246 | #[inline] |
| 247 | pub fn newrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]new().(origin: Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#, size: Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#) -> RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI# { |
| 248 | RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#(origin.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#0..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x2]concat_xy_xy().(origin.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#0. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x2][`Add<Self>`]add().+rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x2][`Add<Self>`]add(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x2][`Add<Self>`]add().size.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#0.)) |
| 249 | } |
| 250 | |
| 251 | #[inline] |
| 252 | pub fn from_pointsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]from_points().(origin: Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#, lower_right: Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#) -> RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI# { |
| 253 | RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#(origin.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#0..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x2]concat_xy_xy().(lower_right.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#0.)) |
| 254 | } |
| 255 | |
| 256 | // Accessors |
| 257 | |
| 258 | #[inline] |
| 259 | pub fn originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]origin().(&self) -> Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I# { |
| 260 | Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4]xy().()) |
| 261 | } |
| 262 | |
| 263 | #[inline] |
| 264 | pub fn sizerust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]size().(&self) -> Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I# { |
| 265 | Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..zwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4]zw().() rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x2][`Sub<Self>`]sub().-rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x2][`Sub<Self>`]sub(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x2][`Sub<Self>`]sub().self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4]xy().()) |
| 266 | } |
| 267 | |
| 268 | #[inline] |
| 269 | pub fn origin_xrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]origin_x().(self) -> i32 { |
| 270 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..xrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[I32x4]x().() |
| 271 | } |
| 272 | |
| 273 | #[inline] |
| 274 | pub fn origin_yrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]origin_y().(self) -> i32 { |
| 275 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..yrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[I32x4]y().() |
| 276 | } |
| 277 | |
| 278 | #[inline] |
| 279 | pub fn widthrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]width().(self) -> i32 { |
| 280 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..zrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[I32x4]z().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..xrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[I32x4]x().() |
| 281 | } |
| 282 | |
| 283 | #[inline] |
| 284 | pub fn heightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]height().(self) -> i32 { |
| 285 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..wrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[I32x4]w().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..yrust-analyzer cargo pathfinder_simd 0.5.6 extras/impl#[I32x4]y().() |
| 286 | } |
| 287 | |
| 288 | #[inline] |
| 289 | pub fn upper_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]upper_right().(&self) -> Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I# { |
| 290 | Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..zyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4]zy().()) |
| 291 | } |
| 292 | |
| 293 | #[inline] |
| 294 | pub fn lower_leftrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]lower_left().(&self) -> Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I# { |
| 295 | Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..xwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4]xw().()) |
| 296 | } |
| 297 | |
| 298 | #[inline] |
| 299 | pub fn lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]lower_right().(&self) -> Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I# { |
| 300 | Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..zwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4]zw().()) |
| 301 | } |
| 302 | |
| 303 | #[inline] |
| 304 | pub fn scalerust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]scale().(self, factor: i32) -> RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI# { |
| 305 | RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Mul<Self>`]mul().I32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/I32x4#::splatrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4]splat().(factor)) |
| 306 | } |
| 307 | |
| 308 | #[inline] |
| 309 | pub fn scale_xyrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]scale_xy().(self, factors: Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#) -> RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI# { |
| 310 | RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0. rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Mul<Self>`]mul().*rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Mul<Self>`]mul(). rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Mul<Self>`]mul().factors.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#0..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x2]concat_xy_xy().(factors.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#0.)) |
| 311 | } |
| 312 | |
| 313 | #[inline] |
| 314 | pub fn min_xrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]min_x().(self) -> i32 { |
| 315 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0.[rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Index<usize>`]index().0]rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Index<usize>`]index(). |
| 316 | } |
| 317 | |
| 318 | #[inline] |
| 319 | pub fn min_yrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]min_y().(self) -> i32 { |
| 320 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0.[rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Index<usize>`]index().1]rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Index<usize>`]index(). |
| 321 | } |
| 322 | |
| 323 | #[inline] |
| 324 | pub fn max_xrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]max_x().(self) -> i32 { |
| 325 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0.[rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Index<usize>`]index().2]rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Index<usize>`]index(). |
| 326 | } |
| 327 | |
| 328 | #[inline] |
| 329 | pub fn max_yrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]max_y().(self) -> i32 { |
| 330 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0.[rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Index<usize>`]index().3]rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4][`Index<usize>`]index(). |
| 331 | } |
| 332 | |
| 333 | #[inline] |
| 334 | pub fn intersectsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]intersects().(self, other: RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#) -> bool { |
| 335 | // self.origin < other.lower_right && other.origin < self.lower_right |
| 336 | self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4]concat_xy_xy().(other.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0.).packed_ltrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4]packed_lt().(other.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..concat_zw_zwrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4]concat_zw_zw().(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0.)).all_truerust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[U32x4]all_true().() |
| 337 | } |
| 338 | |
| 339 | #[inline] |
| 340 | pub fn intersectionrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]intersection().(self, other: RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#> { |
| 341 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.intersectsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]intersects().(other) { |
| 342 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 343 | } else { |
| 344 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#::from_pointsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]from_points().( |
| 345 | self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]origin().().maxrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2I]max().(other.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]origin().()), |
| 346 | self.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]lower_right().().minrust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2I]min().(other.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]lower_right().()), |
| 347 | )) |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | #[inline] |
| 352 | pub fn contains_pointrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]contains_point().(&self, point: Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#) -> bool { |
| 353 | // self.origin <= point && point <= self.lower_right - 1 |
| 354 | let lower_right = self.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]lower_right().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2I][`Sub<i32>`]sub().-rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2I][`Sub<i32>`]sub(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2I][`Sub<i32>`]sub().1; |
| 355 | self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]origin().() |
| 356 | .0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#0. |
| 357 | .concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x2]concat_xy_xy().(point.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#0.) |
| 358 | .packed_lerust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4]packed_le().(point.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#0..concat_xy_xyrust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x2]concat_xy_xy().(lower_right.0rust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#0.)) |
| 359 | .all_truerust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[U32x4]all_true().() |
| 360 | } |
| 361 | |
| 362 | #[inline] |
| 363 | pub fn contractrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]contract().(self, amount: Vector2Irust-analyzer cargo pathfinder_geometry 0.5.1 vector/Vector2I#) -> RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI# { |
| 364 | RectIrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#::from_pointsrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]from_points().(self.originrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]origin().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2I][`Add<Self>`]add().+rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2I][`Add<Self>`]add(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2I][`Add<Self>`]add().amount, self.lower_rightrust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]lower_right().() rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2I][`Sub<Self>`]sub().-rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2I][`Sub<Self>`]sub(). rust-analyzer cargo pathfinder_geometry 0.5.1 vector/impl#[Vector2I][`Sub<Self>`]sub().amount) |
| 365 | } |
| 366 | |
| 367 | #[inline] |
| 368 | pub fn to_f32rust-analyzer cargo pathfinder_geometry 0.5.1 rect/impl#[RectI]to_f32().(&self) -> RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF# { |
| 369 | RectFrust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectF#(self.0rust-analyzer cargo pathfinder_geometry 0.5.1 rect/RectI#0..to_f32x4rust-analyzer cargo pathfinder_simd 0.5.6 x86/impl#[I32x4]to_f32x4().()) |
| 370 | } |
| 371 | } |