pub struct Ball2<'a, T = f64> { /* private fields */ }Expand description
A Euclidean ball, that is, a set given by $B_2^r = \{x \in \mathbb{R}^n {}:{} \Vert{}x{}\Vert \leq r\}$ or a Euclidean ball centered at a point $x_c$, that is, $B_2^{x_c, r} = \{x \in \mathbb{R}^n {}:{} \Vert{}x-x_c{}\Vert \leq r\}$
Implementations§
Source§impl<'a, T: Float> Ball2<'a, T>
impl<'a, T: Float> Ball2<'a, T>
Sourcepub fn new(center: Option<&'a [T]>, radius: T) -> Self
pub fn new(center: Option<&'a [T]>, radius: T) -> Self
Construct a new Euclidean ball with given center and radius
If no center is given, then it is assumed to be in the origin
§Example
use optimization_engine::constraints::{Ball2, Constraint};
let ball = Ball2::new(None, 1.0);
let mut x = [2.0, 0.0];
ball.project(&mut x).unwrap();Trait Implementations§
Source§impl<'a, T> Constraint<T> for Ball2<'a, T>
impl<'a, T> Constraint<T> for Ball2<'a, T>
impl<'a, T: Copy> Copy for Ball2<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for Ball2<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for Ball2<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Ball2<'a, T>
impl<'a, T> Sync for Ball2<'a, T>where
T: Sync,
impl<'a, T> Unpin for Ball2<'a, T>where
T: Unpin,
impl<'a, T> UnsafeUnpin for Ball2<'a, T>where
T: UnsafeUnpin,
impl<'a, T> UnwindSafe for Ball2<'a, T>where
T: UnwindSafe + RefUnwindSafe,
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