Project
Loading...
Searching...
No Matches
formulas.h
Go to the documentation of this file.
1
4
5#pragma once
6#include <SI/constants.h>
7#define FUNC [[nodiscard]] inline
8
9namespace SI { namespace formula {
10
11 // 1. 2D Formulas
12 // --------------
14 FUNC length hypotenuse_of_triangle(const length a, const length b)
15 {
16 return sqrt(a*a + b*b);
17 }
18
20 FUNC angle angle1_in_triangle(const length o, const length h)
21 {
22 return radians(asin(o / h));
23 }
24
26 FUNC angle angle2_in_triangle(const length a, const length h)
27 {
28 return radians(acos(a / h));
29 }
30
32 FUNC angle angle3_in_triangle(const length a, const length o)
33 {
34 return radians(atan(o / a));
35 }
36
38 FUNC area area_of_triangle(const length b, const length h)
39 {
40 return 0.5 * b * h;
41 }
42
44 FUNC length perimeter_of_rectangle(const length l, const length b)
45 {
46 return 2. * (l + b);
47 }
48
50 FUNC area area_of_rectangle(const length l, const length b)
51 {
52 return l * b;
53 }
54
56 FUNC length perimeter_of_square(const length a)
57 {
58 return 4. * a;
59 }
60
62 FUNC area area_of_square(const length a)
63 {
64 return a * a;
65 }
66
68 FUNC area area_of_trapezoid(const length b1, const length b2, const length h)
69 {
70 return 0.5 * (b1 + b2) * h;
71 }
72
74 FUNC length circumference_of_circle(const length r)
75 {
76 return constant::tau * r;
77 }
78
80 FUNC length radius_of_circumference(const length c)
81 {
82 return c / constant::tau;
83 }
84
86 FUNC area area_of_circle(const length r)
87 {
88 return constant::pi * r * r;
89 }
90
92 FUNC length perimeter_of_ellipse(const length a, const length b)
93 {
94 return constant::pi * sqrt(2.0 * (square(a) + square(b)));
95 }
96
98 FUNC area area_of_ellipse(const length a, const length b)
99 {
100 return constant::pi * a * b;
101 }
102
104 FUNC dimensionless eccentricity_of_ellipse(const length a, const length b)
105 {
106 return std::sqrt(1.0 - (square(b) / square(a)));
107 }
108
110 FUNC length latus_rectum_of_ellipse(const length a, const length b)
111 {
112 return 2.0 * square(b) / a;
113 }
114
116 FUNC length distance(const length x1, const length y1, const length x2, const length y2)
117 {
118 const length dx = x2 - x1;
119 const length dy = y2 - y1;
120 return sqrt((dx * dx) + (dy * dy));
121 }
122
123 // 2. 3D Formulas
124 // --------------
126 FUNC area area_of_cube(const length a)
127 {
128 return 6. * a * a;
129 }
130
132 FUNC volume volume_of_cube(const length a)
133 {
134 return a * a * a;
135 }
136
138 FUNC area area_of_cylinder(const length r, const length h)
139 {
140 return constant::tau * r * (r + h);
141 }
142
144 FUNC volume volume_of_cylinder(const length r, const length h)
145 {
146 return constant::pi * square(r) * h;
147 }
148
150 FUNC area area_of_cone(const length r, const length h)
151 {
152 return constant::pi * r * (r + h);
153 }
154
156 FUNC volume volume_of_cone(const length r, const length h)
157 {
158 return (1./3.) * constant::pi * square(r) * h;
159 }
160
162 FUNC area area_of_sphere(const length r)
163 {
164 return 4. * constant::pi * square(r);
165 }
166
168 FUNC volume volume_of_sphere(const length r)
169 {
170 return (4. / 3.) * constant::pi * r * r * r;
171 }
172
174 FUNC volume volume_of_prism(const area A, const length h)
175 {
176 return A * h;
177 }
178
179 // 3. Moving Objects
180 // -----------------
182 FUNC velocity average_speed(const length distance, const time duration)
183 {
184 return distance / duration;
185 }
186
188 FUNC energy kinetic_energy(const mass m, const velocity v)
189 {
190 return 0.5 * m * square(v);
191 }
192
194 FUNC time time_of_free_fall(const length height, const acceleration gravity)
195 {
196 return sqrt((2. * height) / gravity);
197 }
198
200 FUNC length braking_distance(const velocity v0, const velocity v1, const acceleration deceleration)
201 {
202 return (square(v0) - square(v1)) / (2.0 * deceleration);
203 }
204
206 FUNC acceleration acceleration_for_distance(const velocity v0, const velocity v1, const length distance)
207 {
208 return (square(v1) - square(v0)) / (2.0 * distance);
209 }
210
212 FUNC velocity final_velocity(const velocity i, const acceleration a, const SI::time t)
213 {
214 return i + a * t;
215 }
216
218 FUNC acceleration acceleration_of(const velocity delta_v, const SI::time delta_t)
219 {
220 return delta_v / delta_t;
221 }
222
223 // 4. Vehicle Formulas
224 // -------------------
226 FUNC dimensionless wheel_rpm(const velocity v, const length r)
227 {
228 return v / (constant::tau * r) * 60_s;
229 }
230
232 FUNC velocity wheel_speed(const length r, const dimensionless RPM)
233 {
234 return constant::tau * r * (RPM / 60_s);
235 }
236
238 FUNC length turning_radius_of_vehicle(const length wheelbase, const angle steering_angle, const length tire_width)
239 {
240 return wheelbase / sin(steering_angle) + tire_width / 2.0;
241 }
242
244 FUNC dimensionless g_force_of_acceleration(const velocity v0, const velocity v1, const time t)
245 {
246 return (v1 - v0) / (t * constant::Earth_gravity);
247 }
248
249 // 5. Aircraft Formulas
250 // --------------------
252 FUNC velocity true_airspeed(const force lift_force, const dimensionless lift_coefficient, const area wing_surface, const density air_density)
253 {
254 return sqrt((2.0 * lift_force) / (lift_coefficient * wing_surface * air_density));
255 }
256
258 FUNC force lift_force_of_wing(const dimensionless lift_coefficient, const area wing_surface, const density air_density, const velocity true_air_speed)
259 {
260 return 0.5 * air_density * square(true_air_speed) * wing_surface * lift_coefficient;
261 }
262
264 FUNC dimensionless Mach_number(const velocity v, const velocity speed_of_sound)
265 {
266 return v / speed_of_sound;
267 }
268
270 FUNC angle glide_path(const length h, const length v)
271 {
272 return atan2(v, h);
273 }
274
276 FUNC dimensionless glide_ratio(const length h, const length a)
277 {
278 return h / a;
279 }
280
282 FUNC length vertical_height(const angle glide_path, const length horizontal_distance)
283 {
284 return horizontal_distance * tan(glide_path);
285 }
286
288 FUNC velocity climb_rate(const velocity ground_speed, const angle climb_angle)
289 {
290 return sin(climb_angle) * ground_speed;
291 }
292
294 FUNC length turn_radius(const velocity ground_speed, const angle bank_angle)
295 {
296 return (ground_speed * ground_speed) / (constant::Earth_gravity * tan(bank_angle));
297 }
298
299 // 6. Formulas for Gravitation
300 // ---------------------------
302 FUNC energy gravitational_potential_energy(const mass m, const length h, const acceleration gravity)
303 {
304 return m * h * gravity;
305 }
306
308 FUNC force gravitational_attractive_force(const mass m1, const mass m2, const length d)
309 {
310 return (constant::G * m1 * m2) / square(d);
311 }
312
314 FUNC velocity gravitational_escape_velocity(const mass M, const length r)
315 {
316 return sqrt((2.0 * constant::G * M) / r);
317 }
318
320 FUNC dimensionless flattening_factor(const length Re, const length Rp)
321 {
322 return (Re - Rp) / Re;
323 }
324
326 FUNC acceleration local_gravity(const angle lat, const length h)
327 {
328 auto IGF = 9.780327_m_per_s² * (1.0 + 0.0053024 * sin2(lat) - 0.0000058 * sin2(2.0 * lat)); // International Gravity Formula
329 auto FAC = -3.086e-6_m_per_s² * meters(h); // Free Air Correction
330 return IGF + FAC;
331 }
332
334 FUNC length Schwarzschild_radius(const mass M)
335 {
336 return (2.0 * constant::G * M) / square(constant::c);
337 }
338
339 // 7. Various Formulas
340 // -------------------
342 FUNC length wavelength(const velocity v, const frequency f)
343 {
344 return v / f;
345 }
346
348 FUNC electric_potential sine_wave(const electric_potential V0, const frequency f, const SI::time t)
349 {
350 return V0 * sin(constant::tau * f * t);
351 }
352
354 FUNC velocity speed_of_sound_in_air(const temperature T)
355 {
356 double adiabatic_index = 1.4; // for air
357 auto M = 0.0289645_kg_per_mol; // molar mass of the gas
358 return sqrt((adiabatic_index * constant::R * T) / M);
359 }
360
362 FUNC force drag_in_fluid(const density p, const velocity u, const dimensionless cd, const area A)
363 {
364 return 0.5 * p * (u * u) * cd * A;
365 }
366
368 FUNC frequency frequency_of_chromatic_note(const int note, const int reference_note, const frequency reference_frequency)
369 {
370 return std::pow(std::pow(2., 1. / 12.), note - reference_note) * reference_frequency;
371 }
372
373 FUNC auto Newtons_motion(const length s0, const velocity v0, const acceleration a, const time t)
374 {
375 return s0 + v0 * t + 0.5 * a * t * t;
376 }
377
379 FUNC auto Lorentz_force(const double q, const velocity v, const double B)
380 {
381 return q * v * B;
382 }
383
385 FUNC temperature windchill_temperature(const temperature air_temperature, const velocity wind_speed)
386 {
387 auto air_celsius = celsius(air_temperature);
388 return celsius(13.12 + 0.6215 * air_celsius
389 + (0.3965 * air_celsius - 11.37) * std::pow(wind_speed / 1_km_per_h, 0.16));
390 }
391
393 FUNC temperature temperature_gradient(const length altitude)
394 {
395 if (altitude <= 11_km)
396 return -6.5_K;
397 if (altitude <= 20_km)
398 return 0_K;
399 if (altitude <= 32_km)
400 return 1_K;
401 if (altitude <= 37_km)
402 return 2.8_K;
403 if (altitude <= 51_km)
404 return 0_K;
405 if (altitude <= 71_km)
406 return -2.8_K;
407 return -2_K;
408 }
409
411 FUNC density density_of_dry_air(const pressure air_pressure, const temperature air_temperature)
412 {
413 return air_pressure / (constant::R_dry_air * air_temperature);
414 }
415
417 FUNC density density_of(const mass m, const volume V)
418 {
419 return m / V;
420 }
421
423 FUNC mass mass_of(const density p, const volume V)
424 {
425 return p * V;
426 }
427
429 FUNC volume volume_of(const mass m, const density p)
430 {
431 return m / p;
432 }
433
435 FUNC dimensionless BMI(const mass w, const length h)
436 {
437 return (w / square(h)) / 1_kg_per_m²;
438 }
439
441 FUNC auto consumed_electrical_power(const electric_current I, const electric_potential U)
442 {
443 return I * U;
444 }
445
447 FUNC auto sound_intensity(const power power_of_sound_source, const length distance_from_sound_source)
448 {
449 return power_of_sound_source / (4.0 * constant::pi * square(distance_from_sound_source));
450 }
451
454 FUNC length ballistic_max_height(const velocity v0, const length h, const angle a, const acceleration g)
455 {
456 return h + square(v0 * sin(a)) / (2.0 * g);
457 }
458
461 FUNC length ballistic_max_range(const velocity v0, const length h, const angle a, const acceleration g)
462 {
463 return ((v0 * sin(a) + sqrt(square(v0 * sin(a)) + 2.0 * g * h)) / g) * cos(a) * v0;
464 }
465
468 FUNC time ballistic_travel_time(const velocity v0, const length h, const angle a, const acceleration g)
469 {
470 return (v0 * sin(a) + sqrt(square(v0 * sin(a)) + 2.0 * g * h)) / g;
471 }
472
474 FUNC specific_energy absorbed_dose(const energy E, const mass m)
475 {
476 return E / m;
477 }
478
480 FUNC velocity min_of_array(velocity arr[], int n)
481 {
482 if (n < 1)
483 return meters_per_second(0);
484 velocity minimum = arr[0];
485 for (int i = 1; i < n; ++i)
486 if (arr[i] < minimum)
487 minimum = arr[i];
488 return minimum;
489 }
490
492 FUNC velocity max_of_array(velocity arr[], int n)
493 {
494 if (n < 1)
495 return meters_per_second(0);
496 velocity maximum = arr[0];
497 for (int i = 1; i < n; ++i)
498 if (arr[i] > maximum)
499 maximum = arr[i];
500 return maximum;
501 }
502
504 FUNC velocity avg_of_array(velocity arr[], int n)
505 {
506 if (n < 1)
507 return meters_per_second(0);
508 velocity sum = meters_per_second(0);
509 for (int i = 0; i < n; ++i)
510 sum += arr[i];
511 return sum / n;
512 }
513
515 FUNC velocity sum_of_array(velocity arr[], int n)
516 {
517 velocity sum = meters_per_second(0);
518 for (int i = 0; i < n; ++i)
519 sum += arr[i];
520 return sum;
521 }
522
524 FUNC length distance_on_Earth(angle lat1, angle long1, angle lat2, angle long2)
525 {
526 angle dLat = lat1 - lat2; // difference in latitude
527 angle dLong = long1 - long2; // difference in longitude
528
529 angle a = sin2(dLat / 2.) + cos(lat1) * cos(lat2) * sin2(dLong / 2.); // Haversine intermediate
530 auto c = 2. * atan2(sqrt(a), sqrt(1. - a)); // central angle
531
532 return c * 6371.0088_km; // mean Earth radius, recommended by NOAA
533 }
534
535 // 8. References
536 // -------------
537 // 1. https://en.wikipedia.org/wiki/Turning_radius
538 // 2. https://en.wikipedia.org/wiki/Lift_(force)
539 // 3. https://en.wikipedia.org/wiki/Wavelength
540 // 4. https://en.wikipedia.org/wiki/Lorentz_force
541 // 5. https://de.wikipedia.org/wiki/Windchill
542 // 6. https://en.wikipedia.org/wiki/Density_of_air
543 // 7. https://physics.info/equations/
544 // 8. https://www.vcalc.com/wiki/ballistic-max-height
545 // 9. https://www.vcalc.com/wiki/ballistic-range
546 // 10. https://www.vcalc.com/wiki/ballistic-travel-time
547 // 11. https://best-calculators.com/tools/latitude-longitude-distance-calculator/
548
549} } // end of namespace SI::formula
550
551#undef FUNC
Defines 77 type-safe constants, e.g. speed_of_light_in_vacuum.
#define FUNC
Definition formulas.h:7
Definition formulas.h:9
FUNC energy 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....
Definition formulas.h:302
FUNC angle angle1_in_triangle(const length o, const length h)
Calculates the angle in a right triangle from opposite (o) and hypotenuse (h).
Definition formulas.h:20
FUNC temperature windchill_temperature(const temperature air_temperature, const velocity wind_speed)
Calculates the windchill temperature.
Definition formulas.h:385
FUNC frequency frequency_of_chromatic_note(const int note, const int reference_note, const frequency reference_frequency)
Calculates the frequency of a chromatic music note.
Definition formulas.h:368
FUNC length distance(const length x1, const length y1, const length x2, const length y2)
Calculates the shortest distance between two points in 2D.
Definition formulas.h:116
FUNC velocity 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).
Definition formulas.h:314
FUNC density density_of(const mass m, const volume V)
Calculates the density from mass (m) and volume (V).
Definition formulas.h:417
FUNC area area_of_cylinder(const length r, const length h)
Calculates the area of a cylinder from radius (r) and height (h).
Definition formulas.h:138
FUNC velocity 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).
Definition formulas.h:212
FUNC length distance_on_Earth(angle lat1, angle long1, angle lat2, angle long2)
Calculates the distance between two lat/long coordinates on Earth (haversine formula).
Definition formulas.h:524
FUNC velocity min_of_array(velocity arr[], int n)
Returns the minimum velocity in the given array.
Definition formulas.h:480
FUNC volume volume_of_sphere(const length r)
Calculates the volume of a sphere from radius (r).
Definition formulas.h:168
FUNC velocity avg_of_array(velocity arr[], int n)
Returns the average velocity in the given array.
Definition formulas.h:504
FUNC area area_of_sphere(const length r)
Calculates the area of a sphere from radius (r).
Definition formulas.h:162
FUNC electric_potential 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).
Definition formulas.h:348
FUNC volume volume_of_cone(const length r, const length h)
Calculates the volume of a cone from radius (r) and height (h).
Definition formulas.h:156
FUNC angle angle3_in_triangle(const length a, const length o)
Calculates the angle in a right triangle from adjacent (a) and opposite (o).
Definition formulas.h:32
FUNC dimensionless glide_ratio(const length h, const length a)
Calculates the glide ratio from horizontal distance (h) and altitude lost (a).
Definition formulas.h:276
FUNC velocity speed_of_sound_in_air(const temperature T)
Calculates the speed of sound in air based on temperature (T).
Definition formulas.h:354
FUNC area area_of_cube(const length a)
Calculates the area of a cube from length (a).
Definition formulas.h:126
FUNC length 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.
Definition formulas.h:200
FUNC length 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...
Definition formulas.h:92
FUNC density density_of_dry_air(const pressure air_pressure, const temperature air_temperature)
Calculates the density of dry air.
Definition formulas.h:411
FUNC time 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 ...
Definition formulas.h:468
FUNC length circumference_of_circle(const length r)
Calculates the circumference of a circle from radius (r).
Definition formulas.h:74
FUNC length vertical_height(const angle glide_path, const length horizontal_distance)
Calculates the vertical height for the given glide path and horizontal distance.
Definition formulas.h:282
FUNC auto 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.
Definition formulas.h:447
FUNC area area_of_ellipse(const length a, const length b)
Calculates the area of an ellipse from radius (a) and (b).
Definition formulas.h:98
FUNC velocity sum_of_array(velocity arr[], int n)
Returns the sum of all velocities in the given array.
Definition formulas.h:515
FUNC length hypotenuse_of_triangle(const length a, const length b)
Calculates the hypotenuse in a right triangle, based on Pythagorean equation: a² + b² = c²
Definition formulas.h:14
FUNC time time_of_free_fall(const length height, const acceleration gravity)
Calculates the free fall time from the given height.
Definition formulas.h:194
FUNC angle angle2_in_triangle(const length a, const length h)
Calculates the angle in a right triangle from adjacent (a) and hypotenuse (h).
Definition formulas.h:26
FUNC auto consumed_electrical_power(const electric_current I, const electric_potential U)
Calculates the consumed electrical power of a current (I) and potential (U).
Definition formulas.h:441
FUNC dimensionless 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.
Definition formulas.h:244
FUNC volume volume_of_cylinder(const length r, const length h)
Calculates the volume of a cylinder based on radius (r) and height (h).
Definition formulas.h:144
FUNC angle glide_path(const length h, const length v)
Calculates the glide path from horizontal distance (h) and vertical change (v).
Definition formulas.h:270
FUNC length 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 v...
Definition formulas.h:454
FUNC velocity average_speed(const length distance, const time duration)
Calculates the average speed from distance and duration.
Definition formulas.h:182
FUNC area area_of_square(const length a)
Calculates the area of a square from length (a).
Definition formulas.h:62
FUNC length wavelength(const velocity v, const frequency f)
Calculates the wavelength from velocity (v) and frequency (f).
Definition formulas.h:342
FUNC area area_of_rectangle(const length l, const length b)
Calculates the area of a rectangle from length (l) and base (b).
Definition formulas.h:50
FUNC length 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 ve...
Definition formulas.h:461
FUNC temperature temperature_gradient(const length altitude)
Returns the temperature gradient per kilometer for the given geopotential altitude.
Definition formulas.h:393
FUNC area area_of_cone(const length r, const length h)
Calculates the area of a cone from radius (r) and height (h).
Definition formulas.h:150
FUNC acceleration 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).
Definition formulas.h:218
FUNC specific_energy 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)...
Definition formulas.h:474
FUNC force 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 ...
Definition formulas.h:308
FUNC acceleration 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.
Definition formulas.h:206
FUNC length perimeter_of_square(const length a)
Calculates the perimeter of a square from length (a).
Definition formulas.h:56
FUNC length latus_rectum_of_ellipse(const length a, const length b)
Calculates the latus rectum of an ellipse from radius (a) and (b).
Definition formulas.h:110
FUNC dimensionless BMI(const mass w, const length h)
Calculates the human body-mass index (BMI) from weight (w) and height (h).
Definition formulas.h:435
FUNC volume volume_of_prism(const area A, const length h)
Calculates the volume of a prism from base area (A) and height (h).
Definition formulas.h:174
FUNC length perimeter_of_rectangle(const length l, const length b)
Calculates the perimeter of a rectangle from length (l) and base (b).
Definition formulas.h:44
FUNC length radius_of_circumference(const length c)
Calculates the radius of a circle from circumference (c).
Definition formulas.h:80
FUNC volume volume_of_cube(const length a)
Calculates the volume of a cube from length (a).
Definition formulas.h:132
FUNC auto Newtons_motion(const length s0, const velocity v0, const acceleration a, const time t)
Definition formulas.h:373
FUNC velocity wheel_speed(const length r, const dimensionless RPM)
Calculates the wheel speed from wheel radius (r) and revolutions per minute (RPM).
Definition formulas.h:232
FUNC dimensionless 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.
Definition formulas.h:264
FUNC energy kinetic_energy(const mass m, const velocity v)
Calculates the kinetic energy of a non-rotating object of mass (m) traveling at velocity (v).
Definition formulas.h:188
FUNC force 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.
Definition formulas.h:258
FUNC auto Lorentz_force(const double q, const velocity v, const double B)
Calculates the Lorentz force.
Definition formulas.h:379
FUNC length Schwarzschild_radius(const mass M)
Calculates the Schwarzschild radius of a black hole from it's mass (M).
Definition formulas.h:334
FUNC area 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).
Definition formulas.h:68
FUNC mass mass_of(const density p, const volume V)
Calculates the mass from density (p) and volume (V).
Definition formulas.h:423
FUNC length turn_radius(const velocity ground_speed, const angle bank_angle)
Calculates the turn radius at the given speed and bank angle.
Definition formulas.h:294
FUNC area area_of_triangle(const length b, const length h)
Calculates the area of a triangle from base (b) and height (h).
Definition formulas.h:38
FUNC velocity climb_rate(const velocity ground_speed, const angle climb_angle)
Calculates the climb rate for the given speed and climb angle.
Definition formulas.h:288
FUNC velocity max_of_array(velocity arr[], int n)
Returns the maximum velocity in the given array.
Definition formulas.h:492
FUNC dimensionless wheel_rpm(const velocity v, const length r)
Calculates the revolutions per minute (RPM) from velocity (v) and wheel radius (r).
Definition formulas.h:226
FUNC length turning_radius_of_vehicle(const length wheelbase, const angle steering_angle, const length tire_width)
Calculates the turning radius of wheeled vehicles.
Definition formulas.h:238
FUNC volume volume_of(const mass m, const density p)
Calculates the volume from mass (m) and density (p).
Definition formulas.h:429
FUNC velocity true_airspeed(const force lift_force, const dimensionless lift_coefficient, const area wing_surface, const density air_density)
Calculates the true airspeed (TAS).
Definition formulas.h:252
FUNC force 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),...
Definition formulas.h:362
FUNC dimensionless eccentricity_of_ellipse(const length a, const length b)
Calculates the eccentricity of an ellipse from radius (a) and (b).
Definition formulas.h:104
FUNC dimensionless flattening_factor(const length Re, const length Rp)
Calculates the flattening factor (f) of an astronomical object from radius to equator (Re) and radius...
Definition formulas.h:320
FUNC acceleration local_gravity(const angle lat, const length h)
Calculates the theoretical local gravity at latitude (lat) and height above MSL (h).
Definition formulas.h:326
FUNC area area_of_circle(const length r)
Calculates the area of a circle from radius (r).
Definition formulas.h:86
Definition constants.h:12
SI_INLINE angle sin(angle a)
Calculates the sinus of an angle (a).
Definition units.h:145
double dimensionless
to hold a quantity without any unit, e.g. 42
Definition datatypes.h:18
SI_INLINE angle cos(angle a)
Calculates the cosinus of an angle (a).
Definition units.h:151
SI_INLINE angle sqrt(angle a)
Definition units.h:180
SI_INLINE angle tan(angle a)
Calculates the tangens of an angle (a).
Definition units.h:157
SI_INLINE angle sin2(angle x)
Calculates sin²x.
Definition units.h:169
angle radians
basic unit of radians for angle
Definition internal.h:15
SI_INLINE angle atan2(angle y, angle x)
Calculates the atangens of two angles.
Definition units.h:163
long double angle
basic datatype to hold a dimensionless angle, e.g. 3.1415
Definition internal.h:14
SI_INLINE_CONSTEXPR auto square(T x)
Raise any number <x> to power of 2 (x² or x*x).
Definition units.h:192