pub struct Complex {
pub re: f64,
pub im: f64,
}Expand description
A complex number z = re + im·i.
Fields§
§re: f64§im: f64Implementations§
Source§impl Complex
impl Complex
pub const ZERO: Self
pub const ONE: Self
pub const I: Self
pub fn new(re: f64, im: f64) -> Self
pub fn from_polar(r: f64, theta: f64) -> Self
pub fn from_vec2(v: Vec2) -> Self
pub fn to_vec2(self) -> Vec2
pub fn conj(self) -> Self
pub fn norm_sq(self) -> f64
pub fn norm(self) -> f64
pub fn arg(self) -> f64
pub fn abs(self) -> f64
pub fn is_zero(self) -> bool
pub fn add(self, rhs: Self) -> Self
pub fn sub(self, rhs: Self) -> Self
pub fn mul(self, rhs: Self) -> Self
pub fn div(self, rhs: Self) -> Self
pub fn scale(self, s: f64) -> Self
pub fn neg(self) -> Self
pub fn recip(self) -> Self
pub fn exp(self) -> Self
pub fn ln(self) -> Self
pub fn sqrt(self) -> Self
pub fn sin(self) -> Self
pub fn cos(self) -> Self
pub fn tan(self) -> Self
pub fn sinh(self) -> Self
pub fn cosh(self) -> Self
pub fn tanh(self) -> Self
pub fn asin(self) -> Self
pub fn acos(self) -> Self
pub fn atan(self) -> Self
Sourcepub fn mandelbrot_step(self, c: Self) -> Self
pub fn mandelbrot_step(self, c: Self) -> Self
Mandelbrot iteration: z_{n+1} = z_n^2 + c. Returns z.
Sourcepub fn burning_ship_step(self, c: Self) -> Self
pub fn burning_ship_step(self, c: Self) -> Self
Burning ship step: z_{n+1} = (|re| + i|im|)^2 + c.
Sourcepub fn tricorn_step(self, c: Self) -> Self
pub fn tricorn_step(self, c: Self) -> Self
Tricorn step: z_{n+1} = conj(z)^2 + c.
Trait Implementations§
impl Copy for Complex
impl StructuralPartialEq 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 UnsafeUnpin 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§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.