Project
Loading...
Searching...
No Matches
formulas.h File Reference

Defines 77 formulas based on SI datatypes, e.g. SI::formula::wavelength(). More...

#include <SI/constants.h>

Go to the source code of this file.

Namespaces

namespace  SI
namespace  SI::formula

Macros

#define FUNC   [[nodiscard]] inline

Functions

FUNC length SI::formula::hypotenuse_of_triangle (const length a, const length b)
 Calculates the hypotenuse in a right triangle, based on Pythagorean equation: a² + b² = c²
FUNC angle SI::formula::angle1_in_triangle (const length o, const length h)
 Calculates the angle in a right triangle from opposite (o) and hypotenuse (h).
FUNC angle SI::formula::angle2_in_triangle (const length a, const length h)
 Calculates the angle in a right triangle from adjacent (a) and hypotenuse (h).
FUNC angle SI::formula::angle3_in_triangle (const length a, const length o)
 Calculates the angle in a right triangle from adjacent (a) and opposite (o).
FUNC area SI::formula::area_of_triangle (const length b, const length h)
 Calculates the area of a triangle from base (b) and height (h).
FUNC length SI::formula::perimeter_of_rectangle (const length l, const length b)
 Calculates the perimeter of a rectangle from length (l) and base (b).
FUNC area SI::formula::area_of_rectangle (const length l, const length b)
 Calculates the area of a rectangle from length (l) and base (b).
FUNC length SI::formula::perimeter_of_square (const length a)
 Calculates the perimeter of a square from length (a).
FUNC area SI::formula::area_of_square (const length a)
 Calculates the area of a square from length (a).
FUNC area SI::formula::area_of_trapezoid (const length b1, const length b2, const length h)
 Calculates the area of a trapezoid from base 1 (b1), base 2 (b2) and height (h).
FUNC length SI::formula::circumference_of_circle (const length r)
 Calculates the circumference of a circle from radius (r).
FUNC length SI::formula::radius_of_circumference (const length c)
 Calculates the radius of a circle from circumference (c).
FUNC area SI::formula::area_of_circle (const length r)
 Calculates the area of a circle from radius (r).
FUNC length SI::formula::perimeter_of_ellipse (const length a, const length b)
 Calculates approximately(!) the perimeter of an ellipse from length of semi-major axis (a) and length of semi-minor axis (b).
FUNC area SI::formula::area_of_ellipse (const length a, const length b)
 Calculates the area of an ellipse from radius (a) and (b).
FUNC dimensionless SI::formula::eccentricity_of_ellipse (const length a, const length b)
 Calculates the eccentricity of an ellipse from radius (a) and (b).
FUNC length SI::formula::latus_rectum_of_ellipse (const length a, const length b)
 Calculates the latus rectum of an ellipse from radius (a) and (b).
FUNC length SI::formula::distance (const length x1, const length y1, const length x2, const length y2)
 Calculates the shortest distance between two points in 2D.
FUNC area SI::formula::area_of_cube (const length a)
 Calculates the area of a cube from length (a).
FUNC volume SI::formula::volume_of_cube (const length a)
 Calculates the volume of a cube from length (a).
FUNC area SI::formula::area_of_cylinder (const length r, const length h)
 Calculates the area of a cylinder from radius (r) and height (h).
FUNC volume SI::formula::volume_of_cylinder (const length r, const length h)
 Calculates the volume of a cylinder based on radius (r) and height (h).
FUNC area SI::formula::area_of_cone (const length r, const length h)
 Calculates the area of a cone from radius (r) and height (h).
FUNC volume SI::formula::volume_of_cone (const length r, const length h)
 Calculates the volume of a cone from radius (r) and height (h).
FUNC area SI::formula::area_of_sphere (const length r)
 Calculates the area of a sphere from radius (r).
FUNC volume SI::formula::volume_of_sphere (const length r)
 Calculates the volume of a sphere from radius (r).
FUNC volume SI::formula::volume_of_prism (const area A, const length h)
 Calculates the volume of a prism from base area (A) and height (h).
FUNC velocity SI::formula::average_speed (const length distance, const time duration)
 Calculates the average speed from distance and duration.
