raytracer
Parallel Ray Tracer written from scratch (no graphics API).
Loading...
Searching...
No Matches
raytracer::common::Complex Struct Reference

#include <complex.h>

Collaboration diagram for raytracer::common::Complex:

Public Member Functions

constexpr Complex (const double _re, const double _im)
constexpr double real_part () const
constexpr double imaginary_part () const
constexpr Complex squared () const
constexpr Complex conjugate () const
double magnitude () const
constexpr double magnitude_squared () const
constexpr Complex operator- () const
constexpr Complex operator+ (Complex const &other) const
constexpr Complex operator- (Complex const &other) const

Public Attributes

double re
double im

Static Public Attributes

static const Complex ZERO = {0, 0}

Detailed Description

An imaginary number, with a real and an imaginary part. Both are doubles.

Constructor & Destructor Documentation

◆ Complex()

raytracer::common::Complex::Complex ( const double _re,
const double _im )
inlineconstexpr
Here is the caller graph for this function:

Member Function Documentation

◆ conjugate()

Complex raytracer::common::Complex::conjugate ( ) const
inlinenodiscardconstexpr

Returns the complex conjugate of the complex number, with has the same real part and minus the imaginary part.

Returns
The complex conjugate of the complex number, with has the same real part and minus the imaginary part.
Here is the call graph for this function:

◆ imaginary_part()

double raytracer::common::Complex::imaginary_part ( ) const
inlinenodiscardconstexpr

Getter for the imaginary part of the complex number.

Returns
The imaginary part of the complex number.

◆ magnitude()

double raytracer::common::Complex::magnitude ( ) const
inlinenodiscard

Returns the magnitude of the complex number, given by re^2 + im^2.

Returns
The magnitude of the complex number.

◆ magnitude_squared()

double raytracer::common::Complex::magnitude_squared ( ) const
inlinenodiscardconstexpr

Removes an expensive std::sqrt operation.

Returns
The squared magnitude of the complex number.

◆ operator+()

Complex raytracer::common::Complex::operator+ ( Complex const & other) const
inlineconstexpr
Here is the call graph for this function:

◆ operator-() [1/2]

Complex raytracer::common::Complex::operator- ( ) const
inlineconstexpr
Here is the call graph for this function:

◆ operator-() [2/2]

Complex raytracer::common::Complex::operator- ( Complex const & other) const
inlineconstexpr
Here is the call graph for this function:

◆ real_part()

double raytracer::common::Complex::real_part ( ) const
inlinenodiscardconstexpr

Getter for the real part of the complex number.

Returns
The real part of the complex number.

◆ squared()

Complex raytracer::common::Complex::squared ( ) const
inlinenodiscardconstexpr

Returns the result of multiplying the complex number with itself.

Returns
The result of multiplying the complex number with itself.
Here is the call graph for this function:

Member Data Documentation

◆ im

double raytracer::common::Complex::im

◆ re

double raytracer::common::Complex::re

◆ ZERO

Complex raytracer::common::Complex::ZERO = {0, 0}
inlinestaticconstexpr

A complex number where both the real part and the imaginary part are set to zero.


The documentation for this struct was generated from the following file: