pub struct Complex<F: Float> {
pub real: F,
pub imag: F,
}Expand description
Complex number
Fields§
§real: F§imag: FImplementations§
Source§impl<F: Float> Complex<F>
impl<F: Float> Complex<F>
Sourcepub const fn to_vector2(self) -> Vector2<F>
pub const fn to_vector2(self) -> Vector2<F>
Converts complex number to a vector where x = real, y = imag.
Sourcepub const fn from_vector2(vec: Vector2<F>) -> Self
pub const fn from_vector2(vec: Vector2<F>) -> Self
Converts vector to a complex number where real = x, imag = y.
Sourcepub fn to_matrix2(self) -> Matrix2<F>
pub fn to_matrix2(self) -> Matrix2<F>
Converts complex number to a real matrix.
Sourcepub fn from_angle(angle: F) -> Self
pub fn from_angle(angle: F) -> Self
Converts angle in radians to a complex number.
Sourcepub fn sqr_magnitude(&self) -> F
pub fn sqr_magnitude(&self) -> F
Computes squared magnitude.
Sourcepub fn to_magnitude_angle(self) -> (F, F)
pub fn to_magnitude_angle(self) -> (F, F)
Returns complex number’s magnitude and angle in radians.
Sourcepub fn conjugate(self) -> Self
pub fn conjugate(self) -> Self
Returns conjugate of the complex number.
Conjugate is defined as a - bi.
Sourcepub fn reciprocal(self) -> Self
pub fn reciprocal(self) -> Self
Returns 1 / (a + bi).
Trait Implementations§
Source§impl<F: Float> DivAssign for Complex<F>
impl<F: Float> DivAssign for Complex<F>
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/= operation. Read moreSource§impl<F: Float> MulAssign for Complex<F>
impl<F: Float> MulAssign for Complex<F>
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreimpl<F: Copy + Float> Copy for Complex<F>
impl<F: Float> StructuralPartialEq for Complex<F>
Auto Trait Implementations§
impl<F> Freeze for Complex<F>where
F: Freeze,
impl<F> RefUnwindSafe for Complex<F>where
F: RefUnwindSafe,
impl<F> Send for Complex<F>where
F: Send,
impl<F> Sync for Complex<F>where
F: Sync,
impl<F> Unpin for Complex<F>where
F: Unpin,
impl<F> UnwindSafe for Complex<F>where
F: UnwindSafe,
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