FUNC energy SI::formula::kinetic_energy (const mass m, const velocity v)
 Calculates the kinetic energy of a non-rotating object of mass (m) traveling at velocity (v).
FUNC time SI::formula::time_of_free_fall (const length height, const acceleration gravity)
 Calculates the free fall time from the given height.
FUNC length SI::formula::braking_distance (const velocity v0, const velocity v1, const acceleration deceleration)
 Calculates the braking distance to brake from v0 to v1 with the given deceleration.
FUNC acceleration SI::formula::acceleration_for_distance (const velocity v0, const velocity v1, const length distance)
 Calculates the acceleration necessary to accelerate from v0 to v1 within the given distance.
FUNC velocity SI::formula::final_velocity (const velocity i, const acceleration a, const SI::time t)
 Calculates the final velocity based on initial velocity (i) with acceleration (a) for time (t).
FUNC acceleration SI::formula::acceleration_of (const velocity delta_v, const SI::time delta_t)
 Calculates the acceleration from change in velocity (delta_v) and time interval (delta_t).
FUNC dimensionless SI::formula::wheel_rpm (const velocity v, const length r)
 Calculates the revolutions per minute (RPM) from velocity (v) and wheel radius (r).
FUNC velocity SI::formula::wheel_speed (const length r, const dimensionless RPM)
 Calculates the wheel speed from wheel radius (r) and revolutions per minute (RPM).
FUNC length SI::formula::turning_radius_of_vehicle (const length wheelbase, const angle steering_angle, const length tire_width)
 Calculates the turning radius of wheeled vehicles.
FUNC dimensionless SI::formula::g_force_of_acceleration (const velocity v0, const velocity v1, const time t)
 Calculates the G-force when accelerating from v0 to v1 within the given time.
FUNC velocity SI::formula::true_airspeed (const force lift_force, const dimensionless lift_coefficient, const area wing_surface, const density air_density)
 Calculates the true airspeed (TAS).
FUNC force SI::formula::lift_force_of_wing (const dimensionless lift_coefficient, const area wing_surface, const density air_density, const velocity true_air_speed)
 Calculates the lift force of an aircraft wing.
FUNC dimensionless SI::formula::Mach_number (const velocity v, const velocity speed_of_sound)
 Calculates the Mach number from velocity (v) of moving aircraft at altitude's speed of sound.
FUNC angle SI::formula::glide_path (const length h, const length v)
 Calculates the glide path from horizontal distance (h) and vertical change (v).
FUNC dimensionless SI::formula::glide_ratio (const length h, const length a)
 Calculates the glide ratio from horizontal distance (h) and altitude lost (a).
FUNC length SI::formula::vertical_height (const angle glide_path, const length horizontal_distance)
 Calculates the vertical height for the given glide path and horizontal distance.
FUNC velocity SI::formula::climb_rate (const velocity ground_speed, const angle climb_angle)
 Calculates the climb rate for the given speed and climb angle.
FUNC length SI::formula::turn_radius (const velocity ground_speed, const angle bank_angle)
 Calculates the turn radius at the given speed and bank angle.
FUNC energy SI::formula::gravitational_potential_energy (const mass m, const length h, const acceleration gravity)
 Calculates the gravitational potential energy of a mass (m) at height (h) based on gravity (e.g. on Earth).
FUNC force SI::formula::gravitational_attractive_force (const mass m1, const mass m2, const length d)
 Calculates the attractive force between two bodies of masses (m1) and (m2) with distance (d) between their centres of mass.
FUNC velocity SI::formula::gravitational_escape_velocity (const mass M, const length r)
 Calculates the escape velocity from a Mass (M) of body (e.g. a planet) with radius of body (r).
FUNC dimensionless SI::formula::flattening_factor (const length Re, const length Rp)
 Calculates the flattening factor (f) of an astronomical object from radius to equator (Re) and radius to pole (Rp).
FUNC acceleration SI::formula::local_gravity (const angle lat, const length h)
 Calculates the theoretical local gravity at latitude (lat) and height above MSL (h).
FUNC length SI::formula::Schwarzschild_radius (const mass M)
 Calculates the Schwarzschild radius of a black hole from it's mass (M).
FUNC length SI::formula::wavelength (const velocity v, const frequency f)
 Calculates the wavelength from velocity (v) and frequency (f).
