|
Phyth v0.1.0
A dimensional safe C++ header-only mechanics and electromagnetics simulation library.
|
Functions | |
| Scalar | sin (const Scalar q) |
| Sine of a dimensionless quantity. | |
| Scalar | cos (const Scalar q) |
| Cosine of a dimensionless quantity. | |
| Scalar | tan (const Scalar q) |
| Tangent of a dimensionless quantity. | |
| Scalar | asin (const Scalar q) |
| Arc sine (inverse sine) | |
| Scalar | acos (const Scalar q) |
| Arc cosine (inverse cosine) | |
| Scalar | atan (const Scalar q) |
| Arc tangent (inverse tangent) | |
| Scalar | atan2 (const Scalar y, const Scalar x) |
| Two-argument arc tangent (atan2) | |
| Scalar | sinh (const Scalar q) |
| Hyperbolic sine. | |
| Scalar | cosh (const Scalar q) |
| Hyperbolic cosine. | |
| Scalar | tanh (const Scalar q) |
| Hyperbolic tangent. | |
| Scalar | asinh (const Scalar q) |
| Inverse hyperbolic sine. | |
| Scalar | acosh (const Scalar q) |
| Inverse hyperbolic cosine. | |
| Scalar | atanh (const Scalar q) |
| Inverse hyperbolic tangent. | |
| Scalar | log (const Scalar q) |
| Natural logarithm (base e) | |
| Scalar | log10 (const Scalar q) |
| Base-10 logarithm. | |
| Scalar | log2 (const Scalar q) |
| Base-2 logarithm. | |
| Scalar | log1p (const Scalar q) |
| log(1 + q) with higher precision for small q | |
| Scalar | exp (const Scalar q) |
| Exponential (e^q) | |
| Scalar | expm1 (const Scalar q) |
| exp(q) - 1 with higher precision for small q | |
| Scalar | exp2 (const Scalar q) |
| Base-2 exponential (2^q) | |
| template<int Power, typename UnitT > | |
| auto | pow (Quantity< UnitT > q) |
| Raise a quantity to an integer power. | |
| template<typename UnitT > | |
| auto | square (Quantity< UnitT > q) |
| Square of a quantity. | |
| template<typename UnitT > | |
| auto | cube (Quantity< UnitT > q) |
| Cube of a quantity. | |
| template<int N, typename UnitT > | |
| auto | root (Quantity< UnitT > q) |
| N-th root of a quantity. | |
| template<typename UnitT > | |
| auto | sqrt (Quantity< UnitT > q) |
| Square root of a quantity. | |
| template<typename UnitT > | |
| auto | cbrt (Quantity< UnitT > q) |
| Cube root of a quantity. | |
| template<typename UnitT > | |
| auto | abs (Quantity< UnitT > q) |
| Absolute value of a quantity. | |
| template<typename UnitT > | |
| Quantity< UnitT > | fmod (Quantity< UnitT > x, Quantity< UnitT > y) |
| Floating-point remainder of x / y. | |
| template<typename UnitT > | |
| Quantity< UnitT > | modf (Quantity< UnitT > x, Quantity< UnitT > &y) |
| Decompose into integer and fractional parts. | |
| template<typename UnitT > | |
| Quantity< UnitT > | max (Quantity< UnitT > x, Quantity< UnitT > y) |
| Maximum of two quantities. | |
| template<typename UnitT > | |
| Quantity< UnitT > | min (Quantity< UnitT > x, Quantity< UnitT > y) |
| Minimum of two quantities. | |
| template<typename UnitT > | |
| Quantity< UnitT > | clamp (Quantity< UnitT > x, Quantity< UnitT > min, Quantity< UnitT > max) |
| Clamp a quantity between min and max bounds. | |
| template<typename UnitT > | |
| Quantity< UnitT > | floor (Quantity< UnitT > x) |
| Floor of a quantity (largest integer <= x) | |
| template<typename UnitT > | |
| bool | isnan (Quantity< UnitT > x) |
| Determine whether a quantity is nan. | |
| template<typename UnitT > | |
| bool | isfinite (Quantity< UnitT > x) |
| Determine whether a quantity is finite. | |
Absolute value of a quantity.
| q | The quantity |
Definition at line 332 of file QuantityFuncs.hpp.
Arc cosine (inverse cosine)
| q | Value in [-1, 1] (dimensionless) |
Definition at line 57 of file QuantityFuncs.hpp.
Inverse hyperbolic cosine.
| q | Value (dimensionless) |
Definition at line 128 of file QuantityFuncs.hpp.
Arc sine (inverse sine)
| q | Value in [-1, 1] (dimensionless) |
Definition at line 47 of file QuantityFuncs.hpp.
Inverse hyperbolic sine.
| q | Value (dimensionless) |
Definition at line 118 of file QuantityFuncs.hpp.
Arc tangent (inverse tangent)
| q | Value (dimensionless) |
Definition at line 67 of file QuantityFuncs.hpp.
Two-argument arc tangent (atan2)
| y | Y component (dimensionless) |
| x | X component (dimensionless) |
Definition at line 78 of file QuantityFuncs.hpp.
Inverse hyperbolic tangent.
| q | Value in (-1, 1) (dimensionless) |
Definition at line 138 of file QuantityFuncs.hpp.
Cube root of a quantity.
| q | The quantity to take the cube root of |
Definition at line 321 of file QuantityFuncs.hpp.
| Quantity< UnitT > Phyth::Utils::clamp | ( | Quantity< UnitT > | x, |
| Quantity< UnitT > | min, | ||
| Quantity< UnitT > | max | ||
| ) |
Clamp a quantity between min and max bounds.
| x | Value to clamp |
| min | Lower bound (inclusive) |
| max | Upper bound (inclusive) |
Definition at line 400 of file QuantityFuncs.hpp.
Cosine of a dimensionless quantity.
| q | Angle in radians (dimensionless) |
Definition at line 27 of file QuantityFuncs.hpp.
Hyperbolic cosine.
| q | Value (dimensionless) |
Definition at line 98 of file QuantityFuncs.hpp.
Cube of a quantity.
| UnitT | Unit type of the input quantity |
| q | The quantity to cube |
Definition at line 271 of file QuantityFuncs.hpp.
Exponential (e^q)
| q | Value (dimensionless) |
Definition at line 188 of file QuantityFuncs.hpp.
Base-2 exponential (2^q)
| q | Value (dimensionless) |
Definition at line 208 of file QuantityFuncs.hpp.
exp(q) - 1 with higher precision for small q
| q | Value (dimensionless) |
Definition at line 198 of file QuantityFuncs.hpp.
Floor of a quantity (largest integer <= x)
| x | Input quantity |
Definition at line 412 of file QuantityFuncs.hpp.
Floating-point remainder of x / y.
| x | Dividend |
| y | Divisor |
Definition at line 344 of file QuantityFuncs.hpp.
Determine whether a quantity is finite.
| x | Input quantity |
Definition at line 434 of file QuantityFuncs.hpp.
Determine whether a quantity is nan.
| x | Input quantity |
Definition at line 423 of file QuantityFuncs.hpp.
Natural logarithm (base e)
| q | Positive value (dimensionless) |
Definition at line 148 of file QuantityFuncs.hpp.
Base-10 logarithm.
| q | Positive value (dimensionless) |
Definition at line 158 of file QuantityFuncs.hpp.
log(1 + q) with higher precision for small q
| q | Value (dimensionless) |
Definition at line 178 of file QuantityFuncs.hpp.
Base-2 logarithm.
| q | Positive value (dimensionless) |
Definition at line 168 of file QuantityFuncs.hpp.
Maximum of two quantities.
| x | First quantity |
| y | Second quantity |
Definition at line 373 of file QuantityFuncs.hpp.
Minimum of two quantities.
| x | First quantity |
| y | Second quantity |
Definition at line 386 of file QuantityFuncs.hpp.
Decompose into integer and fractional parts.
| x | Input quantity |
| y | Output: integer part (same unit as x) |
Example: auto x = 3.14_m; auto frac = Utils::modf(x, int_part); // int_part = 3_m, frac = 0.14_m
Definition at line 361 of file QuantityFuncs.hpp.
Raise a quantity to an integer power.
The resulting dimension is the original dimension raised to the power.
| Power | Integer exponent (can be negative) |
| UnitT | Unit type of the input quantity |
| q | The quantity to raise |
Example: auto t = 2.0_s; auto t2 = Utils::pow<2>(t); // 4 s^2 auto inv_t = Utils::pow<-1>(t); // 0.5 s^-1
Definition at line 228 of file QuantityFuncs.hpp.
N-th root of a quantity.
| N | Root index (positive integer) |
| UnitT | Unit type of the input quantity |
| q | The quantity to take the root of |
Example: auto area = 9.0_m2; auto length = Utils::root<2>(area); // 3.0_m
Definition at line 291 of file QuantityFuncs.hpp.
Sine of a dimensionless quantity.
| q | Angle in radians (dimensionless) |
Definition at line 17 of file QuantityFuncs.hpp.
Hyperbolic sine.
| q | Value (dimensionless) |
Definition at line 88 of file QuantityFuncs.hpp.
Square root of a quantity.
| q | The quantity to take the square root of |
Example: auto area = 9.0_m2; auto length = Utils::sqrt(area); // 3.0_m
Definition at line 310 of file QuantityFuncs.hpp.
Square of a quantity.
| UnitT | Unit type of the input quantity |
| q | The quantity to square |
Example: auto t = 2.0_s; auto t2 = Utils::square(t); // 4 s^2
Definition at line 256 of file QuantityFuncs.hpp.
Tangent of a dimensionless quantity.
| q | Angle in radians (dimensionless) |
Definition at line 37 of file QuantityFuncs.hpp.
Hyperbolic tangent.
| q | Value (dimensionless) |
Definition at line 108 of file QuantityFuncs.hpp.