|
Blender V4.3
|
#include <BLI_math_angle_types.hh>
Public Member Functions | |
| T | degree () const |
| T | radian () const |
| AngleFraction | wrapped () const |
| AngleFraction | wrapped_around (const AngleFraction &reference) const |
| AngleFraction & | operator+= (const AngleFraction &b) |
| AngleFraction & | operator-= (const AngleFraction &b) |
| AngleFraction & | operator*= (const AngleFraction &b) |
| AngleFraction & | operator/= (const AngleFraction &b) |
| AngleFraction & | operator*= (const int64_t &b) |
| AngleFraction & | operator/= (const int64_t &b) |
| operator AngleCartesianBase< T > () const | |
Static Public Member Functions | |
| static AngleFraction | identity () |
| static AngleFraction | pi () |
| static AngleFraction | tau () |
Friends | |
| AngleFraction | operator+ (const AngleFraction &a, const AngleFraction &b) |
| AngleFraction | operator- (const AngleFraction &a, const AngleFraction &b) |
| AngleFraction | operator* (const AngleFraction &a, const AngleFraction &b) |
| AngleFraction | operator/ (const AngleFraction &a, const AngleFraction &b) |
| AngleFraction | operator* (const AngleFraction &a, const int64_t &b) |
| AngleFraction | operator/ (const AngleFraction &a, const int64_t &b) |
| AngleFraction | operator* (const int64_t &a, const AngleFraction &b) |
| AngleFraction | operator/ (const int64_t &a, const AngleFraction &b) |
| AngleFraction | operator+ (const AngleFraction &a) |
| AngleFraction | operator- (const AngleFraction &a) |
| bool | operator== (const AngleFraction &a, const AngleFraction &b) |
| bool | operator!= (const AngleFraction &a, const AngleFraction &b) |
| std::ostream & | operator<< (std::ostream &stream, const AngleFraction &rot) |
A blender::math::AngleFraction<T> stores a radian angle as quotient.
2 * sizeof(int64_t)cos(), sin(), tan() for angles not optimized.It offers the best accuracy for fractions of Pi radian angles. For instance sin(AngleFraction::tau() * n - AngleFraction::pi() / 2) will exactly return -1 for any n within [-INT_MAX..INT_MAX]. This holds true even with very high radian values.
Arithmetic operators are relatively cheap (4 operations for addition, 2 for multiplication) but not as cheap as a AngleRadian. Another nice property is that the cos() and sin() functions give symmetric results around the circle.
NOTE: Prefer converting to blender::math::AngleCartesianBase<T> if both cos() and sin() are needed. This will save some computation.
Any operation becomes undefined if either the numerator or the denominator overflows.
The T template parameter only serves as type for the computed values like cos() or radian().
Definition at line 375 of file BLI_math_angle_types.hh.
|
inline |
|
inlinestatic |
Static functions.
Definition at line 393 of file BLI_math_angle_types.hh.
Referenced by blender::math::angle_between(), and blender::tests::TEST().
|
inline |
Definition at line 593 of file BLI_math_angle_types.hh.
References blender::math::abs(), BLI_assert, BLI_assert_unreachable, blender::math::cos(), ELEM, blender::math::is_negative(), blender::math::numbers::pi, blender::math::rcp(), blender::math::sin(), blender::math::numbers::sqrt2, T, blender::math::AngleFraction< T >::wrapped(), x, and y.
|
inline |
Definition at line 551 of file BLI_math_angle_types.hh.
References b.
|
inline |
Definition at line 561 of file BLI_math_angle_types.hh.
References b.
|
inline |
Definition at line 541 of file BLI_math_angle_types.hh.
References b.
|
inline |
Definition at line 546 of file BLI_math_angle_types.hh.
References b.
|
inline |
Definition at line 556 of file BLI_math_angle_types.hh.
References b.
|
inline |
Definition at line 566 of file BLI_math_angle_types.hh.
References b.
|
inlinestatic |
Definition at line 398 of file BLI_math_angle_types.hh.
Referenced by blender::math::angle_between(), and blender::tests::TEST().
|
inline |
Definition at line 417 of file BLI_math_angle_types.hh.
References blender::math::abs(), blender::math::is_negative(), blender::math::numbers::pi, and T.
|
inlinestatic |
Definition at line 403 of file BLI_math_angle_types.hh.
Referenced by blender::tests::TEST().
|
inline |
Methods. Return the angle wrapped inside [-pi..pi] interval. Basically (angle + pi) % 2pi - pi.
Definition at line 460 of file BLI_math_angle_types.hh.
References blender::math::abs(), and blender::math::mod_periodic().
Referenced by blender::math::AngleFraction< T >::operator AngleCartesianBase< T >(), and blender::math::AngleFraction< T >::wrapped_around().
|
inline |
Return the angle wrapped inside [-pi..pi] interval around a reference . Basically (angle - reference + pi) % 2pi - pi + reference . This means the interpolation between the returned value and reference will always take the shortest path.
Definition at line 475 of file BLI_math_angle_types.hh.
References blender::math::AngleFraction< T >::wrapped().
|
friend |
Definition at line 582 of file BLI_math_angle_types.hh.
|
friend |
Definition at line 501 of file BLI_math_angle_types.hh.
|
friend |
Definition at line 511 of file BLI_math_angle_types.hh.
|
friend |
Definition at line 521 of file BLI_math_angle_types.hh.
|
friend |
Definition at line 531 of file BLI_math_angle_types.hh.
|
friend |
Operators. We only allow operations on fractions of pi. So we cannot implement things like AngleFraction::pi() + 1 or AngleFraction::pi() * 0.5.
Definition at line 487 of file BLI_math_angle_types.hh.
|
friend |
Definition at line 536 of file BLI_math_angle_types.hh.
|
friend |
Definition at line 496 of file BLI_math_angle_types.hh.
|
friend |
Definition at line 506 of file BLI_math_angle_types.hh.
|
friend |
Definition at line 516 of file BLI_math_angle_types.hh.
|
friend |
Definition at line 526 of file BLI_math_angle_types.hh.
|
friend |
Definition at line 587 of file BLI_math_angle_types.hh.
|
friend |
Definition at line 571 of file BLI_math_angle_types.hh.