About
maxon::Complex is a MAXON API class used to represent complex numbers and deliver standard mathematical operations. A complex number is a number that can be expressed in the form a + bi, where a and b are real numbers, and i is a solution of the equation x^2 = -1, which is called an imaginary number because there is no real number that satisfies this equation. For the complex number a + bi, a is called the real part, and b is called the imaginary part. Usually complex numbers are represented in a 2D plane known as "complex plane" or "Argand plane" with the abscissa representing the real part and the ordinate representing the imaginary part.
Creation and initialization
A maxon::Complex instance can be created on the stack and initialized through the proper method using a numerical data type as template:
Standard operations
The maxon::Complex class delivers a set of standard mathematical operators to perform calculation with complex numbers. The operators delivered are:
complexB += complexA;
complexB = complexB * 10;
Get and Set operations
The maxon::Complex class is provided with a number of get methods to retrieve useful data from a maxon::Complex instance:
const maxon::Float squaredlengthValue = complexA.GetSquaredLength();
Complex GetNormalized() const
Definition: complex.h:299
Complex GetSqrt() const
Definition: complex.h:312
Complex GetConjugate() const
Definition: complex.h:307
Result< Complex > GetLog() const
Definition: complex.h:323
Float64 Float
Definition: apibase.h:211
#define iferr_return
Definition: resultbase.h:1524
The maxon::Complex class is provided with a number of "set" methods to define a maxon::Complex instance:
void SetPolar(const T len, const T phase)
Initialize Complex number by given polar coordinates.
Definition: complex.h:272
void SetExp(const T x)
set Complex number according to e^(i*x)
Definition: complex.h:278
void SetLength(const T len)
Set polar length (magnitude) in the Argand plane.
Definition: complex.h:260
void SetPhase(const T phase)
Set polar phase (angle) in the Argand plane.
Definition: complex.h:267
static constexpr Float64 PI05
floating point constant: 0.5 * PI
Definition: apibasemath.h:124
Conversion
A maxon::Complex instance can be converted to maxon::String using:
String ToString(const FormatStatement *formatStatement=nullptr) const
Definition: complex.h:358
Definition: string.h:1237
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:170
Utilities
A maxon::Complex instance can be read from and written to disk by serializing the data contained using the conventional functions.
const maxon::Id fileID(
"net.maxonexample.complex");
Definition: apibaseid.h:243
std::enable_if< GetCollectionKind< T >::value==COLLECTION_KIND::ARRAY, Result< void > >::type ReadDocument(const Url &url, const Id &id, T &object, const DataDictionary &dict=DataDictionary())
Definition: io.h:40
Result< void > WriteDocument(const Url &url, OPENSTREAMFLAGS flags, const Id &id, const T &object, IOFORMAT format=IOFORMAT::DEFAULT, const DataDictionary &dict=DataDictionary())
Definition: io.h:72
Further Reading