numerics 0.1.0
Loading...
Searching...
No Matches
num::viz Namespace Reference

Namespaces

namespace  detail
 

Classes

struct  Color
 
struct  Frame
 

Functions

inline ::Color to_rl (Color c)
 
Color from_rl (::Color c)
 
Color unpack (uint32_t c)
 
Color heat_color (float t)
 Heat colormap for \(t\in[0,1]\).
 
Color diverging_color (float t)
 Diverging colormap for \(t\in[-1,1]\).
 
Color phase_hsv_color (double prob, double phase, double max_prob)
 Phase/probability colormap for quantum wavefunctions.
 
Color lerp_color (Color a, Color b, float t)
 
template<class DrawFn >
void run (const char *title, int w, int h, DrawFn draw, Color bg={15, 15, 15, 255})
 

Variables

constexpr Color kBlack = {0, 0, 0, 255}
 
constexpr Color kWhite = {255, 255, 255, 255}
 
constexpr Color kRed = {220, 40, 40, 255}
 
constexpr Color kGreen = {50, 200, 50, 255}
 
constexpr Color kBlue = {50, 100, 230, 255}
 
constexpr Color kYellow = {240, 220, 30, 255}
 
constexpr Color kGray = {120, 120, 120, 255}
 
constexpr Color kSkyBlue = {100, 180, 240, 255}
 

Function Documentation

◆ diverging_color()

Color num::viz::diverging_color ( float  t)
inline

Diverging colormap for \(t\in[-1,1]\).

Definition at line 46 of file viz.hpp.

◆ from_rl()

Color num::viz::from_rl ( ::Color  c)
inline

Definition at line 31 of file viz.hpp.

References num::viz::Color::r.

Referenced by heat_color().

◆ heat_color()

Color num::viz::heat_color ( float  t)
inline

Heat colormap for \(t\in[0,1]\).

Definition at line 40 of file viz.hpp.

References from_rl().

◆ lerp_color()

Color num::viz::lerp_color ( Color  a,
Color  b,
float  t 
)
inline

◆ phase_hsv_color()

Color num::viz::phase_hsv_color ( double  prob,
double  phase,
double  max_prob 
)
inline

Phase/probability colormap for quantum wavefunctions.

Definition at line 58 of file viz.hpp.

References num::e, and kBlack.

◆ run()

template<class DrawFn >
void num::viz::run ( const char *  title,
int  w,
int  h,
DrawFn  draw,
Color  bg = {15, 15, 15, 255} 
)

Definition at line 290 of file viz.hpp.

◆ to_rl()

◆ unpack()

Color num::viz::unpack ( uint32_t  c)
inline

Definition at line 35 of file viz.hpp.

Variable Documentation

◆ kBlack

constexpr Color num::viz::kBlack = {0, 0, 0, 255}
inlineconstexpr

Definition at line 19 of file viz.hpp.

Referenced by phase_hsv_color().

◆ kBlue

constexpr Color num::viz::kBlue = {50, 100, 230, 255}
inlineconstexpr

Definition at line 23 of file viz.hpp.

◆ kGray

constexpr Color num::viz::kGray = {120, 120, 120, 255}
inlineconstexpr

Definition at line 25 of file viz.hpp.

◆ kGreen

constexpr Color num::viz::kGreen = {50, 200, 50, 255}
inlineconstexpr

Definition at line 22 of file viz.hpp.

◆ kRed

constexpr Color num::viz::kRed = {220, 40, 40, 255}
inlineconstexpr

Definition at line 21 of file viz.hpp.

◆ kSkyBlue

constexpr Color num::viz::kSkyBlue = {100, 180, 240, 255}
inlineconstexpr

Definition at line 26 of file viz.hpp.

◆ kWhite

constexpr Color num::viz::kWhite = {255, 255, 255, 255}
inlineconstexpr

Definition at line 20 of file viz.hpp.

◆ kYellow

constexpr Color num::viz::kYellow = {240, 220, 30, 255}
inlineconstexpr

Definition at line 24 of file viz.hpp.