pub struct Complex {
pub real: f64,
pub imaginary: f64,
}
Expand description
Represents a complex number located on a “unit” plane.
Fields§
§real: f64
X coordinate located in range [0, 1).
imaginary: f64
Y coordinate located in range [0, 1).
Implementations§
source§impl Complex
impl Complex
pub const fn new(real: f64, imaginary: f64) -> Self
pub const fn real(real: f64) -> Self
pub const fn zero() -> Self
pub const fn one() -> Self
pub fn i() -> Self
pub fn magnitude(self) -> f64
pub fn conjugate(self) -> Complex
pub fn partial_mul(self, other: Complex) -> Complex
pub fn partial_div(self, other: Complex) -> Complex
pub fn arg(self) -> f64
pub fn normalize(self) -> Complex
sourcepub fn len_squared(self) -> f64
pub fn len_squared(self) -> f64
Number-theoretical norm. Simply a^2 + b^2 with self = a + bi
pub fn sqrt(self) -> Complex
Trait Implementations§
source§impl AddAssign for Complex
impl AddAssign for Complex
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresource§impl MulAssign<f64> for Complex
impl MulAssign<f64> for Complex
source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
Performs the
*=
operation. Read moresource§impl MulAssign for Complex
impl MulAssign for Complex
source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moresource§impl SubAssign for Complex
impl SubAssign for Complex
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl Copy for Complex
Auto Trait Implementations§
impl Freeze for Complex
impl RefUnwindSafe for Complex
impl Send for Complex
impl Sync for Complex
impl Unpin for Complex
impl UnwindSafe for Complex
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneWithNode for Twhere
T: Clone,
impl<T> CloneWithNode for Twhere
T: Clone,
fn clone_with_node(&mut self) -> T
fn clone_without_node(&self) -> T
source§impl<T> Convert for T
impl<T> Convert for T
source§fn convert<U>(self, context: &CompileContext) -> Expr<U>where
U: ConvertFrom<T>,
fn convert<U>(self, context: &CompileContext) -> Expr<U>where
U: ConvertFrom<T>,
Errors Read more
source§fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
Errors Read more