FUNC electric_potential SI::formula::sine_wave (const electric_potential V0, const frequency f, const SI::time t)
 Calculates V(t) from peak voltage (V0), frequency (f), and time (t).
FUNC velocity SI::formula::speed_of_sound_in_air (const temperature T)
 Calculates the speed of sound in air based on temperature (T).
FUNC force SI::formula::drag_in_fluid (const density p, const velocity u, const dimensionless cd, const area A)
 Calculates the drag force based on mass density of the fluid (p), flow velocity (u), drag coefficient (cd) and reference area (A).
FUNC frequency SI::formula::frequency_of_chromatic_note (const int note, const int reference_note, const frequency reference_frequency)
 Calculates the frequency of a chromatic music note.
FUNC auto SI::formula::Newtons_motion (const length s0, const velocity v0, const acceleration a, const time t)
FUNC auto SI::formula::Lorentz_force (const double q, const velocity v, const double B)
 Calculates the Lorentz force.
FUNC temperature SI::formula::windchill_temperature (const temperature air_temperature, const velocity wind_speed)
 Calculates the windchill temperature.
FUNC temperature SI::formula::temperature_gradient (const length altitude)
 Returns the temperature gradient per kilometer for the given geopotential altitude.
FUNC density SI::formula::density_of_dry_air (const pressure air_pressure, const temperature air_temperature)
 Calculates the density of dry air.
FUNC density SI::formula::density_of (const mass m, const volume V)
 Calculates the density from mass (m) and volume (V).
FUNC mass SI::formula::mass_of (const density p, const volume V)
 Calculates the mass from density (p) and volume (V).
FUNC volume SI::formula::volume_of (const mass m, const density p)
 Calculates the volume from mass (m) and density (p).
FUNC dimensionless SI::formula::BMI (const mass w, const length h)
 Calculates the human body-mass index (BMI) from weight (w) and height (h).
FUNC auto SI::formula::consumed_electrical_power (const electric_current I, const electric_potential U)
 Calculates the consumed electrical power of a current (I) and potential (U).
FUNC auto SI::formula::sound_intensity (const power power_of_sound_source, const length distance_from_sound_source)
 Calculates the sound intensity of a sound source from a distance.
FUNC length SI::formula::ballistic_max_height (const velocity v0, const length h, const angle a, const acceleration g)
 Calculates the max height of a bullet (without force of drag, wind, etc.), based on: initial launch velocity (v0), initial height (h), launch angle (a), and gravitation (g).
FUNC length SI::formula::ballistic_max_range (const velocity v0, const length h, const angle a, const acceleration g)
 Calculates the max range of a bullet (without force of drag, wind, etc.), based on: initial launch velocity (v0), initial height (h), launch angle (a), and gravitation (g).
FUNC time SI::formula::ballistic_travel_time (const velocity v0, const length h, const angle a, const acceleration g)
 Calculates the flight time of a bullet (without force of drag, wind, etc.), based on: initial launch velocity (v0), initial height (h), launch angle (a), and gravitation (g).
FUNC specific_energy SI::formula::absorbed_dose (const energy E, const mass m)
 Calculates the amount of energy absorbed (E) from a source of radiation by some material per mass (m).
FUNC velocity SI::formula::min_of_array (velocity arr[], int n)
 Returns the minimum velocity in the given array.
FUNC velocity SI::formula::max_of_array (velocity arr[], int n)
 Returns the maximum velocity in the given array.
FUNC velocity SI::formula::avg_of_array (velocity arr[], int n)
 Returns the average velocity in the given array.
FUNC velocity SI::formula::sum_of_array (velocity arr[], int n)
 Returns the sum of all velocities in the given array.
FUNC length SI::formula::distance_on_Earth (angle lat1, angle long1, angle lat2, angle long2)
 Calculates the distance between two lat/long coordinates on Earth (haversine formula).

Detailed Description

Defines 77 formulas based on SI datatypes, e.g. SI::formula::wavelength().

Categories are: 2D, 3D, Moving Objects, Vehicle, Aircraft, Gravitation, Various, and References.

Macro Definition Documentation

◆ FUNC

#define FUNC   [[nodiscard]] inline