Packageorg.un.flex.utils.geom
Classpublic class ComplexNumber
ImplementsIPoint

Implements a complex number as a point and certain common methods for complex geometry.
The implementation is a rewrite of Jens Kanschik's Hypergraph implementation in Java. However, apart from the general idea and some variable names, this code improves on hypergraph and also implements additional functionality. Copyright (C) 2003 Jens Kanschik, mail : jensKanschik



Public Properties
 PropertyDefined by
  imag : Number
Returns the imaginary part of the complex number.
ComplexNumber
  real : Number
Returns the real part of the complex number.
ComplexNumber
Protected Properties
 PropertyDefined by
  _imag : Number
The imaginary part of the complex number.
ComplexNumber
  _real : Number
The real part of the complex number.
ComplexNumber
Public Methods
 MethodDefined by
  
ComplexNumber(r:Number = 0, i:Number = 0)
Creates a complex number with the given real and imaginary part.
ComplexNumber
  
Adds a complex number to this complex number.
ComplexNumber
  
addR(x:Number):void
Adds a real number to the complex number.
ComplexNumber
  
clone():Object
Creates a deep copy of the Point.
ComplexNumber
  
conjugate():void
Conjugates the complex number (negates the imaginary part.)
ComplexNumber
  
dist(z:ComplexNumber):Number
Return the distance from this to a complex number z.
ComplexNumber
  
dist2(z:ComplexNumber):Number
Return the squared distance from this to a complex number z.
ComplexNumber
  
Divides the complex number by another complex number.
ComplexNumber
  
divideF(r:Number):void
Divides the complex number by a real number.
ComplexNumber
  
equals(z:Object):Boolean
Returns true if the parameter object is equals to this and false otherwise.
ComplexNumber
  
getRad():Number
Returns the radiant of a complex number.
ComplexNumber
  
Returns the reciprocal of this.
ComplexNumber
  
[static] Returns exp(it).
ComplexNumber
  
Multiplies a complex number with this complex number.
ComplexNumber
  
multiplyF(r:Number):void
Multiplies a real number with this complex number.
ComplexNumber
  
norm():Number
Return the norm of the complex number.
ComplexNumber
  
norm2():Number
Return the squared norm of the complex number.
ComplexNumber
  
normalize():void
Normalizes the complex number so that it's length is 1.
ComplexNumber
  
reciprocal():void
Sets this complex number to its reciprocal.
ComplexNumber
  
setTo(p:IPoint):void
Sets this point to the given point.
ComplexNumber
  
Subtracts a complex number from this complex number.
ComplexNumber
  
toArray():Array
Returns an array of to doubles, the first is the real part, the second the imaginary part.
ComplexNumber
  
toString():String
Returns a String representation of the point.
ComplexNumber
Protected Methods
 MethodDefined by
  
Return the euclidian scalar product of the complex number and another complex number.
ComplexNumber
Property detail
_imagproperty
protected var _imag:Number

The imaginary part of the complex number.

imagproperty 
imag:Number  [read-write]

Returns the imaginary part of the complex number.

Implementation
    public function get imag():Number
    public function set imag(value:Number):void
_realproperty 
protected var _real:Number

The real part of the complex number.

realproperty 
real:Number  [read-write]

Returns the real part of the complex number.

Implementation
    public function get real():Number
    public function set real(value:Number):void
Constructor detail
ComplexNumber()constructor
public function ComplexNumber(r:Number = 0, i:Number = 0)

Creates a complex number with the given real and imaginary part.

Parameters
r:Number (default = 0) — The real part of the complex number.
 
i:Number (default = 0) — The imaginary part of the complex number.
Method detail
addC()method
public function addC(v:ComplexNumber):void

Adds a complex number to this complex number.

Parameters
v:ComplexNumber — The complex number to be added.
addR()method 
public function addR(x:Number):void

Adds a real number to the complex number.

Parameters
x:Number — The real number to be added.
clone()method 
public function clone():Object

Creates a deep copy of the Point.

Returns
Object — A deep copy of the Point.
conjugate()method 
public function conjugate():void

Conjugates the complex number (negates the imaginary part.)

dist()method 
public function dist(z:ComplexNumber):Number

Return the distance from this to a complex number z.

Parameters
z:ComplexNumber — Another complex number.

Returns
Number — The distance from this complex number to z.
dist2()method 
public function dist2(z:ComplexNumber):Number

Return the squared distance from this to a complex number z.

Parameters
z:ComplexNumber — Another complex number.

Returns
Number — The squared distance from this complex number to z.
divideC()method 
public function divideC(z:ComplexNumber):void

Divides the complex number by another complex number.

Parameters
z:ComplexNumber — The divisor.
divideF()method 
public function divideF(r:Number):void

Divides the complex number by a real number.

Parameters
r:Number — The divisor.
equals()method 
public function equals(z:Object):Boolean

Returns true if the parameter object is equals to this and false otherwise.

Parameters
z:Object — Any object.

Returns
Boolean — True if obj equals this.
getRad()method 
public function getRad():Number

Returns the radiant of a complex number.

Returns
Number — The radiant of the complex number.
getReciprocal()method 
public function getReciprocal():ComplexNumber

Returns the reciprocal of this.

Returns
ComplexNumber — A new complex that is the reciprocal of this.
getRotation()method 
public static function getRotation(t:Number):ComplexNumber

Returns exp(it).

Parameters
t:Number — The angle

Returns
ComplexNumber — The complex number exp(it)
multiplyC()method 
public function multiplyC(v:ComplexNumber):void

Multiplies a complex number with this complex number.

Parameters
v:ComplexNumber — The complex factor.
multiplyF()method 
public function multiplyF(r:Number):void

Multiplies a real number with this complex number.

Parameters
r:Number — The real factor.
norm()method 
public function norm():Number

Return the norm of the complex number.

Returns
Number — The norm of the complex number.
norm2()method 
public function norm2():Number

Return the squared norm of the complex number.

Returns
Number — The squared norm of the complex number.
normalize()method 
public function normalize():void

Normalizes the complex number so that it's length is 1.

reciprocal()method 
public function reciprocal():void

Sets this complex number to its reciprocal.

scalarProduct()method 
protected function scalarProduct(z:ComplexNumber):Number

Return the euclidian scalar product of the complex number and another complex number.

Parameters
z:ComplexNumber — Another complex number.

Returns
Number — The euclidian scalar product of the two complex numbers.
setTo()method 
public function setTo(p:IPoint):void

Sets this point to the given point.

Parameters
p:IPoint — The new point.
subtractC()method 
public function subtractC(v:ComplexNumber):void

Subtracts a complex number from this complex number.

Parameters
v:ComplexNumber — The complex number to be subtracted.
toArray()method 
public function toArray():Array

Returns an array of to doubles, the first is the real part, the second the imaginary part.

Returns
Array — The complex number as array.
toString()method 
public function toString():String

Returns a String representation of the point.

Returns
String — A String in appropriate format.