Complex

semagrams.util.Complex
See theComplex companion object
case class Complex(x: Double, y: Double)

A class representing a complex number

We use complex numbers for two-dimensional geometry because they can represent either:

  • A point
  • A vector
  • A translation
  • A rotation/scaling

Instead of having to remember APIs for all of these, you can just use familiar arithmetic operations.

The operations here are the standard mathematical ones for the complex numbers.

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

def *(other: Complex): Complex
def +(other: Complex): Complex
def -(other: Complex): Complex
def /(other: Complex): Complex
def abs: Double

absolute value

absolute value

Attributes

def abssq: Double

absolute value squared

absolute value squared

Attributes

def dot(other: Complex): Double
def log: Double
def scaleTo(that: Complex): Complex
def toSvg: String

convert to an SVG string

convert to an SVG string

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product