pub struct FocusRing {
pub radius_x: f32,
pub radius_y: f32,
pub offset_x: f32,
pub offset_y: f32,
}Expand description
A focus ring modeled as an axis-aligned ellipse in Field coordinates, with an offset relative to the viewport center.
We use normalized ellipse distance: d2 = (x/rx)^2 + (y/ry)^2 If d2 <= 1 => inside.
Fields§
§radius_x: f32§radius_y: f32§offset_x: f32§offset_y: f32Implementations§
Source§impl FocusRing
impl FocusRing
pub fn new(radius_x: f32, radius_y: f32, offset_x: f32, offset_y: f32) -> Self
pub fn contains(&self, center: Vec2, p: Vec2) -> bool
pub fn zone(&self, vp_center: Vec2, p: Vec2) -> FocusZone
Sourcepub fn normalized_distance2(&self, center: Vec2, p: Vec2) -> f32
pub fn normalized_distance2(&self, center: Vec2, p: Vec2) -> f32
Return normalized squared distance inside this ellipse: d2 = (x/rx)^2 + (y/ry)^2
- d2 <= 1.0: inside/on boundary
- d2 > 1.0: outside
Trait Implementations§
impl Copy for FocusRing
impl StructuralPartialEq for FocusRing
Auto Trait Implementations§
impl Freeze for FocusRing
impl RefUnwindSafe for FocusRing
impl Send for FocusRing
impl Sync for FocusRing
impl Unpin for FocusRing
impl UnsafeUnpin for FocusRing
impl UnwindSafe for FocusRing
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more