doodle  0.2
Intended to support teaching C++, doodle is a simple library that helps make a window and makes it easy to do some drawing.
Functions | Variables
Angles

Functions

constexpr double doodle::to_radians (double angle_in_degrees) noexcept
 Converts a degree measurement to its corresponding value in radians. Radians and degrees are two ways of measuring the same thing. There are 360 degrees in a circle and \(2\pi\) radians in a circle. For example, \(90^{\circ}=\frac{\pi}{2}=1.5707964\). More...
 
constexpr double doodle::to_degrees (double angle_in_radians) noexcept
 Converts a radian measurement to its corresponding value in degrees. Radians and degrees are two ways of measuring the same thing. There are 360 degrees in a circle and \(2\pi\) radians in a circle. For example, \(90^{\circ}=\frac{\pi}{2}=1.5707964\). More...
 

Variables

constexpr double doodle::PI = 3.1415926535897932384626433832795028
 \(\pi\) More...
 
constexpr double doodle::HALF_PI = PI / 2.0
 \(\frac{\pi}{2}\) More...
 
constexpr double doodle::QUARTER_PI = PI / 4.0
 \(\frac{\pi}{4}\) More...
 
constexpr double doodle::TWO_PI = 2.0 * PI
 \(2\pi\) More...
 

Detailed Description

Function Documentation

◆ to_degrees()

constexpr double doodle::to_degrees ( double  angle_in_radians)
constexprnoexcept

Converts a radian measurement to its corresponding value in degrees. Radians and degrees are two ways of measuring the same thing. There are 360 degrees in a circle and \(2\pi\) radians in a circle. For example, \(90^{\circ}=\frac{\pi}{2}=1.5707964\).

Parameters
angle_in_radiansan angle measured in radians
constexpr double theta = to_degrees(QUARTER_PI);
std::cout << QUARTER_PI << " radians is " << theta << " degrees\n";
// prints: 0.785398 radians is 45 degrees
constexpr double QUARTER_PI
Definition: angle.hpp:50
constexpr double to_degrees(double angle_in_radians) noexcept
Converts a radian measurement to its corresponding value in degrees. Radians and degrees are two ways...
Definition: angle.hpp:93
Returns
the corresponding angle measured in degrees

Definition at line 93 of file angle.hpp.

93 { return angle_in_radians * 180.0 / PI; }
constexpr double PI
Definition: angle.hpp:27

◆ to_radians()

constexpr double doodle::to_radians ( double  angle_in_degrees)
constexprnoexcept

Converts a degree measurement to its corresponding value in radians. Radians and degrees are two ways of measuring the same thing. There are 360 degrees in a circle and \(2\pi\) radians in a circle. For example, \(90^{\circ}=\frac{\pi}{2}=1.5707964\).

Parameters
angle_in_degreesan angle measured in degrees
constexpr double theta = to_radians(45.0);
std::cout << 45.0 << " degrees is " << theta << " radians\n";
// prints: 45 degrees is 0.785398 radians
constexpr double to_radians(double angle_in_degrees) noexcept
Converts a degree measurement to its corresponding value in radians. Radians and degrees are two ways...
Definition: angle.hpp:78
Returns
the corresponding angle measured in radians

Definition at line 78 of file angle.hpp.

78 { return angle_in_degrees * PI / 180.0; }

Variable Documentation

◆ HALF_PI

constexpr double doodle::HALF_PI = PI / 2.0
constexpr

\(\frac{\pi}{2}\)

HALF_PI is a mathematical constant with the value ~1.57079. It is half the ratio of the circumference of a circle to its diameter. It is useful in combination with the trigonometric functions sin() and cos().

double x = std::cos(HALF_PI);
double y = std::sin(HALF_PI);
constexpr double HALF_PI
Definition: angle.hpp:39

Definition at line 39 of file angle.hpp.

◆ PI

constexpr double doodle::PI = 3.1415926535897932384626433832795028
constexpr

\(\pi\)

PI is a mathematical constant with the value ~3.1415. It is the ratio of the circumference of a circle to its diameter. It is useful in combination with the trigonometric functions sin() and cos().

double x = std::cos(PI);
double y = std::sin(PI);

Definition at line 27 of file angle.hpp.

◆ QUARTER_PI

constexpr double doodle::QUARTER_PI = PI / 4.0
constexpr

\(\frac{\pi}{4}\)

QUARTER_PI is a mathematical constant with the value ~0.7853982. It is one quarter the ratio of the circumference of a circle to its diameter. It is useful in combination with the trigonometric functions sin() and cos().

double x = std::cos(QUARTER_PI);
double y = std::sin(QUARTER_PI);

Definition at line 50 of file angle.hpp.

◆ TWO_PI

constexpr double doodle::TWO_PI = 2.0 * PI
constexpr

\(2\pi\)

TWO_PI is a mathematical constant with the value ~6.2831. It is twice the ratio of the circumference of a circle to its diameter. It is useful in combination with the trigonometric functions sin() and cos().

double x = std::cos(TWO_PI);
double y = std::sin(TWO_PI);
constexpr double TWO_PI
Definition: angle.hpp:62

Definition at line 62 of file angle.hpp.