ComplexF

value class ComplexF

Represents a complex number composed of two single-precision 32-bit IEEE 754 floating point numbers for real and imaginary parts.

On the JVM, non-nullable values of this type are represented as values of the primitive type long.

Constructors

Link copied to clipboard
constructor(real: Float, imaginary: Float)

Constructs a new complex number using the specified real and imaginary parts.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Returns the absolute value of this complex number.

Link copied to clipboard

Returns the conjugate of this complex number.

Link copied to clipboard

Imaginary part of the complex number.

Link copied to clipboard

Returns the magnitude of this complex number.

Link copied to clipboard

Returns a normalized copy of this complex number if this complex number magnitude is large enough to safely normalize. Else returns ZERO.

Link copied to clipboard

Returns the phase of this complex number.

Link copied to clipboard

Returns the phase of this complex number represented as angle.

Link copied to clipboard
val real: Float

Real part of the complex number.

Link copied to clipboard

Returns the squared magnitude of this complex number.

Functions

Link copied to clipboard
inline operator fun component1(): Float

Returns the real part of this complex number.

Link copied to clipboard
inline operator fun component2(): Float

Returns the imaginary part of this complex number.

Link copied to clipboard
inline fun copy(real: Float = this.real, imaginary: Float = this.imaginary): ComplexF

Returns a copy of this instance with specified properties altered.

Link copied to clipboard
operator fun div(other: ComplexF): ComplexF

Divides this complex number by the other complex number.

inline operator fun div(other: Vector2F): Vector2F

Divides this complex number by the other vector.

inline operator fun div(other: Float): ComplexF

Divides this complex number by the other real number.

Link copied to clipboard
inline fun isApproximately(other: ComplexF, epsilon: Float = 1.0E-5f): Boolean

Returns a value indicating whether this number is approximately other number given specified epsilon tolerance.

Link copied to clipboard
inline operator fun minus(other: ComplexF): ComplexF

Subtracts the other complex number from this complex number.

inline operator fun minus(other: Float): ComplexF

Subtracts the other real number from this complex number.

Link copied to clipboard
inline fun normalizedOrElse(defaultValue: ComplexF): ComplexF

Returns a normalized copy of this complex number if this complex number magnitude is large enough to safely normalize. Else returns defaultValue.

inline fun normalizedOrElse(defaultValue: () -> ComplexF): ComplexF

Returns a normalized copy of this complex number if this complex number magnitude is large enough to safely normalize. Else returns the result of calling the defaultValue function.

Link copied to clipboard
inline operator fun plus(other: ComplexF): ComplexF

Adds the other complex number to this complex number.

inline operator fun plus(other: Float): ComplexF

Adds the other real number to this complex number.

Link copied to clipboard
fun pow(x: Float): ComplexF

Returns this complex number to the power of x.

fun pow(n: Int): ComplexF

Returns this complex number to the power of n.

Link copied to clipboard
inline operator fun times(other: ComplexF): ComplexF

Multiplies this complex number by the other complex number.

inline operator fun times(other: Vector2F): Vector2F

Multiplies this complex number by the other vector.

inline operator fun times(other: Float): ComplexF

Multiplies this complex number by the other real number.

Link copied to clipboard
open override fun toString(): String

Returns a String representation of this vector in "real ± imaginaryi" format.

Link copied to clipboard

Converts this ComplexF value to Vector2F, where real and imaginary represents the x and y components of a vector.

Link copied to clipboard
inline operator fun unaryMinus(): ComplexF

Returns the additive inverse of this complex number.

Link copied to clipboard
inline operator fun unaryPlus(): ComplexF

Returns this complex number.