This class provides you with an interface for easy handling of the complex number space with single precision float data type. If you like to get some more background around complex numbers and the corresponding functions, please read the Wikipedia Article http://en.wikipedia.org/wiki/Complex_number.
As with all Classes in TkMath, Complexf fully supports the serialisation interface.
Initialises the x component with a and the y component with b.
Similar to Complexf:init, only that it initialises the polar coordinates.
Creates a new Complexf instance and initialises its x and y values with x=a and y=b.
Returns the newly created instance
Similar to Complexf:New, only that it initialises the polar coordinates.
same as Complex.New
same as Complex.NewPolar
The Complexf class represents complex numbers which can be either interpreted as (x+iy) or as (r·eia)
These elements can be accessed individually:
Read/Write the x component of (x+iy).
Read/Write the y component of (x+iy).
Read/Write the r component of (r·eia).
Only works on non-zero complex numbers, exception is thrown if a zero Complexf value occurs.
Read/Write the a component of (r·eia).
Only works on non-zero complex numbers, exception is thrown if a zero Complexf value occurs.
Read out the string representation (x+iy) of a complex number. This property is Read-Only!
Read out the string representation (r·eia) of a complex number. This property is Read-Only!
Returns the length of the complex number. Same as element r. This property is Read-Only!
Returns the squared length of the complex number. Same as r2. This property is Read-Only!
Keep in mind when using the polar representation, that internally Complexf saves in (x+iy) format and thus some translation overhead as well as inaccuracies are occuring
As Complexf uses the Array Interface to collect its values from other classes, such as FloatArray, Lists or even Vector2f.
Simply use the assign operator:
Complexf val;
val=[1,2];
The following operators are supported by the Complexf class to allow intuitive handling of complex numbers:
Operator | Type of second Value | Action | Returns |
<this>=<other> | Complexf
Generic Array Object |
copy contents from other to this
copy contents from other to this |
this |
<this>==<other> | Complexf | comparison if equal | bool |
<this>!=<other> | Complexf | comparison if not equal | bool |
<this>+<other> | Complexf | complex addition | this |
<this>-<other> | Complexf | complex substraction | this |
<this>*<other> | Complexf | complex multiplication | this |
<this>/<other> | Complexf | complex division | this |
-<this> | none | negate components | this |
The reference to <this> does mean, that for example
Complexf x,y;
x=y*(x+y);
gives correct results, as a new temporary copy is created and used automatically by the TKS core.
Complexf uses the default TKS YAC Array interface, and thus you are capable of accessing its elements in a manner similar to common arrays.
This is currently only supported for the euclidean representation (x+iy), so that
Complexf[0]=Complexf.x
Complexf[1]=Complexf.y
implements RSELF, RVAL, RARG
Add another complex number to this.
implements RSELF, RVAL, RARG
Subtract another complex number of this.
implements RSELF, RVAL, RARG
Multiplicate a scalar value with this.
implements RSELF, RVAL, RARG
Multiplicate another complex number with this
Multiplicate another complex conjugated number with this and return the resulting scalar.
implements RSELF, RVAL, RARG
Divide this by a.
implements RSELF, RVAL, RARG
Invert this this=(1/this)
implements RSELF, RVAL, RARG
Set length of this to 1.
implements RSELF, RVAL, RARG
Set length of this to s.
implements RVAL, RARG
Returns complex √z
implements RVAL, RARG
Returns complex ab
implements RVAL, RARG
Returns complex ez
implements RVAL, RARG
Returns complex log z
implements RVAL, RARG
Returns complex sine of a
implements RVAL, RARG
Returns complex cosine of a
implements RVAL, RARG
Returns complex tangent of a
implements RVAL, RARG
Returns complex inverted sine of a
implements RVAL, RARG
Returns complex inverted cosine of a
implements RVAL, RARG
Returns complex inverted tangent of a
implements RVAL, RARG
Returns complex hyperbolic sine
implements RVAL, RARG
Returns complex hyperbolic cosine
implements RVAL, RARG
Returns complex hyperbolic tangent
implements RVAL, RARG
Returns complex inverted hyperbolic sine
implements RVAL, RARG
Returns complex inverted hyperbolic cosine
implements RVAL, RARG
Returns complex inverted hyperbolic tangent